-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Use 'checked' names for synthesized vb intrinsic operators #63604
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
Changes from all commits
4f0d321
0549a16
8a7b3c9
b918f3b
06d3616
c8c9ce6
89a596d
0e2f25a
1b6fff3
07f412b
219696f
d355c30
fc0e85f
db1a8c4
a596329
3266423
7823890
18d577a
648f802
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7636,10 +7636,6 @@ ExpressionSyntax node4 | |
| symbol1.ContainingType.EnumUnderlyingTypeOrSelf().SpecialType.IsIntegralType() || | ||
| symbol1.ContainingType.SpecialType == SpecialType.System_Char); | ||
| break; | ||
|
|
||
| default: | ||
| expectChecked = type.IsDynamic(); | ||
| break; | ||
| } | ||
|
|
||
| Assert.Equal(expectChecked, symbol1.IsCheckedBuiltin); | ||
|
|
@@ -8396,7 +8392,7 @@ ExpressionSyntax node8 | |
| Assert.Equal(MethodKind.BuiltinOperator, symbol1.MethodKind); | ||
| Assert.True(symbol1.IsImplicitlyDeclared); | ||
|
|
||
| bool isChecked; | ||
| bool isChecked = false; | ||
|
|
||
| switch (op) | ||
| { | ||
|
|
@@ -8406,10 +8402,6 @@ ExpressionSyntax node8 | |
| case BinaryOperatorKind.Division: | ||
| isChecked = isDynamic || symbol1.ContainingSymbol.Kind == SymbolKind.PointerType || symbol1.ContainingType.EnumUnderlyingTypeOrSelf().SpecialType.IsIntegralType(); | ||
| break; | ||
|
|
||
| default: | ||
| isChecked = isDynamic; | ||
| break; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now, no other op-types ever expect to be checked. |
||
| } | ||
|
|
||
| string expectedSymbol = String.Format("{4} {0}.{2}({1} left, {3} right)", | ||
|
|
@@ -8650,6 +8642,56 @@ void Test(dynamic x) | |
| compilation = compilation.WithOptions(TestOptions.ReleaseDll.WithOverflowChecks(true)); | ||
| semanticModel = compilation.GetSemanticModel(tree); | ||
|
|
||
| var symbols2 = (from node2 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node2).Symbol).ToArray(); | ||
| foreach (var symbol2 in symbols2) | ||
| { | ||
| Assert.False(symbol2.IsCheckedBuiltin); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these equality operator methods are not checked anymore. |
||
| Assert.True(((ITypeSymbol)symbol2.ContainingSymbol).IsDynamic()); | ||
| Assert.Null(symbol2.ContainingType); | ||
| } | ||
|
|
||
| for (int i = 0; i < symbols1.Length; i++) | ||
| { | ||
| Assert.Equal(symbols1[i], symbols2[i]); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because they're not checked, they are equal to the non-checked versions always. |
||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| public void DynamicBinaryIntrinsicSymbols2() | ||
| { | ||
| var source = | ||
| @" | ||
| class Module1 | ||
| { | ||
| void Test(dynamic x) | ||
| { | ||
| var z1 = x + 0; | ||
| var z2 = 0 + x; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i added this new test with dynamic and operators to show where 'checked' might actually appear. |
||
| } | ||
| }"; | ||
|
|
||
| var compilation = CreateCompilation(source, options: TestOptions.ReleaseDll.WithOverflowChecks(false)); | ||
|
|
||
| var tree = compilation.SyntaxTrees.Single(); | ||
| var semanticModel = compilation.GetSemanticModel(tree); | ||
|
|
||
| var nodes = (from node in tree.GetRoot().DescendantNodes() | ||
| select node as BinaryExpressionSyntax). | ||
| Where(node => node is not null).ToArray(); | ||
333fred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Assert.Equal(2, nodes.Length); | ||
|
|
||
| var symbols1 = (from node1 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node1).Symbol).ToArray(); | ||
| foreach (var symbol1 in symbols1) | ||
| { | ||
| Assert.False(symbol1.IsCheckedBuiltin); | ||
| Assert.True(((ITypeSymbol)symbol1.ContainingSymbol).IsDynamic()); | ||
| Assert.Null(symbol1.ContainingType); | ||
| } | ||
|
|
||
| compilation = compilation.WithOptions(TestOptions.ReleaseDll.WithOverflowChecks(true)); | ||
| semanticModel = compilation.GetSemanticModel(tree); | ||
|
|
||
| var symbols2 = (from node2 in nodes select (IMethodSymbol)semanticModel.GetSymbolInfo(node2).Symbol).ToArray(); | ||
| foreach (var symbol2 in symbols2) | ||
| { | ||
|
|
||
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.
now, no other op-types ever expect to be checked.