-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporate type names into Bicep symbol table #8876
Conversation
|
||
namespace Bicep.Core.TypeSystem | ||
{ | ||
public class TypeTypeProperty : TypeProperty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not good at naming things 😞. This class exists so that NamespaceType
can enforce that all of its properties are themselves types, which is represented as a TypeType
(another name that could probably use some work).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind the names, but would be good to add comments on the classes to describe what they represent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't try the build, but I have some questions:
|
Go to def, find refs, renaming, and highlighting work as expected. You can't go to the definition of The completion logic added in the PR kicks in when the user is in a location that expects a type expression, and any masked ambient types are added to the completions list as fully qualified references. |
Resolves #8811
This PR adds
array
,bool
,int
,string
, andobject
as properties to thesys
namespace and updates the NameBindingVisitor to look for type symbols on imported namespaces when resolving the symbol to which a name refers.This change allows for some simplification in the parser, as the parser does not need to distinguish between
SimpleTypeSyntax
(for ARM primitive types),TypeAccessSyntax
(for user-defined types), andVariableAccessSyntax
(for all other identifiers that are assumed to correspond to a defined symbol). Instead,VariableAccessSyntax
is used for all three cases. Most lines changed in this PR are updates tomain.syntax.bicep
baseline files in whichSimpleTypeSyntax
is being replaced withVariableAccessSyntax
.There are two breaking changes that would result from merging this PR:
param string string
is legal today, but with this change, it would need to be expressed asparam string sys.string
.import
statement. Doing so already removes any functions or decorators defined in the namespace, and with this change, it would also remove all types defined in the namesapce. For example,import 'az@1.0.0' as sys
(without an aliasing import of thesys
namespace in the same template) already blocks the use of most decorators and functions, but with this change, it would also block the use ofstring
,int
,bool
,array
, andobject
.Microsoft Reviewers: Open in CodeFlow