-
Notifications
You must be signed in to change notification settings - Fork 730
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
Add experimental support for aggregate type declarations #8673
Conversation
…ly when absolutely necessary
Since there's no terminating character, an incomplete union (`'foo'|`) will treat the start of the next declaration as skipped trivia unless inner union newlines are blocked
…hem as a fallback
@@ -89,7 +89,8 @@ public void Map_function_preserves_types_accurately_integers() | |||
var (file, cursors) = ParserHelper.GetFileWithCursors(@" |
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.
Rather than have it be customizable per-test, could we just come up with a different character or sequence of characters? ~
feels open, for example, or we could do something like |>
. Could always make the char param optional to provide an escape hatch if needed.
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.
Making this configurable per test was a request that came up during the discussions meeting, as you can't currently use logical or tokens in cursor tests. The idea was that not including a default forces the test writer to choose a character that does not appear in the test; this would also help by making cursor ambiguity a caller error rather than incorrect test behavior.
There were specific objections to every single character token on the US qwerty layout, which is why I ended up using ǂ
in hover and completion tests with type unions (though any single UCS-2 character that doesn't appear on the keyboard would be fine).
I think as long as |
_ => valueIfFalse, | ||
}; | ||
|
||
private bool HasSecureDecorator(DecorableSyntax syntax) |
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.
Would be nice to have a common place to put these - extension method on IBinder
or DecorableSyntax
?
public static DecoratorSyntax? TryGetSecureDecorator(this IBinder binder, DecorableSyntax syntax)
public static DecoratorSyntax? TryGetSecureDecorator(this DecorableSyntax syntax, IBinder binder)
24b4037
to
d764457
Compare
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.
Looks good! I think there are still a few comments, but nothing blocking from my perspective.
d764457
to
de9d2ac
Compare
This PR adds a
type
keyword that can be used to declare user-defined type symbols, as well as a parser and grammar for describing custom structure, typed array, and union types. The types that can be declared in atype
statement (or as the type clause of aparam
statement) include:true
,'fizz'|'buzz'
,1|2|3
,{foo: 'bar'}|{ping: 'pong'}
)Types are included in the compiled ARM JSON template and will be enforced by the ARM runtime. Everything is disabled by default and requires an explicit feature flag to opt in. Also, map types and tuple types are not included in this PR. Given those caveats, this PR works towards #4158 but does not resolve it.
Microsoft Reviewers: Open in CodeFlow