IDE changes for "Unsigned Right Shift" feature, plus tests.#60689
Conversation
| var code = @"$$ | ||
| class C | ||
| { | ||
| public static C operator >>> ( C x, C y){ |
There was a problem hiding this comment.
nit: consider starting with no space or two spaces between operator and >>>, to show that part got formatted #Resolved
| @"int x; | ||
|
|
||
| x = x >>>$$ x;", | ||
| MainDescription("int int.operator >>>(int left, int right)")); |
There was a problem hiding this comment.
Is there a similar QuickInfo scenario for >>>=? (I'm not sure what's the expected behavior) #Resolved
| [InlineData("<=")] | ||
| [InlineData("<<")] | ||
| [InlineData(">>")] | ||
| [InlineData(">>>")] |
There was a problem hiding this comment.
Tagging @BillWagner as we'll want landing pages for F1/Help on >>> and >>>=
| OperatorKind.Multiply => SyntaxKind.AsteriskToken, | ||
| OperatorKind.OnesComplement => SyntaxKind.TildeToken, | ||
| OperatorKind.RightShift => SyntaxKind.GreaterThanGreaterThanToken, | ||
| OperatorKind.UnsignedRightShift => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, |
There was a problem hiding this comment.
Another scenario that may be worth validating is MetadataAsSource. Hopefully, it's using the same syntax generator and is fine.
|
@jasonmalinowski, @333fred Please review |
|
@jasonmalinowski Please review |
jasonmalinowski
left a comment
There was a problem hiding this comment.
IDE part looks good. Only comments are some potential places for additional tests, but no reason to hold up this PR for that.
| public static bool IsPunctuation(SyntaxKind kind) | ||
| { | ||
| return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.QuestionQuestionEqualsToken; | ||
| return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; |
There was a problem hiding this comment.
This is also including !! that wasn't included before; that seems reasonable to me but we think that was just an oversight before? #Resolved
There was a problem hiding this comment.
This is also including !! that wasn't included before; that seems reasonable to me but we think that was just an oversight before?
I think it was. CC @RikkiGibson
There was a problem hiding this comment.
Yes, it was an oversight. It looks like this could change behavior of classification of !!, but I must not have added any tests for !! to src/EditorFeatures/CSharpTest/Classification/SyntacticClassifierTests.cs.
| public static IEnumerable<SyntaxKind> GetPunctuationKinds() | ||
| { | ||
| for (int i = (int)SyntaxKind.TildeToken; i <= (int)SyntaxKind.PercentEqualsToken; i++) | ||
| for (int i = (int)SyntaxKind.TildeToken; i <= (int)SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; i++) |
There was a problem hiding this comment.
Should there be a test that each kind returned from GetPunctuationKinds returns true for IsPunctuationKind? Since it seems there were other existing bugs here too. #Resolved
| if (onRightOfToken) | ||
| { | ||
| // x << Goo(), x >> Goo(), x <<= Goo(), x >>= Goo() | ||
| // x << Goo(), x >> Goo(), x >>> Goo(), x <<= Goo(), x >>= Goo(), x >>>= Goo() |
There was a problem hiding this comment.
roslyn/src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
Lines 194 to 199 in b0cd71f
Test plan #60433