From aad832234a6f27e4af734babd36209123544265a Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 20 Oct 2017 08:29:12 -0500 Subject: [PATCH 01/28] Avoid showing language keywords after typing < in a doc comment Fixes #22789 --- ...mentationCommentCompletionProviderTests.cs | 64 +++++++++++++++++++ ...arpCompletionCommandHandlerTests_XmlDoc.vb | 25 ++++++++ .../XmlDocCommentCompletionProviderTests.vb | 60 +++++++++++++++++ .../XmlDocCommentCompletionProvider.cs | 10 ++- .../AbstractDocCommentCompletionProvider.cs | 7 +- .../XmlDocCommentCompletionProvider.vb | 12 +++- 6 files changed, 173 insertions(+), 5 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs index 41b5237d5f63a..81fa04ed8011f 100644 --- a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs @@ -653,6 +653,70 @@ static void Goo() }", "cref", "langword"); } + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionInPlainText() + { + await VerifyItemsExistAsync(@" +class C +{ + /// + /// Some text $$ + /// + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionAfterAngleBracket1() + { + await VerifyItemsAbsentAsync(@" +class C +{ + /// + /// Some text <$$ + /// + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionAfterAngleBracket2() + { + await VerifyItemsAbsentAsync(@" +class C +{ + /// + /// Some text + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionAfterAngleBracket3() + { + await VerifyItemsExistAsync(@" +class C +{ + /// + /// Some text < $$ + /// + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + [WorkItem(11490, "https://github.com/dotnet/roslyn/issues/11490")] [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task SeeLangwordAttributeValue() diff --git a/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb b/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb index 960aa814db98f..37f6d330a6919 100644 --- a/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb +++ b/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb @@ -577,6 +577,31 @@ class c End Using End Function + + + Public Async Function InvokeWithOpenAngleCommitSeeOnTab() As Task + + Using state = TestState.CreateCSharpTestState( + ) + + state.SendTypeChars("<") + Await state.AssertCompletionSession() + state.SendTypeChars("se") + Await state.AssertSelectedCompletionItem(displayText:="see") + state.SendTab() + Await state.AssertNoCompletionSession() + + ' /// + Await state.AssertLineTextAroundCaret(" /// ") + End Using + End Function + Public Async Function InvokeWithOpenAngleCommitSeeOnSpace() As Task diff --git a/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb b/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb index 6469257e26f41..b07ec406319b4 100644 --- a/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb @@ -774,6 +774,66 @@ End Class Await VerifyItemsExistAsync(text, "cref", "langword") End Function + + + Public Async Function TestLangwordCompletionInPlainText() As Task + Dim text = " +Class C + ''' + ''' Some text $$ + ''' + Sub Goo() + End Sub +End Class +" + Await VerifyItemsExistAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + + + + Public Async Function LangwordCompletionAfterAngleBracket1() As Task + Dim text = " +Class C + ''' + ''' Some text <$$ + ''' + Sub Goo() + End Sub +End Class +" + Await VerifyItemsAbsentAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + + + + Public Async Function LangwordCompletionAfterAngleBracket2() As Task + Dim text = " +Class C + ''' + ''' Some text + Sub Goo() + End Sub +End Class +" + Await VerifyItemsAbsentAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + + + + Public Async Function LangwordCompletionAfterAngleBracket3() As Task + Dim text = " +Class C + ''' + ''' Some text < $$ + ''' + Sub Goo() + End Sub +End Class +" + Await VerifyItemsExistAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + Public Async Function TestSeeLangwordAttributeValue() As Task diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs index ed89824397079..8666a89a933c4 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs @@ -101,7 +101,15 @@ protected override async Task> GetItemsWorkerAsync( if (token.Parent.Parent.Kind() == SyntaxKind.XmlElement || token.Parent.Parent.IsParentKind(SyntaxKind.XmlElement)) { - items.AddRange(GetNestedItems(declaredSymbol)); + // Avoid including language keywords when following < or GetNestedItems(ISymbol symbol) + protected IEnumerable GetNestedItems(ISymbol symbol, bool includeKeywords) { var items = s_nestedTagNames.Select(GetItem); @@ -135,7 +135,10 @@ protected IEnumerable GetNestedItems(ISymbol symbol) .Concat(GetTypeParamRefItems(symbol)); } - items = items.Concat(GetKeywordNames().Select(CreateLangwordCompletionItem)); + if (includeKeywords) + { + items = items.Concat(GetKeywordNames().Select(CreateLangwordCompletionItem)); + } return items; } diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb index 945bc2c4a69b2..0c53ddd2b7437 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb @@ -110,7 +110,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers Dim grandParent = parentElement?.Parent If grandParent.IsKind(SyntaxKind.XmlElement) Then - items.AddRange(GetNestedItems(symbol)) + ' Avoid including language keywords when following < Or Date: Fri, 20 Oct 2017 13:12:08 -0500 Subject: [PATCH 02/28] Make the VB experience self-consistent, even though it differs from C# --- .../XmlDocCommentCompletionProviderTests.vb | 2 +- .../XmlDocCommentCompletionProvider.vb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb b/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb index b07ec406319b4..5be1254148d7a 100644 --- a/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb @@ -831,7 +831,7 @@ Class C End Sub End Class " - Await VerifyItemsExistAsync(text, "Nothing", "Shared", "True", "False", "Await") + Await VerifyItemsAbsentAsync(text, "Nothing", "Shared", "True", "False", "Await") End Function diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb index 0c53ddd2b7437..ea37d85f9eccf 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb @@ -111,11 +111,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers If grandParent.IsKind(SyntaxKind.XmlElement) Then ' Avoid including language keywords when following < Or Date: Wed, 25 Oct 2017 09:07:27 -0700 Subject: [PATCH 03/28] Generate parenthesized operation for parenthesized syntax in C# This matches the VB behavior and avoids GetOperation returning null for parenthesized expression. Fixes #22751 --- .../Operations/CSharpOperationFactory.cs | 28 +- .../Diagnostics/OperationAnalyzerTests.cs | 2 +- ...ationTests_IAnonymousFunctionExpression.cs | 62 ++-- ...nTests_IArrayElementReferenceExpression.cs | 8 +- ...perationTests_IBinaryOperatorExpression.cs | 264 ++++++++++-------- .../IOperationTests_IConversionExpression.cs | 6 +- ...rationTests_IDelegateCreationExpression.cs | 72 +++-- .../IOperationTests_IForLoopStatement.cs | 12 +- .../IOperationTests_IIfStatement.cs | 8 +- ...tionTests_IParameterReferenceExpression.cs | 12 +- .../IOperationTests_IParenthesized.cs | 159 +++++++++++ ...OperationTests_IWhileUntilLoopStatement.cs | 90 +++--- .../IOperationTests_InvalidExpression.cs | 18 +- .../Semantic/Semantics/DeconstructionTests.cs | 28 +- .../ObjectAndCollectionInitializerTests.cs | 12 +- .../Test/Semantic/Semantics/OperatorTests.cs | 24 +- .../Test/Semantic/Semantics/QueryTests.cs | 40 +-- .../Symbols/AnonymousTypesSemanticsTests.cs | 43 +-- .../Diagnostics/OperationTestAnalyzer.cs | 2 +- 19 files changed, 585 insertions(+), 305 deletions(-) create mode 100644 src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index d4e4679540750..d215e6f63bab6 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -42,8 +42,13 @@ public IOperation Create(BoundNode boundNode) return _cache.GetOrAdd(boundNode, n => CreateInternal(n)); } - private IOperation CreateInternal(BoundNode boundNode) + private IOperation CreateInternal(BoundNode boundNode, bool createParenthesized = true) { + if (createParenthesized && boundNode.Syntax.Parent is ParenthesizedExpressionSyntax) + { + return CreateParenthesizedExpression(boundNode); + } + switch (boundNode.Kind) { case BoundKind.DeconstructValuePlaceholder: @@ -244,6 +249,24 @@ private IOperation CreateInternal(BoundNode boundNode) } } + private IParenthesizedExpression CreateParenthesizedExpression(BoundNode boundNode) + { + var parenthesizedSyntax = (ParenthesizedExpressionSyntax)boundNode.Syntax.Parent; + + // Create the child operation without parenthesized. + IOperation operation = CreateInternal(boundNode, createParenthesized: false); + + // Walk up the parentheses wrapping the operation with ParenthesizedExpression operation nodes. + do + { + operation = new ParenthesizedExpression(operation, _semanticModel, parenthesizedSyntax, operation.Type, operation.ConstantValue, isImplicit: false); + parenthesizedSyntax = parenthesizedSyntax.Parent as ParenthesizedExpressionSyntax; + } + while (parenthesizedSyntax != null); + + return (ParenthesizedExpression)operation; + } + private ImmutableArray GetIOperationChildren(BoundNode boundNode) { var boundNodeWithChildren = (IBoundNodeWithIOperationChildren)boundNode; @@ -700,8 +723,9 @@ private IOperation CreateUnboundLambdaOperation(UnboundLambda unboundLambda) // nodes for the lambda expression. So, we ask the semantic model for the IOperation node for the unbound lambda syntax. // We are counting on the fact that will do the error recovery and actually create the BoundLambda node appropriate for // this syntax node. + // Also note that we pass "createParenthesized = false" to avoid duplicate invocations to CreateParenthesized for bound and unbound lambda nodes. BoundLambda boundLambda = unboundLambda.BindForErrorRecovery(); - return CreateInternal(boundLambda); + return CreateInternal(boundLambda, createParenthesized: false); } private IAnonymousFunctionExpression CreateBoundLambdaOperation(BoundLambda boundLambda) diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs index 47efd6500471a..ac8b174fd4322 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs @@ -1391,7 +1391,7 @@ public unsafe void M1() .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_InvalidAddrOp, "a + b").WithLocation(7, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AddressOfTestAnalyzer() }, null, null, false, Diagnostic("AddressOfOperation", "&(a + b)").WithLocation(7, 16), - Diagnostic("InvalidAddressOfReference", "a + b").WithLocation(7, 18), + Diagnostic("InvalidAddressOfReference", "(a + b)").WithLocation(7, 17), Diagnostic("AddressOfOperation", "&a").WithLocation(9, 16), Diagnostic("AddressOfOperation", "&i").WithLocation(28, 22), Diagnostic("AddressOfOperation", "&_i").WithLocation(31, 25), diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs index 1a8af4411a486..1b62f376c6dbc 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs @@ -118,17 +118,19 @@ static void F() IVariableInitializer (OperationKind.VariableInitializer) (Syntax: '= (Action)(() => F())') IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action) (Syntax: '(Action)(() => F())') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => F()') - IBlockStatement (2 statements) (OperationKind.BlockStatement, IsImplicit) (Syntax: 'F()') - IExpressionStatement (OperationKind.ExpressionStatement, IsImplicit) (Syntax: 'F()') - Expression: - IInvocationExpression (void Program.F()) (OperationKind.InvocationExpression, Type: System.Void) (Syntax: 'F()') - Instance Receiver: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null) (Syntax: '(() => F())') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => F()') + IBlockStatement (2 statements) (OperationKind.BlockStatement, IsImplicit) (Syntax: 'F()') + IExpressionStatement (OperationKind.ExpressionStatement, IsImplicit) (Syntax: 'F()') + Expression: + IInvocationExpression (void Program.F()) (OperationKind.InvocationExpression, Type: System.Void) (Syntax: 'F()') + Instance Receiver: + null + Arguments(0) + IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: 'F()') + ReturnedValue: null - Arguments(0) - IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: 'F()') - ReturnedValue: - null "; var expectedDiagnostics = DiagnosticDescription.None; @@ -290,17 +292,19 @@ static void F() Operand: IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => F())') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => F()') - IBlockStatement (2 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: 'F()') - IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: 'F()') - Expression: - IInvocationExpression (void Program.F()) (OperationKind.InvocationExpression, Type: System.Void, IsInvalid) (Syntax: 'F()') - Instance Receiver: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '(() => F())') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => F()') + IBlockStatement (2 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: 'F()') + IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: 'F()') + Expression: + IInvocationExpression (void Program.F()) (OperationKind.InvocationExpression, Type: System.Void, IsInvalid) (Syntax: 'F()') + Instance Receiver: + null + Arguments(0) + IReturnStatement (OperationKind.ReturnStatement, IsInvalid, IsImplicit) (Syntax: 'F()') + ReturnedValue: null - Arguments(0) - IReturnStatement (OperationKind.ReturnStatement, IsInvalid, IsImplicit) (Syntax: 'F()') - ReturnedValue: - null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0029: Cannot implicitly convert type 'System.Action' to 'System.Action' @@ -338,14 +342,16 @@ static void F() IVariableInitializer (OperationKind.VariableInitializer, IsInvalid) (Syntax: '= (Action F())') IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => F())') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => F()') - IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: 'F()') - IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: 'F()') - Expression: - IInvocationExpression (void Program.F()) (OperationKind.InvocationExpression, Type: System.Void, IsInvalid) (Syntax: 'F()') - Instance Receiver: - null - Arguments(0) + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '(() => F())') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => F()') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: 'F()') + IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: 'F()') + Expression: + IInvocationExpression (void Program.F()) (OperationKind.InvocationExpression, Type: System.Void, IsInvalid) (Syntax: 'F()') + Instance Receiver: + null + Arguments(0) "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1593: Delegate 'Action' does not take 0 arguments diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs index b6028b7df4861..24e0ba273f8f6 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs @@ -416,10 +416,12 @@ public static explicit operator string[](C c) string expectedOperationTree = @" IArrayElementReferenceExpression (OperationKind.ArrayElementReferenceExpression, Type: System.String) (Syntax: '((string[])c)[x]') Array reference: - IConversionExpression (Explicit, TryCast: False, Unchecked) (OperatorMethod: System.String[] C.op_Explicit(C c)) (OperationKind.ConversionExpression, Type: System.String[]) (Syntax: '(string[])c') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: True) (MethodSymbol: System.String[] C.op_Explicit(C c)) + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.String[]) (Syntax: '((string[])c)') Operand: - IParameterReferenceExpression: c (OperationKind.ParameterReferenceExpression, Type: C) (Syntax: 'c') + IConversionExpression (Explicit, TryCast: False, Unchecked) (OperatorMethod: System.String[] C.op_Explicit(C c)) (OperationKind.ConversionExpression, Type: System.String[]) (Syntax: '(string[])c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: True) (MethodSymbol: System.String[] C.op_Explicit(C c)) + Operand: + IParameterReferenceExpression: c (OperationKind.ParameterReferenceExpression, Type: C) (Syntax: 'c') Indices(1): IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x') "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs index 77428fb651edb..76929fd236226 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs @@ -197,17 +197,21 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '(a >> 10) + (b << 20)') Left: - IBinaryOperatorExpression (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a >> 10') - Left: - IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a >> 10)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a >> 10') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - IBinaryOperatorExpression (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'b << 20') - Left: - IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 20) (Syntax: '20') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(b << 20)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'b << 20') + Left: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 20) (Syntax: '20') Right: IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'c * d / e % f') Left: @@ -229,67 +233,79 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IParameterReferenceExpression: h (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'h') Right: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') - Left: - IParameterReferenceExpression: i (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'i') - Right: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') - Left: - IParameterReferenceExpression: j (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'j') - Right: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(i == (j != ... 0) ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') + Left: + IParameterReferenceExpression: i (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'i') + Right: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(j != ((((k ... 0) ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') Condition: - IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') + IBinaryOperatorExpression (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') Left: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') - Left: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') - Left: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') + IParameterReferenceExpression: j (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'j') + Right: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((((k < l ? ... p ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') + Left: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(((k < l ? ... o ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') Condition: - IBinaryOperatorExpression (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'k < l') + IBinaryOperatorExpression (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') Left: - IParameterReferenceExpression: k (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'k') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((k < l ? 1 ... m ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') + Left: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(k < l ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'k < l') + Left: + IParameterReferenceExpression: k (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'k') + Right: + IParameterReferenceExpression: l (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'l') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceExpression: m (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'm') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') Right: - IParameterReferenceExpression: l (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'l') + IParameterReferenceExpression: o (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'o') WhenTrue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceExpression: m (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'm') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceExpression: o (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'o') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceExpression: p (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'p') + Right: + IParameterReferenceExpression: p (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'p') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') WhenTrue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; @@ -331,17 +347,21 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '(a >> 10) + (b << 20)') Left: - IBinaryOperatorExpression (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a >> 10') - Left: - IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a >> 10)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a >> 10') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - IBinaryOperatorExpression (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'b << 20') - Left: - IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 20) (Syntax: '20') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(b << 20)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'b << 20') + Left: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 20) (Syntax: '20') Right: IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'c * d / e % f') Left: @@ -363,67 +383,79 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IParameterReferenceExpression: h (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'h') Right: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') - Left: - IParameterReferenceExpression: i (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'i') - Right: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') - Left: - IParameterReferenceExpression: j (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'j') - Right: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(i == (j != ... 0) ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') + Left: + IParameterReferenceExpression: i (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'i') + Right: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(j != ((((k ... 0) ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') Condition: - IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') + IBinaryOperatorExpression (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') Left: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') - Left: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') - Condition: - IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') - Left: - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') + IParameterReferenceExpression: j (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'j') + Right: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((((k < l ? ... p ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') + Left: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(((k < l ? ... o ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') Condition: - IBinaryOperatorExpression (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'k < l') + IBinaryOperatorExpression (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') Left: - IParameterReferenceExpression: k (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'k') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((k < l ? 1 ... m ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') + Left: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(k < l ? 1 : 0)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') + Condition: + IBinaryOperatorExpression (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'k < l') + Left: + IParameterReferenceExpression: k (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'k') + Right: + IParameterReferenceExpression: l (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'l') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceExpression: m (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'm') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') Right: - IParameterReferenceExpression: l (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'l') + IParameterReferenceExpression: o (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'o') WhenTrue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceExpression: m (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'm') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceExpression: o (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'o') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceExpression: p (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'p') + Right: + IParameterReferenceExpression: p (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'p') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') WhenTrue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs index e9be9a3a3cd8b..49750bcfeb0a2 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs @@ -4056,8 +4056,10 @@ static void M1() IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: I2, IsInvalid) (Syntax: '(I2)()') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IInvalidExpression (OperationKind.InvalidExpression, Type: null, IsInvalid) (Syntax: '') - Children(0) + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '()') + Operand: + IInvalidExpression (OperationKind.InvalidExpression, Type: null, IsInvalid) (Syntax: '') + Children(0) "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1525: Invalid expression term ')' diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs index dcf472f4dc7c1..5a5760f02b9ef 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs @@ -159,11 +159,13 @@ void Main() string expectedOperationTree = @" IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action) (Syntax: '(Action)(() => { })') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => { }') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '{ }') - IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: '{ }') - ReturnedValue: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null) (Syntax: '(() => { })') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => { }') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '{ }') + IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: '{ }') + ReturnedValue: + null "; var expectedDiagnostics = DiagnosticDescription.None; @@ -187,14 +189,16 @@ void Main() string expectedOperationTree = @" IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => 1)') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => 1') - IBlockStatement (2 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: '1') - IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: '1') - Expression: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') - IReturnStatement (OperationKind.ReturnStatement, IsInvalid, IsImplicit) (Syntax: '1') - ReturnedValue: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '(() => 1)') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => 1') + IBlockStatement (2 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: '1') + IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: '1') + Expression: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid, IsImplicit) (Syntax: '1') + ReturnedValue: + null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement @@ -222,8 +226,10 @@ void Main() string expectedOperationTree = @" IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action, IsInvalid) (Syntax: '(Action)((int i) => { })') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '(int i) => { }') - IBlockStatement (0 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: '{ }') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '((int i) => { })') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '(int i) => { }') + IBlockStatement (0 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: '{ }') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1593: Delegate 'Action' does not take 1 arguments @@ -1277,11 +1283,13 @@ void Main() Target: IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action) (Syntax: '(Action)(() => { })') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => { }') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '{ }') - IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: '{ }') - ReturnedValue: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null) (Syntax: '(() => { })') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => { }') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '{ }') + IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: '{ }') + ReturnedValue: + null "; var expectedDiagnostics = DiagnosticDescription.None; @@ -1307,14 +1315,16 @@ void Main() Children(1): IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => 1)') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => 1') - IBlockStatement (2 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: '1') - IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: '1') - Expression: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') - IReturnStatement (OperationKind.ReturnStatement, IsInvalid, IsImplicit) (Syntax: '1') - ReturnedValue: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '(() => 1)') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '() => 1') + IBlockStatement (2 statements) (OperationKind.BlockStatement, IsInvalid, IsImplicit) (Syntax: '1') + IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid, IsImplicit) (Syntax: '1') + Expression: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid, IsImplicit) (Syntax: '1') + ReturnedValue: + null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement @@ -1344,8 +1354,10 @@ void Main() Children(1): IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Action, IsInvalid) (Syntax: '(Action)((int i) => { })') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '(int i) => { }') - IBlockStatement (0 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: '{ }') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '((int i) => { })') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '(int i) => { }') + IBlockStatement (0 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: '{ }') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1593: Delegate 'Action' does not take 1 arguments diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index 6b83eec544de9..35a4dcd6deed6 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1119,11 +1119,13 @@ static void Main(string[] args) Condition: IBinaryOperatorExpression (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(j % 2) != 0') Left: - IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'j % 2') - Left: - ILocalReferenceExpression: j (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'j') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(j % 2)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'j % 2') + Left: + ILocalReferenceExpression: j (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'j') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') IfTrue: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs index 6f924f04bb5e8..b22e56d6bad0a 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs @@ -1140,10 +1140,12 @@ Type Arguments(0) Right: IInvocationExpression (virtual System.Boolean System.ValueType.Equals(System.Object obj)) (OperationKind.InvocationExpression, Type: System.Boolean) (Syntax: '((T)d).Equals(x)') Instance Receiver: - IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: T) (Syntax: '(T)d') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: T) (Syntax: '((T)d)') Operand: - IParameterReferenceExpression: d (OperationKind.ParameterReferenceExpression, Type: dynamic) (Syntax: 'd') + IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: T) (Syntax: '(T)d') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParameterReferenceExpression: d (OperationKind.ParameterReferenceExpression, Type: dynamic) (Syntax: 'd') Arguments(1): IArgument (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument) (Syntax: 'x') IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Object, IsImplicit) (Syntax: 'x') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index e1d5eaf16077c..9a16328059fdb 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -819,11 +819,13 @@ public void M(int x) Pattern: IDeclarationPattern (Declared Symbol: System.Int32 y) (OperationKind.DeclarationPattern) (Syntax: 'var y') Guard Expression: - IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'x >= 10') - Left: - IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Boolean) (Syntax: '(x >= 10)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'x >= 10') + Left: + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') Body: IBranchStatement (BranchKind.Break) (OperationKind.BranchStatement) (Syntax: 'break;') "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs new file mode 100644 index 0000000000000..3c45ec312b328 --- /dev/null +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Semantics; +using Microsoft.CodeAnalysis.Test.Utilities; +using Microsoft.CodeAnalysis.VisualBasic; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests +{ + public partial class IOperationTests : SemanticModelTestBase + { + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesized() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return /**/(a + b)/**/; + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedChild() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return (/**/a + b/**/); + } +} +"; + string expectedOperationTree = @" +IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedParent() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + /**/return (a + b);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'return (a + b);') + ReturnedValue: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return (/**/((a + b))/**/); + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((a + b))') + Operand: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting02() + { + string source = @" +class P +{ + static int M1(int a, int b, int c) + { + return (/**/((a + b) * c)/**/); + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((a + b) * c)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '(a + b) * c') + Left: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') + Right: + IParameterReferenceExpression: c (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'c') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + } +} diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs index 7411115009054..01529c0f9dd8e 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs @@ -351,11 +351,13 @@ static void Main() Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(i = value) >= 0') Left: - ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'i = value') - Left: - ILocalReferenceExpression: i (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'i') - Right: - ILocalReferenceExpression: value (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'value') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(i = value)') + Operand: + ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'i = value') + Left: + ILocalReferenceExpression: i (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'i') + Right: + ILocalReferenceExpression: value (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'value') Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') Body: @@ -458,11 +460,13 @@ public static int GetFirstEvenNumber(int number) Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(number % 2) == 0') Left: - IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'number % 2') - Left: - IParameterReferenceExpression: number (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'number') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(number % 2)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'number % 2') + Left: + IParameterReferenceExpression: number (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'number') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') IfTrue: @@ -517,11 +521,13 @@ public static int GetFirstEvenNumber(int number) Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(number % 2) == 0') Left: - IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'number % 2') - Left: - IParameterReferenceExpression: number (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'number') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(number % 2)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'number % 2') + Left: + IParameterReferenceExpression: number (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'number') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') IfTrue: @@ -1111,14 +1117,16 @@ public void TryMethod() IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.SByte) (Syntax: '(sbyte)(x / 2)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x / 2') - Left: - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32, IsImplicit) (Syntax: 'x') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: - ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.SByte) (Syntax: 'x') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(x / 2)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x / 2') + Left: + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32, IsImplicit) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.SByte) (Syntax: 'x') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') Catch clauses(0) Finally: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '{ ... }') @@ -1184,14 +1192,16 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, IsImplicit) (Syntax: 'f ? 1 : 2') - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'f ? 1 : 2') - Condition: - ILocalReferenceExpression: f (OperationKind.LocalReferenceExpression, Type: System.Boolean) (Syntax: 'f') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: '(f ? 1 : 2)') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(f ? 1 : 2)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'f ? 1 : 2') + Condition: + ILocalReferenceExpression: f (OperationKind.LocalReferenceExpression, Type: System.Boolean) (Syntax: 'f') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'out var x1') @@ -1281,14 +1291,16 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, IsImplicit) (Syntax: 'f ? 1 : 2') - IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'f ? 1 : 2') - Condition: - ILocalReferenceExpression: f (OperationKind.LocalReferenceExpression, Type: System.Boolean) (Syntax: 'f') - WhenTrue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: '(f ? 1 : 2)') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(f ? 1 : 2)') + Operand: + IConditionalExpression (OperationKind.ConditionalExpression, Type: System.Int32) (Syntax: 'f ? 1 : 2') + Condition: + ILocalReferenceExpression: f (OperationKind.LocalReferenceExpression, Type: System.Boolean) (Syntax: 'f') + WhenTrue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'out var x1') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs index 5313a66cb8933..ee0f89e9c8331 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs @@ -301,14 +301,16 @@ void F() Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: Program) (Syntax: 'x') Right: - IBinaryOperatorExpression (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'y * args.Length') - Left: - IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'y') - Children(0) - Right: - IPropertyReferenceExpression: System.Int32 System.Array.Length { get; } (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'args.Length') - Instance Receiver: - IParameterReferenceExpression: args (OperationKind.ParameterReferenceExpression, Type: System.String[]) (Syntax: 'args') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ?, IsInvalid) (Syntax: '(y * args.Length)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'y * args.Length') + Left: + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'y') + Children(0) + Right: + IPropertyReferenceExpression: System.Int32 System.Array.Length { get; } (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'args.Length') + Instance Receiver: + IParameterReferenceExpression: args (OperationKind.ParameterReferenceExpression, Type: System.String[]) (Syntax: 'args') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0103: The name 'y' does not exist in the current context diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs index dc682f233bd18..5187e9f509de6 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs @@ -885,10 +885,12 @@ static void Main() string expectedOperationTree = @" IInvocationExpression (virtual System.String (System.Int32, System.String).ToString()) (OperationKind.InvocationExpression, Type: System.String, IsInvalid) (Syntax: '((int, stri ... .ToString()') Instance Receiver: - ITupleExpression (OperationKind.TupleExpression, Type: (System.Int32, System.String), IsInvalid) (Syntax: '(int, string)') - Elements(2): - IOperation: (OperationKind.None, IsInvalid) (Syntax: 'int') - IOperation: (OperationKind.None, IsInvalid) (Syntax: 'string') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: (System.Int32, System.String), IsInvalid) (Syntax: '((int, string))') + Operand: + ITupleExpression (OperationKind.TupleExpression, Type: (System.Int32, System.String), IsInvalid) (Syntax: '(int, string)') + Elements(2): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'int') + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'string') Arguments(0) "; var expectedDiagnostics = new DiagnosticDescription[] { @@ -2118,14 +2120,16 @@ static void Main() string expectedOperationTree = @" ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: ?, IsInvalid) (Syntax: '(var(x, y)) ... reate(1, 2)') Left: - IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'var(x, y)') - Children(3): - IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'var') - Children(0) - IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'x') - Children(0) - IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'y') - Children(0) + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ?, IsInvalid) (Syntax: '(var(x, y))') + Operand: + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'var(x, y)') + Children(3): + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'var') + Children(0) + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'x') + Children(0) + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'y') + Children(0) Right: IInvocationExpression (Pair Pair.Create(System.Int32 item1, System.Int32 item2)) (OperationKind.InvocationExpression, Type: Pair) (Syntax: 'Pair.Create(1, 2)') Instance Receiver: diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs index 4dc58590d9a9f..8ee31ca179f97 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs @@ -3098,11 +3098,13 @@ static void Main() Initializers(1): ICollectionElementInitializerExpression (AddMethod: void C.Add(System.Int32 i)) (IsDynamic: False) (OperationKind.CollectionElementInitializerExpression, Type: System.Void, IsImplicit) (Syntax: '(i = 1)') Arguments(1): - ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'i = 1') - Left: - ILocalReferenceExpression: i (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'i') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(i = 1)') + Operand: + ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'i = 1') + Left: + ILocalReferenceExpression: i (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'i') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0165: Use of unassigned local variable 'i' diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs index f5513aecf9fe4..b43542afc6af9 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs @@ -1238,17 +1238,21 @@ static void Main() Left: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperatorMethod: S S.op_Addition(S x, S y)) (OperationKind.BinaryOperatorExpression, Type: S) (Syntax: '(a >> 10) + (b << 20)') Left: - IBinaryOperatorExpression (BinaryOperatorKind.RightShift) (OperatorMethod: S S.op_RightShift(S x, System.Int32 y)) (OperationKind.BinaryOperatorExpression, Type: S) (Syntax: 'a >> 10') - Left: - ILocalReferenceExpression: a (OperationKind.LocalReferenceExpression, Type: S) (Syntax: 'a') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: S) (Syntax: '(a >> 10)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.RightShift) (OperatorMethod: S S.op_RightShift(S x, System.Int32 y)) (OperationKind.BinaryOperatorExpression, Type: S) (Syntax: 'a >> 10') + Left: + ILocalReferenceExpression: a (OperationKind.LocalReferenceExpression, Type: S) (Syntax: 'a') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - IBinaryOperatorExpression (BinaryOperatorKind.LeftShift) (OperatorMethod: S S.op_LeftShift(S x, System.Int32 y)) (OperationKind.BinaryOperatorExpression, Type: S) (Syntax: 'b << 20') - Left: - ILocalReferenceExpression: b (OperationKind.LocalReferenceExpression, Type: S) (Syntax: 'b') - Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 20) (Syntax: '20') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: S) (Syntax: '(b << 20)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.LeftShift) (OperatorMethod: S S.op_LeftShift(S x, System.Int32 y)) (OperationKind.BinaryOperatorExpression, Type: S) (Syntax: 'b << 20') + Left: + ILocalReferenceExpression: b (OperationKind.LocalReferenceExpression, Type: S) (Syntax: 'b') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 20) (Syntax: '20') Right: IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperatorMethod: S S.op_Modulus(S x, S y)) (OperationKind.BinaryOperatorExpression, Type: S) (Syntax: 'c * d / e % f') Left: diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs index bbb44ac5ec1f4..4307af89be5a8 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs @@ -1250,23 +1250,25 @@ from int z in c3 ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '(x + y / 10 ... / 100) < 6') Left: - IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y / 10 + z / 100') - Left: - IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y / 10') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(x + y / 10 + z / 100)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y / 10 + z / 100') Left: - IOperation: (OperationKind.None) (Syntax: 'x') - Right: - IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'y / 10') + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y / 10') Left: - IOperation: (OperationKind.None) (Syntax: 'y') + IOperation: (OperationKind.None) (Syntax: 'x') Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') - Right: - IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'z / 100') - Left: - IOperation: (OperationKind.None) (Syntax: 'z') + IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'y / 10') + Left: + IOperation: (OperationKind.None) (Syntax: 'y') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 100) (Syntax: '100') + IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'z / 100') + Left: + IOperation: (OperationKind.None) (Syntax: 'z') + Right: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 100) (Syntax: '100') Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: '6') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -4078,11 +4080,13 @@ Element Values(1): ReturnedValue: IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: System.Func, IsInvalid) (Syntax: '(Func)(a => 1)') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'a => 1') - IBlockStatement (1 statements) (OperationKind.BlockStatement, IsImplicit) (Syntax: '1') - IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: '1') - ReturnedValue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null, IsInvalid) (Syntax: '(a => 1)') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'a => 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsImplicit) (Syntax: '1') + IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: '1') + ReturnedValue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs index 38551555b99d0..6c969971cc0d1 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs @@ -206,10 +206,12 @@ public int aa Initializers(3): IPropertyReferenceExpression: System.Int32 ClassA.aa { get; } (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: '(new ClassA()).aa') Instance Receiver: - IObjectCreationExpression (Constructor: ClassA..ctor()) (OperationKind.ObjectCreationExpression, Type: ClassA) (Syntax: 'new ClassA()') - Arguments(0) - Initializer: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ClassA) (Syntax: '(new ClassA())') + Operand: + IObjectCreationExpression (Constructor: ClassA..ctor()) (OperationKind.ObjectCreationExpression, Type: ClassA) (Syntax: 'new ClassA()') + Arguments(0) + Initializer: + null IFieldReferenceExpression: System.String ClassA.BB (Static) (OperationKind.FieldReferenceExpression, Type: System.String, Constant: ""-=-= -"") (Syntax: 'ClassA.BB') Instance Receiver: null @@ -341,10 +343,12 @@ public int select Initializers(2): IPropertyReferenceExpression: System.Int32 ClassA.select { get; } (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: '(new ClassA()).select') Instance Receiver: - IObjectCreationExpression (Constructor: ClassA..ctor()) (OperationKind.ObjectCreationExpression, Type: ClassA) (Syntax: 'new ClassA()') - Arguments(0) - Initializer: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ClassA) (Syntax: '(new ClassA())') + Operand: + IObjectCreationExpression (Constructor: ClassA..ctor()) (OperationKind.ObjectCreationExpression, Type: ClassA) (Syntax: 'new ClassA()') + Arguments(0) + Initializer: + null IFieldReferenceExpression: System.String ClassA.global (Static) (OperationKind.FieldReferenceExpression, Type: System.String, Constant: "" -=-= -"") (Syntax: 'global') Instance Receiver: null"; @@ -400,11 +404,14 @@ void Main() Right: IDelegateCreationExpression (OperationKind.DelegateCreationExpression, Type: D1) (Syntax: '(D1)(() => false)') Target: - IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => false') - IBlockStatement (1 statements) (OperationKind.BlockStatement, IsImplicit) (Syntax: 'false') - IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: 'false') - ReturnedValue: - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: False) (Syntax: 'false')"; + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: null) (Syntax: '(() => false)') + Operand: + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '() => false') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsImplicit) (Syntax: 'false') + IReturnStatement (OperationKind.ReturnStatement, IsImplicit) (Syntax: 'false') + ReturnedValue: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: False) (Syntax: 'false') +"; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); @@ -1167,10 +1174,12 @@ public static void Test1(int x) Initializers(3): IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: '(new ClassA()).aa') Children(1): - IObjectCreationExpression (Constructor: ClassA..ctor()) (OperationKind.ObjectCreationExpression, Type: ClassA) (Syntax: 'new ClassA()') - Arguments(0) - Initializer: - null + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ClassA) (Syntax: '(new ClassA())') + Operand: + IObjectCreationExpression (Constructor: ClassA..ctor()) (OperationKind.ObjectCreationExpression, Type: ClassA) (Syntax: 'new ClassA()') + Arguments(0) + Initializer: + null IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'ClassA.BB') Children(1): IOperation: (OperationKind.None) (Syntax: 'ClassA') diff --git a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs index 8092b6c4f4c29..c155290f4faca 100644 --- a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs +++ b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs @@ -1274,7 +1274,7 @@ public sealed override void Initialize(AnalysisContext context) var addressOfOperation = (IAddressOfExpression)operationContext.Operation; operationContext.ReportDiagnostic(Diagnostic.Create(AddressOfDescriptor, addressOfOperation.Syntax.GetLocation())); - if (addressOfOperation.Reference.Kind == OperationKind.InvalidExpression && addressOfOperation.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) + if (addressOfOperation.Reference.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) { operationContext.ReportDiagnostic(Diagnostic.Create(InvalidAddressOfReferenceDescriptor, addressOfOperation.Reference.Syntax.GetLocation())); } From dedb3a86b9a44781b7756ebf6eace52ff873b63a Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 26 Oct 2017 16:39:24 -0700 Subject: [PATCH 04/28] Address review feedback and add tests --- .../Operations/CSharpOperationFactory.cs | 41 +- .../IOperationTests_IParenthesized.cs | 233 +++++++++++ ...OperationTests_IParenthesizedExpression.vb | 391 ++++++++++++++++++ 3 files changed, 642 insertions(+), 23 deletions(-) create mode 100644 src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index d215e6f63bab6..1361a2aa05236 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -42,13 +42,27 @@ public IOperation Create(BoundNode boundNode) return _cache.GetOrAdd(boundNode, n => CreateInternal(n)); } - private IOperation CreateInternal(BoundNode boundNode, bool createParenthesized = true) + private IOperation CreateInternal(BoundNode boundNode) { - if (createParenthesized && boundNode.Syntax.Parent is ParenthesizedExpressionSyntax) + IOperation operation = CreateInternalCore(boundNode); + + // If the syntax for the bound node is parenthesized, walk up the parentheses wrapping the operation with ParenthesizedExpression operation nodes. + // Compiler generated and lowered bound nodes shouldn't be parenthesized. + if (!boundNode.WasCompilerGenerated && boundNode.Syntax.Parent is ParenthesizedExpressionSyntax parenthesizedSyntax) { - return CreateParenthesizedExpression(boundNode); + do + { + operation = new ParenthesizedExpression(operation, _semanticModel, parenthesizedSyntax, operation.Type, operation.ConstantValue, isImplicit: false); + parenthesizedSyntax = parenthesizedSyntax.Parent as ParenthesizedExpressionSyntax; + } + while (parenthesizedSyntax != null); } + return operation; + } + + private IOperation CreateInternalCore(BoundNode boundNode, bool createParenthesized = true) + { switch (boundNode.Kind) { case BoundKind.DeconstructValuePlaceholder: @@ -249,24 +263,6 @@ private IOperation CreateInternal(BoundNode boundNode, bool createParenthesized } } - private IParenthesizedExpression CreateParenthesizedExpression(BoundNode boundNode) - { - var parenthesizedSyntax = (ParenthesizedExpressionSyntax)boundNode.Syntax.Parent; - - // Create the child operation without parenthesized. - IOperation operation = CreateInternal(boundNode, createParenthesized: false); - - // Walk up the parentheses wrapping the operation with ParenthesizedExpression operation nodes. - do - { - operation = new ParenthesizedExpression(operation, _semanticModel, parenthesizedSyntax, operation.Type, operation.ConstantValue, isImplicit: false); - parenthesizedSyntax = parenthesizedSyntax.Parent as ParenthesizedExpressionSyntax; - } - while (parenthesizedSyntax != null); - - return (ParenthesizedExpression)operation; - } - private ImmutableArray GetIOperationChildren(BoundNode boundNode) { var boundNodeWithChildren = (IBoundNodeWithIOperationChildren)boundNode; @@ -723,9 +719,8 @@ private IOperation CreateUnboundLambdaOperation(UnboundLambda unboundLambda) // nodes for the lambda expression. So, we ask the semantic model for the IOperation node for the unbound lambda syntax. // We are counting on the fact that will do the error recovery and actually create the BoundLambda node appropriate for // this syntax node. - // Also note that we pass "createParenthesized = false" to avoid duplicate invocations to CreateParenthesized for bound and unbound lambda nodes. BoundLambda boundLambda = unboundLambda.BindForErrorRecovery(); - return CreateInternal(boundLambda, createParenthesized: false); + return CreateInternalCore(boundLambda); } private IAnonymousFunctionExpression CreateBoundLambdaOperation(BoundLambda boundLambda) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs index 3c45ec312b328..542e4cf931a8f 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs @@ -155,5 +155,238 @@ static int M1(int a, int b, int c) VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting03() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return /**/(((a + b)))/**/; + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(((a + b)))') + Operand: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '((a + b))') + Operand: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting04() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return ((/**/(a + b)/**/)); + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting05() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return (((/**/a + b/**/))); + } +} +"; + string expectedOperationTree = @" +IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedConversion() + { + string source = @" +class P +{ + static long M1(int a, int b) + { + return /**/(a + b)/**/; + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int64) (Syntax: '(a + b)') + Operand: + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedConversionParent() + { + string source = @" +class P +{ + static long M1(int a, int b) + { + /**/return (a + b);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'return (a + b);') + ReturnedValue: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int64) (Syntax: '(a + b)') + Operand: + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') + Operand: + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedConstantValue() + { + string source = @" +class P +{ + static int M1() + { + return /**/(5)/**/; + } +} +"; + string expectedOperationTree = @" +False + Exception stacktrace + at Xunit.Assert.True(Nullable`1 condition, String userMessage) + at Xunit.Assert.True(Boolean condition, String userMessage) + at Microsoft.CodeAnalysis.DiagnosticExtensions.Verify(IEnumerable`1 actual, DiagnosticDescription[] expected, Boolean errorCodeOnly) + at Microsoft.CodeAnalysis.DiagnosticExtensions.Verify(IEnumerable`1 actual, DiagnosticDescription[] expected) + at Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBaseBase.VerifyOperationTreeAndDiagnosticsForTest[TSyntaxNode](CSharpCompilation compilation, String expectedOperationTree, DiagnosticDescription[] expectedDiagnostics, Action`3 additionalOperationTreeVerifier) + at Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBaseBase.VerifyOperationTreeAndDiagnosticsForTest[TSyntaxNode](String testSrc, String expectedOperationTree, DiagnosticDescription[] expectedDiagnostics, CSharpCompilationOptions compilationOptions, CSharpParseOptions parseOptions, MetadataReference[] additionalReferences, Action`3 additionalOperationTreeVerifier, Boolean useLatestFrameworkReferences) + at Microsoft.CodeAnalysis.CSharp.UnitTests.IOperationTests.TestParenthesizedConstantValue() in c:\roslyn-internal\Open\src\Compilers\CSharp\Test\Semantic\IOperation\IOperationTests_IParenthesized.cs:line 354 +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedQueryClause() + { + string source = @" +using System.Linq; + +class P +{ + static object M1(int[] a) + { + return from r in a select /**/(-r)/**/; + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(-r)') + Operand: + IUnaryOperatorExpression (UnaryOperatorKind.Minus) (OperationKind.UnaryOperatorExpression, Type: System.Int32) (Syntax: '-r') + Operand: + IOperation: (OperationKind.None) (Syntax: 'r') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedErrorOperand() + { + string source = @" +class P +{ + static int M1() + { + return /**/(a)/**/; + } +} +"; + string expectedOperationTree = @" +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ?, IsInvalid) (Syntax: '(a)') + Operand: + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'a') + Children(0) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0103: The name 'a' does not exist in the current context + // return /**/(a)/**/; + Diagnostic(ErrorCode.ERR_NameNotInContext, "a").WithArguments("a").WithLocation(6, 27) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } } } diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb new file mode 100644 index 0000000000000..f8078e86fae8a --- /dev/null +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb @@ -0,0 +1,391 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports Microsoft.CodeAnalysis.Semantics +Imports Microsoft.CodeAnalysis.Test.Utilities +Imports Microsoft.CodeAnalysis.VisualBasic.Syntax +Imports Roslyn.Test.Utilities + +Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics + + Partial Public Class IOperationTests + Inherits SemanticModelTestBase + + + + Public Sub TestParenthesized() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedChild() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of BinaryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ReturnStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting02() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting03() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting04() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting05() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of BinaryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedConversion() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedConversionParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ReturnStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedConstantValue() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreationParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of CTypeExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedQueryClause() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedErrorOperand() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + End Class +End Namespace From 844d661a74162683da93ad3c60740ca75114fa7a Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 31 Oct 2017 10:23:52 -0700 Subject: [PATCH 05/28] Address review feedback --- .../Operations/CSharpOperationFactory.cs | 12 ++- .../IOperationTests_IParenthesized.cs | 47 +++++------- ...OperationTests_IParenthesizedExpression.vb | 74 +++++++++++++++++++ 3 files changed, 99 insertions(+), 34 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 1361a2aa05236..149b4379b801f 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -47,8 +47,10 @@ private IOperation CreateInternal(BoundNode boundNode) IOperation operation = CreateInternalCore(boundNode); // If the syntax for the bound node is parenthesized, walk up the parentheses wrapping the operation with ParenthesizedExpression operation nodes. - // Compiler generated and lowered bound nodes shouldn't be parenthesized. - if (!boundNode.WasCompilerGenerated && boundNode.Syntax.Parent is ParenthesizedExpressionSyntax parenthesizedSyntax) + // Compiler generated, implicit conversions and lowered bound nodes shouldn't be parenthesized. + if (!boundNode.WasCompilerGenerated && + boundNode.Syntax.Parent is ParenthesizedExpressionSyntax parenthesizedSyntax && + !IsImplicitConversion(boundNode as BoundConversion)) { do { @@ -61,7 +63,7 @@ private IOperation CreateInternal(BoundNode boundNode) return operation; } - private IOperation CreateInternalCore(BoundNode boundNode, bool createParenthesized = true) + private IOperation CreateInternalCore(BoundNode boundNode) { switch (boundNode.Kind) { @@ -749,9 +751,11 @@ private ILocalFunctionStatement CreateBoundLocalFunctionStatementOperation(Bound return new LazyLocalFunctionStatement(symbol, body, _semanticModel, syntax, type, constantValue, isImplicit); } + private static bool IsImplicitConversion(BoundConversion boundConversion) => boundConversion != null && (boundConversion.WasCompilerGenerated || !boundConversion.ExplicitCastInCode); + private IOperation CreateBoundConversionOperation(BoundConversion boundConversion) { - bool isImplicit = boundConversion.WasCompilerGenerated || !boundConversion.ExplicitCastInCode; + bool isImplicit = IsImplicitConversion(boundConversion); if (boundConversion.ConversionKind == CSharp.ConversionKind.MethodGroup) { // We don't check HasErrors on the conversion here because if we actually have a MethodGroup conversion, diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs index 542e4cf931a8f..a05d8a3759fb0 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs @@ -253,18 +253,13 @@ static long M1(int a, int b) } "; string expectedOperationTree = @" -IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int64) (Syntax: '(a + b)') +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') Operand: - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int64, IsImplicit) (Syntax: 'a + b') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: - IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') "; var expectedDiagnostics = DiagnosticDescription.None; @@ -287,18 +282,16 @@ static long M1(int a, int b) string expectedOperationTree = @" IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'return (a + b);') ReturnedValue: - IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int64) (Syntax: '(a + b)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int64, IsImplicit) (Syntax: 'a + b') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') Operand: - IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceExpression: a (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceExpression: b (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'b') "; var expectedDiagnostics = DiagnosticDescription.None; @@ -319,15 +312,9 @@ static int M1() } "; string expectedOperationTree = @" -False - Exception stacktrace - at Xunit.Assert.True(Nullable`1 condition, String userMessage) - at Xunit.Assert.True(Boolean condition, String userMessage) - at Microsoft.CodeAnalysis.DiagnosticExtensions.Verify(IEnumerable`1 actual, DiagnosticDescription[] expected, Boolean errorCodeOnly) - at Microsoft.CodeAnalysis.DiagnosticExtensions.Verify(IEnumerable`1 actual, DiagnosticDescription[] expected) - at Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBaseBase.VerifyOperationTreeAndDiagnosticsForTest[TSyntaxNode](CSharpCompilation compilation, String expectedOperationTree, DiagnosticDescription[] expectedDiagnostics, Action`3 additionalOperationTreeVerifier) - at Microsoft.CodeAnalysis.CSharp.Test.Utilities.CSharpTestBaseBase.VerifyOperationTreeAndDiagnosticsForTest[TSyntaxNode](String testSrc, String expectedOperationTree, DiagnosticDescription[] expectedDiagnostics, CSharpCompilationOptions compilationOptions, CSharpParseOptions parseOptions, MetadataReference[] additionalReferences, Action`3 additionalOperationTreeVerifier, Boolean useLatestFrameworkReferences) - at Microsoft.CodeAnalysis.CSharp.UnitTests.IOperationTests.TestParenthesizedConstantValue() in c:\roslyn-internal\Open\src\Compilers\CSharp\Test\Semantic\IOperation\IOperationTests_IParenthesized.cs:line 354 +IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32, Constant: 5) (Syntax: '(5)') + Operand: + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5') "; var expectedDiagnostics = DiagnosticDescription.None; diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb index f8078e86fae8a..6815051d6bb60 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb @@ -337,6 +337,80 @@ IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.Conve VerifyOperationTreeAndDiagnosticsForTest(Of CTypeExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + Public Sub TestParenthesizedDelegateCreationWithImplicitConversion() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreationWithImplicitConversionParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ReturnStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub TestParenthesizedQueryClause() From 02335907734b43865aabe12ec388f16040b482bc Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Wed, 1 Nov 2017 10:58:05 -0700 Subject: [PATCH 06/28] Allow conversions to have parent IParenthesizedOperation and prevent implicit conversion operands to get duplicate IParenthesizedOperation --- .../Operations/CSharpOperationFactory.cs | 16 ++-- .../IOperationTests_IParenthesized.cs | 74 +++++++++++++++++-- 2 files changed, 76 insertions(+), 14 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 2edb6b7e206af..f91d0562e2c8d 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -47,10 +47,9 @@ private IOperation CreateInternal(BoundNode boundNode) IOperation operation = CreateInternalCore(boundNode); // If the syntax for the bound node is parenthesized, walk up the parentheses wrapping the operation with ParenthesizedExpression operation nodes. - // Compiler generated, implicit conversions and lowered bound nodes shouldn't be parenthesized. + // Compiler generated and lowered bound nodes shouldn't be parenthesized. if (!boundNode.WasCompilerGenerated && - boundNode.Syntax.Parent is ParenthesizedExpressionSyntax parenthesizedSyntax && - !IsImplicitConversion(boundNode as BoundConversion)) + boundNode.Syntax.Parent is ParenthesizedExpressionSyntax parenthesizedSyntax) { do { @@ -760,11 +759,9 @@ private ILocalFunctionOperation CreateBoundLocalFunctionStatementOperation(Bound return new LazyLocalFunctionStatement(symbol, body, _semanticModel, syntax, type, constantValue, isImplicit); } - private static bool IsImplicitConversion(BoundConversion boundConversion) => boundConversion != null && (boundConversion.WasCompilerGenerated || !boundConversion.ExplicitCastInCode); - private IOperation CreateBoundConversionOperation(BoundConversion boundConversion) { - bool isImplicit = IsImplicitConversion(boundConversion); + bool isImplicit = boundConversion.WasCompilerGenerated || !boundConversion.ExplicitCastInCode; if (boundConversion.ConversionKind == CSharp.ConversionKind.MethodGroup) { // We don't check HasErrors on the conversion here because if we actually have a MethodGroup conversion, @@ -794,10 +791,13 @@ private IOperation CreateBoundConversionOperation(BoundConversion boundConversio // and instead directly return the operand, which will be a BoundBadExpression. When we generate a node for the BoundBadExpression, // the resulting IOperation will also have a null Type. Debug.Assert(boundConversion.Operand.Kind == BoundKind.BadExpression); - return Create(boundConversion.Operand); + + // We invoke CreateInternalCore for implicit conversions to avoid duplicate IParenthesizedOperation for bound conversion and its operand. + return isImplicit ? CreateInternalCore(boundConversion.Operand) : Create(boundConversion.Operand); } - Lazy operand = new Lazy(() => Create(boundConversion.Operand)); + // We invoke CreateInternalCore for implicit conversions to avoid duplicate IParenthesizedOperation for bound conversion and its operand. + Lazy operand = new Lazy(() => isImplicit ? CreateInternalCore(boundConversion.Operand) : Create(boundConversion.Operand)); ITypeSymbol type = boundConversion.Type; Optional constantValue = ConvertToOptional(boundConversion.ConstantValue); diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs index 2bfd8c2b72735..fd75c0055230f 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs @@ -241,7 +241,7 @@ static int M1(int a, int b) [CompilerTrait(CompilerFeature.IOperation)] [Fact] - public void TestParenthesizedConversion() + public void TestParenthesizedImplicitConversion() { string source = @" class P @@ -251,6 +251,68 @@ static long M1(int a, int b) return /**/(a + b)/**/; } } +"; + string expectedOperationTree = @" +IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int64) (Syntax: '(a + b)') + Operand: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedImplicitConversionParent() + { + string source = @" +class P +{ + static long M1(int a, int b) + { + /**/return (a + b);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (a + b);') + ReturnedValue: + IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int64) (Syntax: '(a + b)') + Operand: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedExplicitConversion() + { + string source = @" +class P +{ + static double M1(int a, int b) + { + return /**/(double)(a + b)/**/; + } +} "; string expectedOperationTree = @" IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') @@ -268,21 +330,21 @@ static long M1(int a, int b) [CompilerTrait(CompilerFeature.IOperation)] [Fact] - public void TestParenthesizedConversionParent() + public void TestParenthesizedExplicitConversionParent() { string source = @" class P { - static long M1(int a, int b) + static double M1(int a, int b) { - /**/return (a + b);/**/ + /**/return (double)(a + b);/**/ } } "; string expectedOperationTree = @" -IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (a + b);') +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (double)(a + b);') ReturnedValue: - IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Double) (Syntax: '(double)(a + b)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') From 4dd2a449b0031de40af98c032547ae12dc55811e Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Wed, 1 Nov 2017 14:26:32 -0700 Subject: [PATCH 07/28] Unify IOperation APIs for while and do loops into a single IWhileLoopOperation Fixes #22960 --- .../Operations/CSharpOperationFactory.cs | 12 +- ...OperationTests_IWhileUntilLoopStatement.cs | 96 ++++++++---- .../Generated/Operations.xml.Generated.cs | 142 ++++++------------ .../Portable/Operations/Loops/DoLoopKind.cs | 40 ----- .../Operations/Loops/IDoLoopOperation.cs | 38 ----- .../Operations/Loops/IWhileLoopOperation.cs | 27 +++- .../Portable/Operations/Loops/LoopKind.cs | 13 +- .../Portable/Operations/OperationCloner.cs | 7 +- .../Portable/Operations/OperationVisitor.cs | 10 -- .../Core/Portable/PublicAPI.Unshipped.txt | 24 +-- .../Operations/VisualBasicOperationFactory.vb | 37 ++--- ...OperationTests_IWhileUntilLoopStatement.vb | 128 ++++++++++------ .../Compilation/OperationTreeVerifier.cs | 14 +- .../Compilation/TestOperationWalker.cs | 10 +- 14 files changed, 256 insertions(+), 342 deletions(-) delete mode 100644 src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs delete mode 100644 src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 27e35a334fb52..d9b23a6f84a36 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -1309,26 +1309,30 @@ private IWhileLoopOperation CreateBoundWhileStatementOperation(BoundWhileStateme { Lazy condition = new Lazy(() => Create(boundWhileStatement.Condition)); Lazy body = new Lazy(() => Create(boundWhileStatement.Body)); + Lazy ignoredCondition = new Lazy(() => null); ImmutableArray locals = boundWhileStatement.Locals.As(); + bool conditionIsTop = true; + bool conditionIsUntil = false; SyntaxNode syntax = boundWhileStatement.Syntax; ITypeSymbol type = null; Optional constantValue = default(Optional); bool isImplicit = boundWhileStatement.WasCompilerGenerated; - return new LazyWhileLoopStatement(condition, body, locals, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyWhileLoopStatement(condition, body, ignoredCondition, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit); } - private IDoLoopOperation CreateBoundDoStatementOperation(BoundDoStatement boundDoStatement) + private IWhileLoopOperation CreateBoundDoStatementOperation(BoundDoStatement boundDoStatement) { - DoLoopKind doLoopKind = DoLoopKind.DoWhileBottomLoop; Lazy condition = new Lazy(() => Create(boundDoStatement.Condition)); Lazy body = new Lazy(() => Create(boundDoStatement.Body)); Lazy ignoredCondition = new Lazy(() => null); + bool conditionIsTop = false; + bool conditionIsUntil = false; ImmutableArray locals = boundDoStatement.Locals.As(); SyntaxNode syntax = boundDoStatement.Syntax; ITypeSymbol type = null; Optional constantValue = default(Optional); bool isImplicit = boundDoStatement.WasCompilerGenerated; - return new LazyDoLoopStatement(doLoopKind, condition, body, ignoredCondition, locals, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyWhileLoopStatement(condition, body, ignoredCondition, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit); } private IForLoopOperation CreateBoundForStatementOperation(BoundForStatement boundForStatement) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs index 578bb515ceb60..e624b89a57a17 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs @@ -33,15 +33,13 @@ static void Main() } "; string expectedOperationTree = @" -IDoLoopOperation (DoLoopKind: DoWhileBottomLoop) (LoopKind.Do) (OperationKind.Loop, Type: null) (Syntax: 'do ... le (i < 4);') +IWhileLoopOperation (ConditionIsTop: False, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'do ... le (i < 4);') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i < 4') Left: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') - IgnoredCondition: - null Body: IBlockOperation (2 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'sum += ids[i];') @@ -60,6 +58,8 @@ static void Main() IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'i++') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -88,7 +88,7 @@ static int SumWhile() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i < ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i < ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i < 5') Left: @@ -109,6 +109,8 @@ static int SumWhile() IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'i++') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -138,7 +140,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (cond ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (cond ... }') Condition: ILocalReferenceOperation: condition (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'condition') Body: @@ -170,6 +172,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') WhenFalse: null + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -200,7 +204,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -246,6 +250,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop statement"") (Syntax: '""While-loop statement""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -275,7 +281,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -319,6 +325,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop statement"") (Syntax: '""While-loop statement""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -345,7 +353,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ((i = ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ((i = ... }') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(i = value) >= 0') Left: @@ -387,6 +395,8 @@ static void Main() IIncrementOrDecrementOperation (Postfix) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'value--') Target: ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'value') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -408,7 +418,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while (numb ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while (numb ... }') Condition: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'number') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -416,6 +426,8 @@ static void Main() ILocalReferenceOperation: number (OperationKind.LocalReference, Type: System.Int32, IsInvalid) (Syntax: 'number') Body: IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -447,7 +459,7 @@ public static int GetFirstEvenNumber(int number) "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -475,6 +487,8 @@ public static int GetFirstEvenNumber(int number) IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'number++') Target: IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -506,7 +520,7 @@ public static int GetFirstEvenNumber(int number) } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -537,6 +551,8 @@ public static int GetFirstEvenNumber(int number) IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return number;') ReturnedValue: IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -564,7 +580,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while () ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while () ... }') Condition: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) @@ -597,6 +613,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') WhenFalse: null + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -619,7 +637,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 10') Left: @@ -628,6 +646,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') Body: IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -655,7 +675,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 10') Left: @@ -691,6 +711,8 @@ static void Main() ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -720,7 +742,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i<10') Left: @@ -741,7 +763,7 @@ static void Main() Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= 0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') + IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j < 10') Left: @@ -765,6 +787,8 @@ static void Main() ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'System.Cons ... iteLine(i);') Expression: IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'System.Cons ... riteLine(i)') @@ -775,6 +799,8 @@ static void Main() ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -805,7 +831,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i<10') Left: @@ -826,7 +852,7 @@ static void Main() Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= 0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') + IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j < 10') Left: @@ -861,6 +887,8 @@ static void Main() ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'System.Cons ... iteLine(i);') Expression: IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'System.Cons ... riteLine(i)') @@ -871,6 +899,8 @@ static void Main() ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -919,7 +949,7 @@ public void Next() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (d.Do ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (d.Do ... }') Condition: IUnaryOperation (UnaryOperatorKind.True) (OperationKind.UnaryOperator, Type: System.Boolean, IsImplicit) (Syntax: 'd.Done') Operand: @@ -940,6 +970,8 @@ Type Arguments(0) Arguments(0) ArgumentNames(0) ArgumentRefKinds(0) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -963,7 +995,7 @@ static void Main(string[] args) "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ( ++i ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ( ++i ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '++i < 5') Left: @@ -984,6 +1016,8 @@ static void Main(string[] args) ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1005,7 +1039,7 @@ static void Main(string[] args) } }"; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i > ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i > ... }') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i > 0') Left: @@ -1019,6 +1053,8 @@ static void Main(string[] args) IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'i++') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1041,7 +1077,7 @@ bool foo() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (b == ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (b == ... }') Condition: IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean, Constant: True) (Syntax: 'b == b') Left: @@ -1053,6 +1089,8 @@ bool foo() IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return b;') ReturnedValue: ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Boolean, Constant: True) (Syntax: 'b') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1083,7 +1121,7 @@ public void TryMethod() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (x-- ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (x-- ... }') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'x-- > 0') Left: @@ -1125,6 +1163,8 @@ Catch clauses(0) Arguments(0) Initializer: null + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1161,7 +1201,7 @@ static bool TakeOutParam(T y, out T x) } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (Dumm ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (Dumm ... }') Locals: Local_1: System.Int32 x1 Condition: IInvocationOperation (System.Boolean X.Dummy(System.Boolean x, System.Object y, System.Object z)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'Dummy(f, Ta ... ar x1), x1)') @@ -1223,6 +1263,8 @@ static bool TakeOutParam(T y, out T x) ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') Right: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1258,7 +1300,7 @@ static bool TakeOutParam(T y, out T x) } "; string expectedOperationTree = @" -IDoLoopOperation (DoLoopKind: DoWhileBottomLoop) (LoopKind.Do) (OperationKind.Loop, Type: null) (Syntax: 'do ... x1), x1));') +IWhileLoopOperation (ConditionIsTop: False, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'do ... x1), x1));') Locals: Local_1: System.Int32 x1 Condition: IInvocationOperation (System.Boolean X.Dummy(System.Boolean x, System.Object y, System.Object z)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'Dummy(f, Ta ... ar x1), x1)') @@ -1301,8 +1343,6 @@ static bool TakeOutParam(T y, out T x) ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IgnoredCondition: - null Body: IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'f = false;') @@ -1312,6 +1352,8 @@ static bool TakeOutParam(T y, out T x) ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') Right: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') + IgnoredCondition: + null "; var expectedDiagnostics = DiagnosticDescription.None; diff --git a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs index b4a05c0052f99..3b181bdde5f05 100644 --- a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs +++ b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs @@ -5551,28 +5551,28 @@ public LazyVariableDeclarationStatement(Lazy - /// Represents a C# 'do while' or VB 'Do While' or 'Do Until' loop statement. + /// Represents a while or do while loop. + /// + /// Current usage: + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. + /// /// - internal abstract partial class BaseDoLoopStatement : LoopStatement, IDoLoopOperation + internal abstract partial class BaseWhileLoopStatement : LoopStatement, IWhileLoopOperation { - public BaseDoLoopStatement(DoLoopKind doLoopKind, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(LoopKind.Do, locals, OperationKind.Loop, semanticModel, syntax, type, constantValue, isImplicit) + public BaseWhileLoopStatement(ImmutableArray locals, bool conditionIsTop, bool conditionIsUntil, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(LoopKind.While, locals, OperationKind.Loop, semanticModel, syntax, type, constantValue, isImplicit) { - DoLoopKind = doLoopKind; + ConditionIsTop = conditionIsTop; + ConditionIsUntil = conditionIsUntil; } - /// - /// Represents kind of do loop operation. - /// - public DoLoopKind DoLoopKind { get; } protected abstract IOperation ConditionImpl { get; } protected abstract IOperation IgnoredConditionImpl { get; } public override IEnumerable Children { get { - if (DoLoopKind == DoLoopKind.DoWhileTopLoop || - DoLoopKind == DoLoopKind.DoUntilTopLoop || - DoLoopKind == DoLoopKind.None) + if (ConditionIsTop) { if (Condition != null) { @@ -5583,8 +5583,7 @@ public override IEnumerable Children { yield return Body; } - if (DoLoopKind == DoLoopKind.DoWhileBottomLoop || - DoLoopKind == DoLoopKind.DoUntilBottomLoop) + if (!ConditionIsTop) { if (Condition != null) { @@ -5602,88 +5601,24 @@ public override IEnumerable Children /// public IOperation Condition => Operation.SetParentOperation(ConditionImpl, this); /// - /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. - /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. - /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. - /// This property should be null for all non-error cases. + /// True if the is evaluated at start of each loop iteration. + /// False if it is evaluated at the end of each loop iteration. /// - public IOperation IgnoredCondition => Operation.SetParentOperation(IgnoredConditionImpl, this); - public override void Accept(OperationVisitor visitor) - { - visitor.VisitDoLoop(this); - } - public override TResult Accept(OperationVisitor visitor, TArgument argument) - { - return visitor.VisitDoLoop(this, argument); - } - } - - /// - /// Represents a C# 'do while' or VB 'Do While' or 'Do Until' loop statement. - /// - internal sealed partial class DoLoopStatement : BaseDoLoopStatement, IDoLoopOperation - { - public DoLoopStatement(DoLoopKind doLoopKind, IOperation condition, IOperation body, IOperation ignoredConditionOpt, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(doLoopKind, locals, semanticModel, syntax, type, constantValue, isImplicit) - { - ConditionImpl = condition; - BodyImpl = body; - IgnoredConditionImpl = ignoredConditionOpt; - } - protected override IOperation ConditionImpl { get; } - protected override IOperation BodyImpl { get; } - protected override IOperation IgnoredConditionImpl { get; } - } - /// - /// Represents a C# 'do while' or VB 'Do While' or 'Do Until' loop statement. - /// - internal sealed partial class LazyDoLoopStatement : BaseDoLoopStatement, IDoLoopOperation - { - private readonly Lazy _lazyCondition; - private readonly Lazy _lazyBody; - private readonly Lazy _lazyIgnoredCondition; + public bool ConditionIsTop { get; } - public LazyDoLoopStatement(DoLoopKind doLoopKind, Lazy condition, Lazy body, Lazy ignoredCondition, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(doLoopKind, locals, semanticModel, syntax, type, constantValue, isImplicit) - { - _lazyCondition = condition ?? throw new System.ArgumentNullException(nameof(condition)); - _lazyBody = body ?? throw new System.ArgumentNullException(nameof(body)); - _lazyIgnoredCondition = ignoredCondition ?? throw new System.ArgumentNullException(nameof(ignoredCondition)); - } - protected override IOperation ConditionImpl => _lazyCondition.Value; - protected override IOperation BodyImpl => _lazyBody.Value; - protected override IOperation IgnoredConditionImpl => _lazyIgnoredCondition.Value; - } + /// + /// True if the loop has 'Until' loop semantics and the loop is executed while is false. + /// - /// - /// Represents a C# 'while' or a VB 'While' loop statement. - /// - internal abstract partial class BaseWhileLoopStatement : LoopStatement, IWhileLoopOperation - { - public BaseWhileLoopStatement(ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(LoopKind.While, locals, OperationKind.Loop, semanticModel, syntax, type, constantValue, isImplicit) - { - } - protected abstract IOperation ConditionImpl { get; } - public override IEnumerable Children - { - get - { - if (Condition != null) - { - yield return Condition; - } - if (Body != null) - { - yield return Body; - } - } - } + public bool ConditionIsUntil { get; } /// - /// Condition of the loop. + /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. + /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. + /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. + /// This property should be null for all non-error cases. /// - public IOperation Condition => Operation.SetParentOperation(ConditionImpl, this); + public IOperation IgnoredCondition => Operation.SetParentOperation(IgnoredConditionImpl, this); public override void Accept(OperationVisitor visitor) { visitor.VisitWhileLoop(this); @@ -5695,36 +5630,51 @@ public override TResult Accept(OperationVisitor - /// Represents a C# 'while' or a VB 'While' loop statement. + /// Represents a while or do while loop. + /// + /// Current usage: + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. + /// /// internal sealed partial class WhileLoopStatement : BaseWhileLoopStatement, IWhileLoopOperation { - public WhileLoopStatement(IOperation condition, IOperation body, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(locals, semanticModel, syntax, type, constantValue, isImplicit) + public WhileLoopStatement(IOperation condition, IOperation body, IOperation ignoredCondition, ImmutableArray locals, bool conditionIsTop, bool conditionIsUntil, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(locals, conditionIsTop, conditionIsUntil, semanticModel, syntax, type, constantValue, isImplicit) { ConditionImpl = condition; BodyImpl = body; + IgnoredConditionImpl = ignoredCondition; } protected override IOperation ConditionImpl { get; } protected override IOperation BodyImpl { get; } + protected override IOperation IgnoredConditionImpl { get; } } /// - /// Represents a C# 'while' or a VB 'While' loop statement. + /// Represents a while or do while loop. + /// + /// Current usage: + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. + /// /// internal sealed partial class LazyWhileLoopStatement : BaseWhileLoopStatement, IWhileLoopOperation { private readonly Lazy _lazyCondition; private readonly Lazy _lazyBody; + private readonly Lazy _lazyIgnoredCondition; - public LazyWhileLoopStatement(Lazy condition, Lazy body, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(locals, semanticModel, syntax, type, constantValue, isImplicit) + public LazyWhileLoopStatement(Lazy condition, Lazy body, Lazy ignoredCondition, ImmutableArray locals, bool conditionIsTop, bool conditionIsUntil, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(locals, conditionIsTop, conditionIsUntil, semanticModel, syntax, type, constantValue, isImplicit) { _lazyCondition = condition ?? throw new System.ArgumentNullException(nameof(condition)); _lazyBody = body ?? throw new System.ArgumentNullException(nameof(body)); + _lazyIgnoredCondition = ignoredCondition ?? throw new System.ArgumentNullException(nameof(ignoredCondition)); } protected override IOperation ConditionImpl => _lazyCondition.Value; protected override IOperation BodyImpl => _lazyBody.Value; + protected override IOperation IgnoredConditionImpl => _lazyIgnoredCondition.Value; } /// diff --git a/src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs b/src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs deleted file mode 100644 index 0975c89ea6215..0000000000000 --- a/src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Operations -{ - /// - /// Represents different kinds of do loop operations. - /// - public enum DoLoopKind - { - /// - /// Represents unknown or error do loop kind. - /// - None = 0x0, - - /// - /// Indicates a C# 'do while' or a VB 'Do While' loop where the loop condition is executed at the bottom of the loop, i.e. end of the loop iteration. - /// Loop executes while the loop condition evaluates to true. - /// - DoWhileBottomLoop = 0x1, - - /// - /// Indicates a VB 'Do While' loop with the loop condition executed at the top of the loop, i.e. beginning of the loop iteration. - /// Loop executes while the loop condition evaluates to true. - /// - DoWhileTopLoop = 0x2, - - /// - /// Indicates a VB 'Do Until' loop with the loop condition executed at the bottom of the loop, i.e. end of the loop iteration. - /// Loop executes while the loop condition evaluates to false. - /// - DoUntilBottomLoop = 0x3, - - /// - /// Indicates a VB 'Do Until' loop with the loop condition executed at the top of the loop, i.e. beginning of the loop iteration. - /// Loop executes while the loop condition evaluates to false. - /// - DoUntilTopLoop = 0x4 - } -} - diff --git a/src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs b/src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs deleted file mode 100644 index 60ed60bd4e39b..0000000000000 --- a/src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Operations -{ - /// - /// Represents a do loop. - /// - /// Current usage: - /// (1) C# 'do while' loop statement - /// (2) VB 'Do While' loop statement or 'Do Until' loop statement - /// - /// - /// - /// This interface is reserved for implementation by its associated APIs. We reserve the right to - /// change it in the future. - /// - public interface IDoLoopOperation : ILoopOperation - { - /// - /// Condition of the loop. - /// - IOperation Condition { get; } - - /// - /// Represents kind of do loop operation. - /// - DoLoopKind DoLoopKind { get; } - - /// - /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. - /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. - /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. - /// This property should be null for all non-error cases. - /// - IOperation IgnoredCondition { get; } - } -} - diff --git a/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs b/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs index b8b66fed53a2c..d763811b33f57 100644 --- a/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs +++ b/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs @@ -3,13 +3,13 @@ namespace Microsoft.CodeAnalysis.Operations { /// - /// Represents a while loop. - /// + /// Represents a while or do while loop. /// /// Current usage: - /// (1) C# 'while' loop statement - /// (2) VB 'While' loop statement + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. /// + /// /// /// This interface is reserved for implementation by its associated APIs. We reserve the right to /// change it in the future. @@ -20,6 +20,25 @@ public interface IWhileLoopOperation : ILoopOperation /// Condition of the loop. /// IOperation Condition { get; } + + /// + /// True if the is evaluated at start of each loop iteration. + /// False if it is evaluated at the end of each loop iteration. + /// + bool ConditionIsTop { get; } + + /// + /// True if the loop has 'Until' loop semantics and the loop is executed while is false. + /// + bool ConditionIsUntil { get; } + + /// + /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. + /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. + /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. + /// This property should be null for all non-error cases. + /// + IOperation IgnoredCondition { get; } } } diff --git a/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs b/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs index 0b8d8583c474e..237b0646ef93c 100644 --- a/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs +++ b/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs @@ -12,30 +12,25 @@ public enum LoopKind /// None = 0x0, - /// - /// Represents an in C# or VB. - /// - Do = 0x1, - /// /// Represents an in C# or VB. /// - While = 0x2, + While = 0x1, /// /// Indicates an in C#. /// - For = 0x3, + For = 0x2, /// /// Indicates an in VB. /// - ForTo = 0x4, + ForTo = 0x3, /// /// Indicates an in C# or VB. /// - ForEach = 0x5 + ForEach = 0x4 } } diff --git a/src/Compilers/Core/Portable/Operations/OperationCloner.cs b/src/Compilers/Core/Portable/Operations/OperationCloner.cs index c9ac85325de80..e58120727ec86 100644 --- a/src/Compilers/Core/Portable/Operations/OperationCloner.cs +++ b/src/Compilers/Core/Portable/Operations/OperationCloner.cs @@ -79,14 +79,9 @@ public override IOperation VisitDefaultCaseClause(IDefaultCaseClauseOperation op return new DefaultCaseClause(((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } - public override IOperation VisitDoLoop(IDoLoopOperation operation, object argument) - { - return new DoLoopStatement(operation.DoLoopKind, Visit(operation.Condition), Visit(operation.Body), Visit(operation.IgnoredCondition), operation.Locals, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); - } - public override IOperation VisitWhileLoop(IWhileLoopOperation operation, object argument) { - return new WhileLoopStatement(Visit(operation.Condition), Visit(operation.Body), operation.Locals, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new WhileLoopStatement(Visit(operation.Condition), Visit(operation.Body), Visit(operation.IgnoredCondition), operation.Locals, operation.ConditionIsTop, operation.ConditionIsUntil, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitForLoop(IForLoopOperation operation, object argument) diff --git a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs index 6292394b33b54..4b4b6126c94ea 100644 --- a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs +++ b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs @@ -70,11 +70,6 @@ public virtual void VisitDefaultCaseClause(IDefaultCaseClauseOperation operation DefaultVisit(operation); } - public virtual void VisitDoLoop(IDoLoopOperation operation) - { - DefaultVisit(operation); - } - public virtual void VisitWhileLoop(IWhileLoopOperation operation) { DefaultVisit(operation); @@ -570,11 +565,6 @@ public virtual TResult VisitDefaultCaseClause(IDefaultCaseClauseOperation operat return DefaultVisit(operation, argument); } - public virtual TResult VisitDoLoop(IDoLoopOperation operation, TArgument argument) - { - return DefaultVisit(operation, argument); - } - public virtual TResult VisitWhileLoop(IWhileLoopOperation operation, TArgument argument) { return DefaultVisit(operation, argument); diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index 727741e754d1f..d201478bc9618 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -187,12 +187,6 @@ Microsoft.CodeAnalysis.Operations.CommonConversion.IsNumeric.get -> bool Microsoft.CodeAnalysis.Operations.CommonConversion.IsReference.get -> bool Microsoft.CodeAnalysis.Operations.CommonConversion.IsUserDefined.get -> bool Microsoft.CodeAnalysis.Operations.CommonConversion.MethodSymbol.get -> Microsoft.CodeAnalysis.IMethodSymbol -Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoUntilBottomLoop = 3 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoUntilTopLoop = 4 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoWhileBottomLoop = 1 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoWhileTopLoop = 2 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.None = 0 -> Microsoft.CodeAnalysis.Operations.DoLoopKind Microsoft.CodeAnalysis.Operations.IAddressOfOperation Microsoft.CodeAnalysis.Operations.IAddressOfOperation.Reference.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IAnonymousFunctionOperation @@ -278,10 +272,6 @@ Microsoft.CodeAnalysis.Operations.IDefaultCaseClauseOperation Microsoft.CodeAnalysis.Operations.IDefaultValueOperation Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation.Target.get -> Microsoft.CodeAnalysis.IOperation -Microsoft.CodeAnalysis.Operations.IDoLoopOperation -Microsoft.CodeAnalysis.Operations.IDoLoopOperation.Condition.get -> Microsoft.CodeAnalysis.IOperation -Microsoft.CodeAnalysis.Operations.IDoLoopOperation.DoLoopKind.get -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.IDoLoopOperation.IgnoredCondition.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation.Arguments.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation.Operation.get -> Microsoft.CodeAnalysis.IOperation @@ -461,13 +451,15 @@ Microsoft.CodeAnalysis.Operations.IVariableDeclarationsOperation.Declarations.ge Microsoft.CodeAnalysis.Operations.IVariableInitializerOperation Microsoft.CodeAnalysis.Operations.IWhileLoopOperation Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.Condition.get -> Microsoft.CodeAnalysis.IOperation +Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.ConditionIsTop.get -> bool +Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.ConditionIsUntil.get -> bool +Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.IgnoredCondition.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.Do = 1 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.For = 3 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.ForEach = 5 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.ForTo = 4 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.For = 2 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.ForEach = 4 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.ForTo = 3 -> Microsoft.CodeAnalysis.Operations.LoopKind Microsoft.CodeAnalysis.Operations.LoopKind.None = 0 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.While = 2 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.While = 1 -> Microsoft.CodeAnalysis.Operations.LoopKind Microsoft.CodeAnalysis.Operations.OperationExtensions Microsoft.CodeAnalysis.Operations.OperationVisitor Microsoft.CodeAnalysis.Operations.OperationVisitor.OperationVisitor() -> void @@ -546,7 +538,6 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDeconstructionAs virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultCaseClause(Microsoft.CodeAnalysis.Operations.IDefaultCaseClauseOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultValue(Microsoft.CodeAnalysis.Operations.IDefaultValueOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDelegateCreation(Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation operation) -> void -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDoLoop(Microsoft.CodeAnalysis.Operations.IDoLoopOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicIndexerAccess(Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicInvocation(Microsoft.CodeAnalysis.Operations.IDynamicInvocationOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicMemberReference(Microsoft.CodeAnalysis.Operations.IDynamicMemberReferenceOperation operation) -> void @@ -637,7 +628,6 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.V virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultCaseClause(Microsoft.CodeAnalysis.Operations.IDefaultCaseClauseOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultValue(Microsoft.CodeAnalysis.Operations.IDefaultValueOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDelegateCreation(Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation operation, TArgument argument) -> TResult -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDoLoop(Microsoft.CodeAnalysis.Operations.IDoLoopOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicIndexerAccess(Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicInvocation(Microsoft.CodeAnalysis.Operations.IDynamicInvocationOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicMemberReference(Microsoft.CodeAnalysis.Operations.IDynamicMemberReferenceOperation operation, TArgument argument) -> TResult diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 8e06de18a3b4a..934991158476f 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -1049,47 +1049,25 @@ Namespace Microsoft.CodeAnalysis.Operations Return New LazyRelationalCaseClause(value, relation, _semanticModel, syntax, type, constantValue, isImplicit) End Function - Private Function CreateBoundDoLoopStatementOperation(boundDoLoopStatement As BoundDoLoopStatement) As IDoLoopOperation - Dim doLoopKind As DoLoopKind = GetDoLoopKind(boundDoLoopStatement) + Private Function CreateBoundDoLoopStatementOperation(boundDoLoopStatement As BoundDoLoopStatement) As IWhileLoopOperation Dim condition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundDoLoopStatement.ConditionOpt)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundDoLoopStatement.Body)) Dim ignoredConditionOpt As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() - If doLoopKind = DoLoopKind.None Then - Debug.Assert(boundDoLoopStatement.TopConditionOpt IsNot Nothing) - Debug.Assert(boundDoLoopStatement.BottomConditionOpt IsNot Nothing) + If boundDoLoopStatement.TopConditionOpt IsNot Nothing AndAlso boundDoLoopStatement.BottomConditionOpt IsNot Nothing Then Debug.Assert(boundDoLoopStatement.ConditionOpt Is boundDoLoopStatement.TopConditionOpt) Return Create(boundDoLoopStatement.BottomConditionOpt) Else - Debug.Assert(boundDoLoopStatement.TopConditionOpt Is Nothing OrElse boundDoLoopStatement.BottomConditionOpt Is Nothing) Return Nothing End If End Function) Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty + Dim conditionIsTop As Boolean = boundDoLoopStatement.ConditionIsTop + Dim conditionIsUntil As Boolean = boundDoLoopStatement.ConditionIsUntil Dim syntax As SyntaxNode = boundDoLoopStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() Dim isImplicit As Boolean = boundDoLoopStatement.WasCompilerGenerated - Return New LazyDoLoopStatement(doLoopKind, condition, body, ignoredConditionOpt, locals, _semanticModel, syntax, type, constantValue, isImplicit) - End Function - - Private Shared Function GetDoLoopKind(boundDoLoopStatement As BoundDoLoopStatement) As DoLoopKind - If boundDoLoopStatement.TopConditionOpt IsNot Nothing AndAlso boundDoLoopStatement.BottomConditionOpt IsNot Nothing Then - Return DoLoopKind.None - End If - - If boundDoLoopStatement.ConditionIsTop Then - If boundDoLoopStatement.ConditionIsUntil Then - Return DoLoopKind.DoUntilTopLoop - Else - Return DoLoopKind.DoWhileTopLoop - End If - Else - If boundDoLoopStatement.ConditionIsUntil Then - Return DoLoopKind.DoUntilBottomLoop - Else - Return DoLoopKind.DoWhileBottomLoop - End If - End If + Return New LazyWhileLoopStatement(condition, body, ignoredConditionOpt, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundForToStatementOperation(boundForToStatement As BoundForToStatement) As IForToLoopOperation @@ -1237,12 +1215,15 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundWhileStatementOperation(boundWhileStatement As BoundWhileStatement) As IWhileLoopOperation Dim condition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundWhileStatement.Condition)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundWhileStatement.Body)) + Dim ignoredCondition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Nothing) Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty + Dim conditionIsTop As Boolean = True + Dim conditionIsUntil As Boolean = False Dim syntax As SyntaxNode = boundWhileStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() Dim isImplicit As Boolean = boundWhileStatement.WasCompilerGenerated - Return New LazyWhileLoopStatement(condition, body, locals, _semanticModel, syntax, type, constantValue, isImplicit) + Return New LazyWhileLoopStatement(condition, body, ignoredCondition, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundDimStatementOperation(boundDimStatement As BoundDimStatement) As IVariableDeclarationsOperation diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb index 224d07a61917c..31fe2f0716284 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb @@ -30,15 +30,13 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of DoLoopBlockSyntax)(source, expectedOperationTree) @@ -78,7 +78,7 @@ Class C End Class]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -132,7 +132,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -195,7 +197,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -243,7 +247,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -318,7 +324,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -393,7 +401,7 @@ End Class ]]>.Value Dim expectedOperationTree = = 0') Left: @@ -446,6 +454,8 @@ IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: ' ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'value') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IgnoredCondition: + null ]]>.Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -465,7 +475,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -499,7 +511,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -558,7 +572,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -618,7 +634,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -677,13 +695,15 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -708,7 +728,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -774,7 +796,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -829,7 +853,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -915,7 +943,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1005,7 +1037,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1052,7 +1086,7 @@ End Class ]]>.Value Dim expectedOperationTree = 0 ... End While') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'While i > 0 ... End While') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i > 0') Left: @@ -1068,6 +1102,8 @@ IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: ' ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IgnoredCondition: + null ]]>.Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1089,7 +1125,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1126,7 +1164,7 @@ End Class ]]>.Value Dim expectedOperationTree = 0') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1187,6 +1225,8 @@ IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) Arguments(0) Initializer: null + IgnoredCondition: + null ]]>.Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1212,14 +1252,12 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of DoLoopBlockSyntax)(source, expectedOperationTree) @@ -1257,14 +1297,12 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of DoLoopBlockSyntax)(source, expectedOperationTree) @@ -1296,7 +1336,7 @@ Class C End Class]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -1352,7 +1392,7 @@ End Module ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) End Sub @@ -1401,19 +1443,13 @@ Class C End Class]]>.Value Dim expectedOperationTree = 0') Left: IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - IgnoredCondition: - IBinaryOperation (BinaryOperatorKind.LessThanOrEqual, Checked) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 0') - Left: - IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') Body: IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: 'Do While i ... ntil i <= 0') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'i = i + 1') @@ -1427,6 +1463,12 @@ IDoLoopOperation (DoLoopKind: None) (LoopKind.Do) (OperationKind.Loop, Type: nul IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IgnoredCondition: + IBinaryOperation (BinaryOperatorKind.LessThanOrEqual, Checked) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 0') + Left: + IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ]]>.Value Dim expectedDiagnostics = Date: Thu, 2 Nov 2017 15:41:22 -0700 Subject: [PATCH 08/28] Generate an IVariableDeclaration instead of ILocalReference for loop control variable in foreach statement and VB's ForTo loop statement Fixes #22028 --- .../Operations/CSharpOperationFactory.cs | 6 +- .../IOperationTests_IForEachLoopStatement.cs | 100 ++++++++++++++---- .../IOperationTests_IForLoopStatement.cs | 5 +- ...tionTests_IParameterReferenceExpression.cs | 5 +- .../Operations/VisualBasicOperationFactory.vb | 12 ++- .../IOperationTests_IForEachLoopStatement.vb | 50 +++++++-- .../IOperationTests_IForLoopStatement.vb | 40 +++++-- .../IOperationTests_InvalidStatement.vb | 10 +- 8 files changed, 181 insertions(+), 47 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 27e35a334fb52..5bf1fdcb1541d 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -1356,9 +1356,9 @@ private IForEachLoopOperation CreateBoundForEachStatementOperation(BoundForEachS else if (locals.Length == 1) { var local = (LocalSymbol)locals.Single(); - bool isDeclaration = true; - // This node is implicit because there is no good syntax for it other than the entire 'foreach' statement. - loopControlVariable = new Lazy(() => new LocalReferenceExpression(local, isDeclaration, _semanticModel, local.GetDeclaratorSyntax(), local.Type, local.ConstantValue, isImplicit: true)); + // We use iteration variable type syntax as the underlying syntax node as there is no variable declarator syntax in the syntax tree. + var declaratorSyntax = boundForEachStatement.IterationVariableType.Syntax; + loopControlVariable = new Lazy(() => OperationFactory.CreateVariableDeclaration(local, initializer: null, semanticModel: _semanticModel, syntax: declaratorSyntax)); } else { diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs index 59798832b37c7..2c9f3eb12fbda 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs @@ -31,7 +31,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String value LoopControlVariable: - ILocalReferenceOperation: value (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (st ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') + Variables: Local_1: System.String value + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'pets') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -82,7 +85,10 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String item LoopControlVariable: - ILocalReferenceOperation: item (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (st ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') + Variables: Local_1: System.String item + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.List, IsImplicit) (Syntax: 'list') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -134,7 +140,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (Ke ... }') Locals: Local_1: System.Collections.Generic.KeyValuePair pair LoopControlVariable: - ILocalReferenceOperation: pair (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair, Constant: null, IsImplicit) (Syntax: 'foreach (Ke ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'KeyValuePair') + Variables: Local_1: System.Collections.Generic.KeyValuePair pair + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.Dictionary, IsImplicit) (Syntax: '_h') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -203,7 +212,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - ILocalReferenceOperation: num (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 num + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'numbers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -264,7 +276,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - ILocalReferenceOperation: num (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 num + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'numbers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -323,7 +338,10 @@ orderby letter IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String value LoopControlVariable: - ILocalReferenceOperation: value (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (st ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') + Variables: Local_1: System.String value + Initializer: + null Collection: ILocalReferenceOperation: sorted (OperationKind.LocalReference, Type: ?, IsInvalid) (Syntax: 'sorted') Body: @@ -384,7 +402,10 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (Fi ... }') Locals: Local_1: System.Reflection.FieldInfo fi LoopControlVariable: - ILocalReferenceOperation: fi (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Reflection.FieldInfo, Constant: null, IsImplicit) (Syntax: 'foreach (Fi ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'FieldInfo') + Variables: Local_1: System.Reflection.FieldInfo fi + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'employee.Ge ... GetFields()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -463,7 +484,10 @@ public void M() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (ch ... }') Locals: Local_1: System.Char c LoopControlVariable: - ILocalReferenceOperation: c (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Char, Constant: null, IsImplicit) (Syntax: 'foreach (ch ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'char') + Variables: Local_1: System.Char c + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.String, IsImplicit) (Syntax: 's') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -513,7 +537,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... }') Locals: Local_1: System.Collections.Generic.KeyValuePair pair LoopControlVariable: - ILocalReferenceOperation: pair (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair, Constant: null, IsImplicit) (Syntax: 'foreach (va ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') + Variables: Local_1: System.Collections.Generic.KeyValuePair pair + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.Dictionary, IsImplicit) (Syntax: '_f') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -577,7 +604,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (Mi ... }') Locals: Local_1: MissingType x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: MissingType, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (Mi ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'MissingType') + Variables: Local_1: MissingType x + Initializer: + null Collection: ILocalReferenceOperation: sequence (OperationKind.LocalReference, Type: System.Collections.IEnumerable) (Syntax: 'sequence') Body: @@ -623,7 +653,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 x + Initializer: + null Collection: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null, IsInvalid) (Syntax: 'null') Body: @@ -652,7 +685,10 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'args') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -682,7 +718,10 @@ void F(int[] a) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... a) { x++; }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (in ... a) { x++; }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -731,7 +770,10 @@ class Enumerator IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (lo ... x in e) { }') Locals: Local_1: System.Int64 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int64, Constant: null, IsImplicit) (Syntax: 'foreach (lo ... x in e) { }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'long') + Variables: Local_1: System.Int64 x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: Enumerable, IsImplicit) (Syntax: 'e') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -761,7 +803,10 @@ void F(string s) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (var x in s) { }') Locals: Local_1: System.Char x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Char, Constant: null, IsImplicit) (Syntax: 'foreach (var x in s) { }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') + Variables: Local_1: System.Char x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.String, IsImplicit) (Syntax: 's') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -793,7 +838,10 @@ class var { } IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (var x in a) { }') Locals: Local_1: C.var x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: C.var, Constant: null, IsImplicit) (Syntax: 'foreach (var x in a) { }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') + Variables: Local_1: C.var x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -823,7 +871,10 @@ void F(dynamic d) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (int x in d) { }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (int x in d) { }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'd') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -861,7 +912,10 @@ public class Enumerable IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (ob ... }') Locals: Local_1: System.Object x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Object, Constant: null, IsImplicit) (Syntax: 'foreach (ob ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object') + Variables: Local_1: System.Object x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: Enumerable, IsImplicit) (Syntax: 'new Enumerable()') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -906,7 +960,10 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... e)args) { }') Locals: Local_1: System.String x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (st ... e)args) { }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') + Variables: Local_1: System.String x + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: '(IEnumerable)args') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -949,7 +1006,10 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - ILocalReferenceOperation: num (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') + Variables: Local_1: System.Int32 num + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'numbers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index d26faa3dffc6a..4dfea4b55e3ee 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1898,7 +1898,10 @@ select z into w IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... }') Locals: Local_1: System.String item LoopControlVariable: - ILocalReferenceOperation: item (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (va ... }') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') + Variables: Local_1: System.String item + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'str') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index 98d91977e065d..1badd3cb2a33a 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -1042,7 +1042,10 @@ static IEnumerable MyIterator(IEnumerable source, Func predica IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... rn element;') Locals: Local_1: T element LoopControlVariable: - ILocalReferenceOperation: element (IsDeclaration: True) (OperationKind.LocalReference, Type: T, Constant: null, IsImplicit) (Syntax: 'foreach (va ... rn element;') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') + Variables: Local_1: T element + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'source') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 8e06de18a3b4a..df922050431e4 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -1096,7 +1096,7 @@ Namespace Microsoft.CodeAnalysis.Operations Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundForToStatement.DeclaredOrInferredLocalOpt IsNot Nothing, ImmutableArray.Create(Of ILocalSymbol)(boundForToStatement.DeclaredOrInferredLocalOpt), ImmutableArray(Of ILocalSymbol).Empty) - Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.ControlVariable)) + Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() CreateBoundControlVariableOperation(boundForToStatement)) Dim initialValue As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.InitialValue)) Dim limitValue As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.LimitValue)) Dim stepValue As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.StepValue)) @@ -1118,7 +1118,7 @@ Namespace Microsoft.CodeAnalysis.Operations Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundForEachStatement.DeclaredOrInferredLocalOpt IsNot Nothing, ImmutableArray.Create(Of ILocalSymbol)(boundForEachStatement.DeclaredOrInferredLocalOpt), ImmutableArray(Of ILocalSymbol).Empty) - Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForEachStatement.ControlVariable)) + Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() CreateBoundControlVariableOperation(boundForEachStatement)) Dim collection As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForEachStatement.Collection)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForEachStatement.Body)) Dim nextVariables As Lazy(Of ImmutableArray(Of IOperation)) = New Lazy(Of ImmutableArray(Of IOperation))( @@ -1134,6 +1134,14 @@ Namespace Microsoft.CodeAnalysis.Operations Return New LazyForEachLoopStatement(locals, loopControlVariable, collection, nextVariables, body, _semanticModel, syntax, type, constantValue, isImplicit) End Function + Private Function CreateBoundControlVariableOperation(boundForStatement As BoundForStatement) As IOperation + Dim localOpt = boundForStatement.DeclaredOrInferredLocalOpt + Dim controlVariable = boundForStatement.ControlVariable + Return If(localOpt IsNot Nothing AndAlso controlVariable?.Syntax.Kind = SyntaxKind.VariableDeclarator, + OperationFactory.CreateVariableDeclaration(localOpt, initializer:=Nothing, semanticModel:=_semanticModel, syntax:=controlVariable.Syntax), + Create(controlVariable)) + End Function + Private Function CreateBoundTryStatementOperation(boundTryStatement As BoundTryStatement) As ITryOperation Dim body As Lazy(Of IBlockOperation) = New Lazy(Of IBlockOperation)(Function() DirectCast(Create(boundTryStatement.TryBlock), IBlockOperation)) Dim catches As Lazy(Of ImmutableArray(Of ICatchClauseOperation)) = New Lazy(Of ImmutableArray(Of ICatchClauseOperation))(Function() boundTryStatement.CatchBlocks.SelectAsArray(Function(n) DirectCast(Create(n), ICatchClauseOperation))) diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb index 8855133040a77..9502efd0651b6 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb @@ -31,7 +31,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each s ... Next') Locals: Local_1: s As System.String LoopControlVariable: - ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's As String') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 's As String') + Variables: Local_1: s As System.String + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'arr') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -77,7 +80,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each it ... Next') Locals: Local_1: item As System.String LoopControlVariable: - ILocalReferenceOperation: item (OperationKind.LocalReference, Type: System.String) (Syntax: 'item As String') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'item As String') + Variables: Local_1: item As System.String + Initializer: + null Collection: ILocalReferenceOperation: list (OperationKind.LocalReference, Type: System.Collections.Generic.List(Of System.String)) (Syntax: 'list') Body: @@ -123,7 +129,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y As Char') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Char') + Variables: Local_1: y As System.Char + Initializer: + null Collection: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x') Body: @@ -179,7 +188,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next y, x') Locals: Local_1: x As System.String LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x As String') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As String') + Variables: Local_1: x As System.String + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'S') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -190,7 +202,10 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next y, x') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y As Char') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Char') + Variables: Local_1: y As System.Char + Initializer: + null Collection: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x') Body: @@ -251,7 +266,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Int32 LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'y As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Integer') + Variables: Local_1: y As System.Int32 + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'x') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -296,7 +314,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.String LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x As String') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As String') + Variables: Local_1: x As System.String + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'S') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -307,7 +328,10 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y As Char') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Char') + Variables: Local_1: y As System.Char + Initializer: + null Collection: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x') Body: @@ -883,7 +907,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For Each el ... Next') Locals: Local_1: element As System.Int32 LoopControlVariable: - ILocalReferenceOperation: element (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'element As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'element As Integer') + Variables: Local_1: element As System.Int32 + Initializer: + null Collection: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: "Hello World.", IsInvalid) (Syntax: '"Hello World."') Body: @@ -928,7 +955,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each s ... Next') Locals: Local_1: s As System.String LoopControlVariable: - ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's As String') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 's As String') + Variables: Local_1: s As System.String + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'arr') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb index 36341f166db10..afc01571728dd 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb @@ -27,7 +27,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -90,7 +93,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -146,7 +152,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As Do ... Next') Locals: Local_1: i As System.Double LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Double) (Syntax: 'i As Double') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Double') + Variables: Local_1: i As System.Double + Initializer: + null InitialValue: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Double, Constant: 2, IsImplicit) (Syntax: '2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -558,7 +567,10 @@ End Enum IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For x As e1 ... Next') Locals: Local_1: x As e1 LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: e1) (Syntax: 'x As e1') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As e1') + Variables: Local_1: x As e1 + Initializer: + null InitialValue: IFieldReferenceOperation: e1.a (Static) (OperationKind.FieldReference, Type: e1, Constant: 0) (Syntax: 'e1.a') Instance Receiver: @@ -607,7 +619,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'P1(30 + i)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -663,7 +678,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For global_ ... Next') Locals: Local_1: global_x As System.Int32 LoopControlVariable: - ILocalReferenceOperation: global_x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'global_x As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'global_x As Integer') + Variables: Local_1: global_x As System.Int32 + Initializer: + null InitialValue: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, Constant: 20, IsImplicit) (Syntax: 'global_y') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -703,7 +721,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For x As In ... o 10 : Next') Locals: Local_1: x As System.Int32 LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As Integer') + Variables: Local_1: x As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -827,7 +848,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb index 4d7e88635c703..f9a1bf3c2687d 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb @@ -235,7 +235,10 @@ End Module IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For i As In ... Next i') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsInvalid) (Syntax: '0') LimitValue: @@ -330,7 +333,10 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For i As In ... Next i') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: From 910ed7717780a5a321e603817de72a2349faea7c Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 3 Nov 2017 09:04:36 -0700 Subject: [PATCH 09/28] Fix IArgument and IArrayInitializer to have null types Fixes #22581 --- .../Portable/Operations/CSharpArgument.cs | 14 +- .../Operations/CSharpOperationCloner.cs | 2 +- .../Operations/CSharpOperationFactory.cs | 3 +- .../CSharpOperationFactory_Methods.cs | 1 - .../Semantic/IOperation/IOperationTests.cs | 2 +- .../IOperation/IOperationTests_IArgument.cs | 264 +++++++++--------- ...perationTests_IBinaryOperatorExpression.cs | 4 +- .../IOperationTests_IFixedStatement.cs | 2 +- .../IOperationTests_IForEachLoopStatement.cs | 36 +-- .../IOperationTests_IForLoopStatement.cs | 64 ++--- .../IOperationTests_IIfStatement.cs | 48 ++-- ...tionTests_IInterpolatedStringExpression.cs | 4 +- ...IOperationTests_ILocalFunctionStatement.cs | 6 +- .../IOperationTests_ILockStatement.cs | 2 +- ...perationTests_IObjectCreationExpression.cs | 2 +- ...tionTests_IParameterReferenceExpression.cs | 8 +- .../IOperationTests_ISymbolInitializer.cs | 4 +- .../IOperationTests_ITupleExpression.cs | 20 +- .../IOperationTests_IUsingStatement.cs | 20 +- ...OperationTests_IWhileUntilLoopStatement.cs | 48 ++-- .../IOperation/IOperationTests_TryCatch.cs | 2 +- .../Semantic/Semantics/DeconstructionTests.cs | 14 +- .../Test/Semantic/Semantics/OperatorTests.cs | 48 ++-- .../Test/Semantic/Semantics/QueryTests.cs | 196 ++++++------- .../Symbols/AnonymousTypesSemanticsTests.cs | 2 +- .../Generated/Operations.xml.Generated.cs | 14 +- .../Portable/Operations/OperationCloner.cs | 2 +- .../Operations/VisualBasicArgument.vb | 12 +- .../Operations/VisualBasicOperationCloner.vb | 2 +- .../Operations/VisualBasicOperationFactory.vb | 3 +- .../VisualBasicOperationFactory_Methods.vb | 1 - ...rationTests_ArrayCreationAndInitializer.vb | 58 ++-- .../IOperation/IOperationTests_IArgument.vb | 12 +- .../IOperationTests_IConversionExpression.vb | 6 +- ...tionTests_IParameterReferenceExpression.vb | 2 +- .../IOperationTests_InvalidExpression.vb | 2 +- .../Semantic/Semantics/QueryExpressions.vb | 66 ++--- 37 files changed, 496 insertions(+), 500 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs b/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs index 85531c51017da..4d2a9c5a5c09b 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs @@ -7,8 +7,8 @@ namespace Microsoft.CodeAnalysis.CSharp { internal abstract class BaseCSharpArgument : BaseArgument { - public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) { } @@ -19,8 +19,8 @@ public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, internal sealed class CSharpArgument : BaseCSharpArgument { - public CSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + public CSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) { ValueImpl = value; } @@ -32,11 +32,11 @@ internal sealed class LazyCSharpArgument : BaseCSharpArgument { private readonly Lazy _lazyValue; - public LazyCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + public LazyCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) { _lazyValue = value ?? throw new ArgumentNullException(nameof(value)); - } + } protected override IOperation ValueImpl => _lazyValue.Value; } diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs index c090b2b6e3eb5..e85b4a6a50e82 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs @@ -10,7 +10,7 @@ internal class CSharpOperationCloner : OperationCloner public override IOperation VisitArgument(IArgumentOperation operation, object argument) { - return new CSharpArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new CSharpArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitConversion(IConversionOperation operation, object argument) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 27e35a334fb52..cf8abf52e8d2e 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -903,10 +903,9 @@ private IArrayInitializerOperation CreateBoundArrayInitializationOperation(Bound { Lazy> elementValues = new Lazy>(() => boundArrayInitialization.Initializers.SelectAsArray(n => Create(n))); SyntaxNode syntax = boundArrayInitialization.Syntax; - ITypeSymbol type = boundArrayInitialization.Type; Optional constantValue = ConvertToOptional(boundArrayInitialization.ConstantValue); bool isImplicit = boundArrayInitialization.WasCompilerGenerated; - return new LazyArrayInitializer(elementValues, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyArrayInitializer(elementValues, _semanticModel, syntax, constantValue, isImplicit); } private IDefaultValueOperation CreateBoundDefaultExpressionOperation(BoundDefaultExpression boundDefaultExpression) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs index ad4fd80b5fd25..d1d43fa6ccc65 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs @@ -46,7 +46,6 @@ internal IArgumentOperation CreateArgumentOperation(ArgumentKind kind, IParamete value, semanticModel: _semanticModel, syntax: argument ?? value.Syntax, - type: value.Type, constantValue: default, isImplicit: expression.WasCompilerGenerated || argument == null); } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs index ccc50563922c6..f383d39a79f43 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs @@ -50,7 +50,7 @@ static void Test2(int y, params int[] x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[]) (Syntax: 'null') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'null') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32[], Constant: null, IsImplicit) (Syntax: 'null') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs index a90a7d5a775af..94fd27e6bb967 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs @@ -58,11 +58,11 @@ static void M2(int x, double y) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Double) (Syntax: '2.0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '2.0') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 2) (Syntax: '2.0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -92,11 +92,11 @@ static void M2(int x, double y = 0.0) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Double, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 0, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -126,11 +126,11 @@ static void M2(int x, double y = 0.0) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Double) (Syntax: 'y: 9.9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 9.9') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 9.9) (Syntax: '9.9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -160,11 +160,11 @@ static void M2(int x, double y = 0.0) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Double) (Syntax: 'y: 9.9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 9.9') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 9.9) (Syntax: '9.9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -194,15 +194,15 @@ static void M2(int x = 1, int y = 2, int z = 3) { } Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: 0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'z: 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'z: 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(y: 0, z: 2)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(y: 0, z: 2)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(y: 0, z: 2)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -232,15 +232,15 @@ static void M2(int x = 1, int y = 2, int z = 3) { } Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'z: 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'z: 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 9') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 9) (Syntax: '9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(z: 2, x: 9)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(z: 2, x: 9)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(z: 2, x: 9)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -272,15 +272,15 @@ static void M2(int x = 1, int y = 2, int z = 3) { } Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '9') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 9) (Syntax: '9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'z: 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'z: 10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(9, z: 10)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(9, z: 10)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(9, z: 10)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -312,11 +312,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'ref a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'ref a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'out b') ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -348,11 +348,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: ref a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: ref a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: out b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: out b') ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -384,11 +384,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: out b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: out b') ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: ref a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: ref a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -420,7 +420,7 @@ struct S { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IDefaultValueOperation (OperationKind.DefaultValue, Type: S, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -452,7 +452,7 @@ struct S { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IDefaultValueOperation (OperationKind.DefaultValue, Type: S, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -483,7 +483,7 @@ void M2(double s = Pi) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: System.Double, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 3.14, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -517,15 +517,15 @@ public static void E1(this P p, int x = 0, int y = 0) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: P, IsImplicit) (Syntax: 'this') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this') IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -561,15 +561,15 @@ public static void E1(this P p, int x = 0, int y = 0) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: P, IsImplicit) (Syntax: 'this') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this') IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -603,15 +603,15 @@ public static void E1(this P p, int x = 0, int y = 0) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: P, IsImplicit) (Syntax: 'this') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this') IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'this.E1(y: 1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this.E1(y: 1)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'this.E1(y: 1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -642,11 +642,11 @@ void M2(int x, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -676,11 +676,11 @@ void M2(int x, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') @@ -717,11 +717,11 @@ void M2(int x, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(1)') @@ -757,11 +757,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2()') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2()') @@ -797,11 +797,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'array: a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'array: a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(array: a)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: a)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(array: a)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -831,7 +831,7 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(array: 1)') @@ -844,7 +844,7 @@ Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(array: 1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: 1)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(array: 1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -875,11 +875,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'array: a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'array: a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -909,11 +909,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, array: 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1, array: 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, array: 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(1, array: 1)') @@ -955,11 +955,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'array: a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'array: a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -989,7 +989,7 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1, x: 10)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: 1, x: 10)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1, x: 10)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(array: 1, x: 10)') @@ -1002,7 +1002,7 @@ Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1038,15 +1038,15 @@ void M2( Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""M1"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 8, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1081,15 +1081,15 @@ bool M2( Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""M1"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1124,15 +1124,15 @@ static bool M2( Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""field"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1179,15 +1179,15 @@ static bool M2( Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""MyEvent"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 11, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1311,32 +1311,32 @@ void M() Instance Receiver: null Arguments(6): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""{0} {1} {2} {3} {4}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""{0} {1} {2} {3} {4}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""{0} {1} {2} {3} {4}"") (Syntax: '""{0} {1} {2} {3} {4}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: '1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: '2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg2) (OperationKind.Argument, Type: System.Object) (Syntax: '3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg2) (OperationKind.Argument, Type: null) (Syntax: '3') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '3') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg3) (OperationKind.Argument, Type: System.Object) (Syntax: '4') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg3) (OperationKind.Argument, Type: null) (Syntax: '4') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '4') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1376,7 +1376,7 @@ void M2(int x = ""string"") Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1415,7 +1415,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1450,7 +1450,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1485,11 +1485,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j:10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: null) (Syntax: 'j:10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'this[j:10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: i) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[j:10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'this[j:10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1605,11 +1605,11 @@ static void Main() Instance Receiver: ILocalReferenceOperation: d (OperationKind.LocalReference, Type: Derived) (Syntax: 'd') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'd[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'd[0]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'd[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1647,11 +1647,11 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[0]') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'this[0]') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'this[0]') @@ -1689,7 +1689,7 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1799,11 +1799,11 @@ public static void Main(string[] args) Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p[10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p[10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4, IsImplicit) (Syntax: 'p[10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1917,11 +1917,11 @@ public static void Main(string[] args) Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p[10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p[10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'p[10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2036,11 +2036,11 @@ public static void Main(string[] args) Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p[10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p[10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'p[10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2101,7 +2101,7 @@ public void M2() Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p.M1()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p.M1()') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'p.M1()') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -2136,7 +2136,7 @@ static void M2(bool? x = true) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2()') IInvalidOperation (OperationKind.Invalid, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Boolean[missing], Constant: True, IsInvalid, IsImplicit) (Syntax: 'M2()') @@ -2195,7 +2195,7 @@ static P M1() string expectedOperationTree = @" IObjectCreationOperation (Constructor: P..ctor([System.Boolean[missing]? x = true])) (OperationKind.ObjectCreation, Type: P, IsInvalid) (Syntax: 'new P()') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'new P()') IInvalidOperation (OperationKind.Invalid, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Boolean[missing], Constant: True, IsInvalid, IsImplicit) (Syntax: 'new P()') @@ -2264,11 +2264,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'this[0]') IInvalidOperation (OperationKind.Invalid, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 5, IsInvalid, IsImplicit) (Syntax: 'this[0]') @@ -2344,7 +2344,7 @@ static void M2(bool? x = null) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2()') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2398,7 +2398,7 @@ static P M1() string expectedOperationTree = @" IObjectCreationOperation (Constructor: P..ctor([System.Boolean[missing]? x = null])) (OperationKind.ObjectCreation, Type: P, IsInvalid) (Syntax: 'new P()') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'new P()') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2462,11 +2462,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'this[0]') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2540,11 +2540,11 @@ static void M2(int x, S s = 0) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2582,11 +2582,11 @@ static P M1() string expectedOperationTree = @" IObjectCreationOperation (Constructor: P..ctor(System.Int32 x, [S s = null])) (OperationKind.ObjectCreation, Type: P) (Syntax: 'new P(1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'new P(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new P(1)') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: 'new P(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2631,11 +2631,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[0]') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: 'this[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2682,11 +2682,11 @@ class G Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: G, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') ILiteralOperation (OperationKind.Literal, Type: G, Constant: null, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2730,11 +2730,11 @@ struct G Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: G?, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') IDefaultValueOperation (OperationKind.DefaultValue, Type: G?, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2792,7 +2792,7 @@ static void M2(int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2817,7 +2817,7 @@ static void M2(ref int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'ref i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'ref i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2843,7 +2843,7 @@ static void M2(in int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'refI') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'refI') ILocalReferenceOperation: refI (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'refI') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2868,7 +2868,7 @@ static void M2(out int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'out i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2902,7 +2902,7 @@ static void M2(params int[] array) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'M2(1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(1)') @@ -2938,7 +2938,7 @@ static void M2(params int[] array) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'M2(0, 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(0, 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'M2(0, 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(0, 1)') @@ -2969,7 +2969,7 @@ static void M2(int i, int j) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j: 1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: null) (Syntax: 'j: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2993,7 +2993,7 @@ static void M2(int i, int j) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i: 1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3017,7 +3017,7 @@ public P(int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3042,7 +3042,7 @@ public P(ref int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'ref i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'ref i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3067,7 +3067,7 @@ public P(out int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'out i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3099,7 +3099,7 @@ public P(params int[] array) { } Expression: IObjectCreationOperation (Constructor: P..ctor(params System.Int32[] array)) (OperationKind.ObjectCreation, Type: P) (Syntax: 'new P(1)') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'new P(1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new P(1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'new P(1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'new P(1)') @@ -3135,7 +3135,7 @@ public P(params int[] array) { } Expression: IObjectCreationOperation (Constructor: P..ctor(params System.Int32[] array)) (OperationKind.ObjectCreation, Type: P) (Syntax: 'new P(0, 1)') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'new P(0, 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new P(0, 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'new P(0, 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'new P(0, 1)') @@ -3168,7 +3168,7 @@ void M1() } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3196,7 +3196,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'this[1]') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[1]') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'this[1]') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'this[1]') @@ -3230,7 +3230,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'this[0, 1]') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[0, 1]') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'this[0, 1]') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'this[0, 1]') @@ -3301,7 +3301,7 @@ void M1(int i, int i2) } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i2) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i2) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3330,10 +3330,10 @@ static void M2(int? x = 10) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32?, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IObjectCreationOperation (Constructor: System.Int32?..ctor(System.Int32 value)) (OperationKind.ObjectCreation, Type: System.Int32?, IsImplicit) (Syntax: 'M2()') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3464,11 +3464,11 @@ P M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsInvalid, IsImplicit) (Syntax: '[0]') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: '[0]') IInvalidOperation (OperationKind.Invalid, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid, IsImplicit) (Syntax: '[0]') @@ -3561,11 +3561,11 @@ P M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsInvalid, IsImplicit) (Syntax: '[0]') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: '[0]') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3654,11 +3654,11 @@ P M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: '[0]') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: '[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '[0]') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: '[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs index 68618e82c85d5..157600de28517 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs @@ -188,7 +188,7 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') IBinaryOperation (BinaryOperatorKind.Or) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') Left: IBinaryOperation (BinaryOperatorKind.And) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... / e % f & g') @@ -322,7 +322,7 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') IBinaryOperation (BinaryOperatorKind.Or) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') Left: IBinaryOperation (BinaryOperatorKind.And) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... / e % f & g') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs index e0d658887e7f1..04938aef222ff 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs @@ -54,7 +54,7 @@ void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""P is {*p}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""P is {*p}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""P is {*p}""') Parts(2): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'P is ') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs index 59798832b37c7..f50b7fcabf81a 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs @@ -45,7 +45,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'value') ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.String) (Syntax: 'value') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -96,7 +96,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'item') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'item') ILocalReferenceOperation: item (OperationKind.LocalReference, Type: System.String) (Syntax: 'item') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -150,11 +150,11 @@ static void Main() Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""{0},{1}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""{0},{1}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""{0},{1}"") (Syntax: '""{0},{1}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Key') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: 'pair.Key') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Key') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -163,7 +163,7 @@ static void Main() ILocalReferenceOperation: pair (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair) (Syntax: 'pair') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: 'pair.Value') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Value') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -229,7 +229,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'num') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'num') ILocalReferenceOperation: num (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'num') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -290,7 +290,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'num') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'num') ILocalReferenceOperation: num (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'num') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -334,7 +334,7 @@ orderby letter Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'value') ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.String) (Syntax: 'value') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -404,7 +404,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'fi.Name + "" ... (employee))') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'fi.Name + "" ... (employee))') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'fi.Name + "" ... (employee))') Left: IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'fi.Name + "" = ""') @@ -419,12 +419,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'fi.GetValue(employee)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'fi.GetValue(employee)') IInvocationOperation (virtual System.Object System.Reflection.FieldInfo.GetValue(System.Object obj)) (OperationKind.Invocation, Type: System.Object) (Syntax: 'fi.GetValue(employee)') Instance Receiver: ILocalReferenceOperation: fi (OperationKind.LocalReference, Type: System.Reflection.FieldInfo) (Syntax: 'fi') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'employee') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'employee') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'employee') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -477,7 +477,7 @@ public void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: 'c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c') ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Char) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -529,11 +529,11 @@ static void Main() Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""{0},{1}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""{0},{1}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""{0},{1}"") (Syntax: '""{0},{1}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Key') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: 'pair.Key') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Key') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -542,7 +542,7 @@ static void Main() ILocalReferenceOperation: pair (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair) (Syntax: 'pair') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: 'pair.Value') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Value') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -878,7 +878,7 @@ public class Enumerable Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'x') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'x') ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -969,7 +969,7 @@ static void Main() IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw new S ... ""testing"");') IObjectCreationOperation (Constructor: System.Exception..ctor(System.String message)) (OperationKind.ObjectCreation, Type: System.Exception) (Syntax: 'new System. ... (""testing"")') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: System.String) (Syntax: '""testing""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: null) (Syntax: '""testing""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""testing"") (Syntax: '""testing""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -983,7 +983,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'num') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'num') ILocalReferenceOperation: num (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'num') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index d26faa3dffc6a..3c1e3b9709e22 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1147,7 +1147,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1568,7 +1568,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""hello""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""hello""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""hello"") (Syntax: '""hello""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1827,24 +1827,24 @@ select z into w Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'select z') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x in ""123""') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""123"") (Syntax: '""123""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x.ToString()') @@ -1853,11 +1853,11 @@ select z into w ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'let z = x.ToString()') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IInvocationOperation (virtual System.String System.Char.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'x.ToString()') Instance Receiver: IOperation: (OperationKind.None, Type: null) (Syntax: 'x') @@ -1870,7 +1870,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'z') @@ -1882,7 +1882,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'w') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'w') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'w') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'w') @@ -1912,7 +1912,7 @@ select z into w Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'item') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'item') ILocalReferenceOperation: item (OperationKind.LocalReference, Type: System.String) (Syntax: 'item') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1982,24 +1982,24 @@ select z into w Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'select z') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x in ""123""') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""123"") (Syntax: '""123""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x.ToString()') @@ -2008,11 +2008,11 @@ select z into w ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'let z = x.ToString()') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IInvocationOperation (virtual System.String System.Char.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'x.ToString()') Instance Receiver: IOperation: (OperationKind.None, Type: null) (Syntax: 'x') @@ -2025,7 +2025,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'z') @@ -2037,7 +2037,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'w') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'w') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'w') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'w') @@ -2122,12 +2122,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'lambda(i)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'lambda(i)') IInvocationOperation (virtual System.Int32 System.Func.Invoke(System.Int32 arg)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'lambda(i)') Instance Receiver: ILocalReferenceOperation: lambda (OperationKind.LocalReference, Type: System.Func) (Syntax: 'lambda') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2220,12 +2220,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'lambda(i)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'lambda(i)') IInvocationOperation (virtual System.Int32 System.Func.Invoke(System.Int32 arg)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'lambda(i)') Instance Receiver: ILocalReferenceOperation: lambda (OperationKind.LocalReference, Type: System.Func) (Syntax: 'lambda') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2341,7 +2341,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2399,7 +2399,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2450,7 +2450,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2489,7 +2489,7 @@ static int foo(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'i--') IIncrementOrDecrementOperation (Postfix) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'i--') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') @@ -2515,7 +2515,7 @@ static int foo(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2553,7 +2553,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""z""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""z""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""z"") (Syntax: '""z""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2655,11 +2655,11 @@ private void M() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: null) (Syntax: 's') ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: null) (Syntax: 'out var i') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var i') ILocalReferenceOperation: i (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2682,7 +2682,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""i={i}, s={s}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""i={i}, s={s}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""i={i}, s={s}""') Parts(4): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'i=') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs index b842d5cb88ac7..d42602e733823 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs @@ -205,7 +205,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'm') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'm') ILocalReferenceOperation: m (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'm') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -219,7 +219,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'n') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'n') ILocalReferenceOperation: n (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'n') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -277,7 +277,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'm') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'm') ILocalReferenceOperation: m (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'm') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -289,7 +289,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'n') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'n') ILocalReferenceOperation: n (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'n') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -345,7 +345,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Nothing is ... er than m.""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Nothing is ... er than m.""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Nothing is larger than m."") (Syntax: '""Nothing is ... er than m.""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -401,7 +401,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Result1""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Result1""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Result1"") (Syntax: '""Result1""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -421,7 +421,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Result2""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Result2""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Result2"") (Syntax: '""Result2""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -433,7 +433,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Result3""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Result3""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Result3"") (Syntax: '""Result3""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -467,11 +467,11 @@ private void M() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: null) (Syntax: 's') ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: null) (Syntax: 'out var i') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var i') ILocalReferenceOperation: i (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -483,7 +483,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""i ={i}, s ={s}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') Parts(4): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'i =') @@ -515,7 +515,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""i ={i}, s ={s}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') Parts(4): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'i =') @@ -584,7 +584,7 @@ private int A() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'A()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'A()') IInvocationOperation ( System.Int32 P.A()) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'A()') Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'A') @@ -636,16 +636,16 @@ private void A(bool flag) Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'A') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'int.TryPars ... out var i)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: null) (Syntax: 'int.TryPars ... out var i)') IInvocationOperation (System.Boolean System.Int32.TryParse(System.String s, out System.Int32 result)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'int.TryPars ... out var i)') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: null) (Syntax: 's') ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: null) (Syntax: 'out var i') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var i') ILocalReferenceOperation: i (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -696,7 +696,7 @@ private static void A(bool flag, int number) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'o is int i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: null) (Syntax: 'o is int i') IIsPatternOperation (OperationKind.IsPattern, Type: System.Boolean) (Syntax: 'o is int i') Expression: ILocalReferenceOperation: o (OperationKind.LocalReference, Type: System.Object) (Syntax: 'o') @@ -704,7 +704,7 @@ private static void A(bool flag, int number) IDeclarationPatternOperation (Declared Symbol: System.Int32 i) (OperationKind.DeclarationPattern, Type: null) (Syntax: 'int i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -752,7 +752,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'str') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'str') ILocalReferenceOperation: str (OperationKind.LocalReference, Type: System.String) (Syntax: 'str') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -796,7 +796,7 @@ private static void A(object o) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: o) (OperationKind.Argument, Type: System.Object) (Syntax: '25') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: o) (OperationKind.Argument, Type: null) (Syntax: '25') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '25') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -849,7 +849,7 @@ private static void A(bool flag, int number) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'o is int i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: null) (Syntax: 'o is int i') IIsPatternOperation (OperationKind.IsPattern, Type: System.Boolean) (Syntax: 'o is int i') Expression: ILocalReferenceOperation: o (OperationKind.LocalReference, Type: System.Object) (Syntax: 'o') @@ -857,7 +857,7 @@ private static void A(bool flag, int number) IDeclarationPatternOperation (Declared Symbol: System.Int32 i) (OperationKind.DeclarationPattern, Type: null) (Syntax: 'int i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -906,7 +906,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'str') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'str') ILocalReferenceOperation: str (OperationKind.LocalReference, Type: System.String) (Syntax: 'str') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1145,7 +1145,7 @@ Type Arguments(0) Operand: IParameterReferenceOperation: d (OperationKind.ParameterReference, Type: dynamic) (Syntax: 'd') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'x') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'x') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs index 6f9c98361d54f..001c2398cf427 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs @@ -314,7 +314,7 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: Class, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'y') ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'y') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -369,7 +369,7 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: Class, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.String) (Syntax: '$""{y}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: '$""{y}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""{y}""') Parts(1): IInterpolationOperation (OperationKind.Interpolation, Type: null) (Syntax: '{y}') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs index 130f9fdd87fac..0acc33a18a233 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs @@ -162,7 +162,7 @@ public void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: System.Int32) (Syntax: 'p1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: null) (Syntax: 'p1') IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'p1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -194,7 +194,7 @@ public void M(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x + p1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: null) (Syntax: 'x + p1') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + p1') Left: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') @@ -240,7 +240,7 @@ public void M(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: millisecondsDelay) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: millisecondsDelay) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs index a7bc7d00eb90a..07bded68413a0 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs @@ -364,7 +364,7 @@ public void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Hello World!""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Hello World!""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Hello World!"") (Syntax: '""Hello World!""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs index 3907af1be0e64..d0e610544ff02 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs @@ -268,7 +268,7 @@ public void M1(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'new[] { x, y }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new[] { x, y }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'new[] { x, y }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index 98d91977e065d..809c3f6e88f90 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -159,14 +159,14 @@ public void M(List customers) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from cust in customers') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from cust in customers') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from cust in customers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IParameterReferenceOperation: customers (OperationKind.ParameterReference, Type: System.Collections.Generic.List) (Syntax: 'customers') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'cust.Name') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'cust.Name') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'cust.Name') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'cust.Name') @@ -782,7 +782,7 @@ public void M(string x) IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw new A ... (nameof(x))') IObjectCreationOperation (Constructor: System.ArgumentNullException..ctor(System.String paramName)) (OperationKind.ObjectCreation, Type: System.ArgumentNullException) (Syntax: 'new Argumen ... (nameof(x))') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: paramName) (OperationKind.Argument, Type: System.String) (Syntax: 'nameof(x)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: paramName) (OperationKind.Argument, Type: null) (Syntax: 'nameof(x)') INameOfOperation (OperationKind.NameOf, Type: System.String, Constant: ""x"") (Syntax: 'nameof(x)') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.String) (Syntax: 'x') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1055,7 +1055,7 @@ static IEnumerable MyIterator(IEnumerable source, Func predica Instance Receiver: IParameterReferenceOperation: predicate (OperationKind.ParameterReference, Type: System.Func) (Syntax: 'predicate') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: T) (Syntax: 'element') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: null) (Syntax: 'element') ILocalReferenceOperation: element (OperationKind.LocalReference, Type: T) (Syntax: 'element') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs index 6a55b3a20004b..3a58bcb610572 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs @@ -335,7 +335,7 @@ class C Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -363,7 +363,7 @@ class C Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs index 14338db97eaa9..d7d39c1814ce6 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs @@ -549,7 +549,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -618,7 +618,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -873,7 +873,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -949,7 +949,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1011,11 +1011,11 @@ public void M() Right: IObjectCreationOperation (Constructor: Point..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: Point) (Syntax: 'new Point(0, 1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1082,11 +1082,11 @@ Dimension Sizes(1): Element Values(1): IObjectCreationOperation (Constructor: Point..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: Point) (Syntax: 'new Point(0, 1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1144,11 +1144,11 @@ public void M() Right: IObjectCreationOperation (Constructor: Point..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: Point) (Syntax: 'new Point(0, 1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs index 361d6d8b148a7..8a245c34610bf 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs @@ -50,7 +50,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c.ToString()') Instance Receiver: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: C) (Syntax: 'c') @@ -114,7 +114,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') Instance Receiver: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: C) (Syntax: 'c1') @@ -162,7 +162,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c.ToString()') Instance Receiver: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: C) (Syntax: 'c') @@ -230,7 +230,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -291,7 +291,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -361,7 +361,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -451,7 +451,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -529,7 +529,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') Instance Receiver: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: C) (Syntax: 'c1') @@ -578,7 +578,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') Instance Receiver: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: C) (Syntax: 'c1') @@ -812,7 +812,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c.ToString()') Instance Receiver: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: C) (Syntax: 'c') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs index 578bb515ceb60..19b670120a3b2 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs @@ -229,7 +229,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""While-loop break""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""While-loop break""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop break"") (Syntax: '""While-loop break""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -242,7 +242,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""While-loop statement""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""While-loop statement""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop statement"") (Syntax: '""While-loop statement""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -301,7 +301,7 @@ static void Main() IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw new E ... ever hit"");') IObjectCreationOperation (Constructor: System.Exception..ctor(System.String message)) (OperationKind.ObjectCreation, Type: System.Exception) (Syntax: 'new Excepti ... Never hit"")') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: System.String) (Syntax: '""Never hit""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: null) (Syntax: '""Never hit""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Never hit"") (Syntax: '""Never hit""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -315,7 +315,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""While-loop statement""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""While-loop statement""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop statement"") (Syntax: '""While-loop statement""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -364,18 +364,18 @@ static void Main() Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""While {0} {1}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""While {0} {1}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While {0} {1}"") (Syntax: '""While {0} {1}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: 'i') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'i') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: 'value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: 'value') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'value') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -687,7 +687,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -761,7 +761,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -771,7 +771,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -857,7 +857,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -867,7 +867,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -980,7 +980,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1168,11 +1168,11 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'f') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'f') ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Object) (Syntax: 'TakeOutPara ... out var x1)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'TakeOutPara ... out var x1)') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'TakeOutPara ... out var x1)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1180,7 +1180,7 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'f ? 1 : 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'f ? 1 : 2') IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') Condition: ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') @@ -1190,14 +1190,14 @@ static bool TakeOutParam(T y, out T x) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'out var x1') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var x1') ILocalReferenceOperation: x1 (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Object) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'x1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1212,7 +1212,7 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'x1') ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1265,11 +1265,11 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'f') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'f') ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Object) (Syntax: 'TakeOutPara ... out var x1)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'TakeOutPara ... out var x1)') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'TakeOutPara ... out var x1)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1277,7 +1277,7 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'f ? 1 : 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'f ? 1 : 2') IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') Condition: ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') @@ -1287,14 +1287,14 @@ static bool TakeOutParam(T y, out T x) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'out var x1') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var x1') ILocalReferenceOperation: x1 (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Object) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'x1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs index cfffdb5f8c5ea..40a0321cef4a9 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs @@ -499,7 +499,7 @@ Catch clauses(0) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 's') IParameterReferenceOperation: s (OperationKind.ParameterReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs index db484c70a8db5..f86a7526cdb63 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs @@ -2080,11 +2080,11 @@ static void Main() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: '42') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '42') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42, IsInvalid) (Syntax: '42') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: (System.Int32, System.Int32), IsInvalid) (Syntax: '(43, 44)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '(43, 44)') ITupleOperation (OperationKind.Tuple, Type: (System.Int32, System.Int32), IsInvalid) (Syntax: '(43, 44)') Elements(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43, IsInvalid) (Syntax: '43') @@ -2131,11 +2131,11 @@ static void Main() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2322,7 +2322,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: 'x1') ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32, IsInvalid) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2364,7 +2364,7 @@ static void M(int a) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: 'x1') ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32, IsInvalid) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3436,7 +3436,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out int x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'out int x1') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'int x1') ILocalReferenceOperation: x1 (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs index f6b0d8de44ec2..24b5a35138272 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs @@ -552,7 +552,7 @@ static void Main(S zero, S one) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: ''a'') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: ''a'') ILiteralOperation (OperationKind.Literal, Type: System.Char, Constant: a) (Syntax: ''a'') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -563,7 +563,7 @@ static void Main(S zero, S one) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: ''b'') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: ''b'') ILiteralOperation (OperationKind.Literal, Type: System.Char, Constant: b) (Syntax: ''b'') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -573,7 +573,7 @@ static void Main(S zero, S one) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: 'one ? 'g' : 'h'') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'one ? 'g' : 'h'') IConditionalOperation (OperationKind.Conditional, Type: System.Char) (Syntax: 'one ? 'g' : 'h'') Condition: IUnaryOperation (UnaryOperatorKind.True) (OperatorMethod: System.Boolean S.op_True(S s)) (OperationKind.UnaryOperator, Type: System.Boolean, IsImplicit) (Syntax: 'one') @@ -679,7 +679,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '+a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '+a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '+a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -694,7 +694,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '-a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '-a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '-a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -709,7 +709,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '~a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '~a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '~a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -724,7 +724,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '!a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '!a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '!a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -739,7 +739,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '+~!-a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '+~!-a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '+~!-a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -799,7 +799,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '++a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -814,7 +814,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a++') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -829,7 +829,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '--a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -844,7 +844,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a--') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -902,7 +902,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '++a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -917,7 +917,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a++') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -932,7 +932,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '--a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -947,7 +947,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a--') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -987,7 +987,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IIncrementOrDecrementOperation (Prefix) (OperationKind.Increment, Type: System.Int32) (Syntax: '++a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -999,7 +999,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'a++') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1011,7 +1011,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IIncrementOrDecrementOperation (Prefix) (OperationKind.Decrement, Type: System.Int32) (Syntax: '--a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1023,7 +1023,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IIncrementOrDecrementOperation (Postfix) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'a--') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1064,7 +1064,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IIncrementOrDecrementOperation (Prefix, Checked) (OperationKind.Increment, Type: System.Int32) (Syntax: '++a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1076,7 +1076,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IIncrementOrDecrementOperation (Postfix, Checked) (OperationKind.Increment, Type: System.Int32) (Syntax: 'a++') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1088,7 +1088,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IIncrementOrDecrementOperation (Prefix, Checked) (OperationKind.Decrement, Type: System.Int32) (Syntax: '--a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1100,7 +1100,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IIncrementOrDecrementOperation (Postfix, Checked) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'a--') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs index 1f586848c3264..8b7a7a9084275 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs @@ -57,14 +57,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i') @@ -123,19 +123,19 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'select i') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select i') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i') @@ -147,7 +147,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'q') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'q') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'q') @@ -204,14 +204,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i+1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i+1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i+1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i+1') @@ -272,14 +272,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i % 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i % 2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i % 2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i % 2') @@ -356,12 +356,12 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int i in c') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -370,7 +370,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i') @@ -426,12 +426,12 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int i in c') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -440,7 +440,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i < 5') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i < 5') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i < 5') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i < 5') @@ -509,21 +509,21 @@ join x2 in c2 on x1 equals x2/10 Instance Receiver: null Arguments(5): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x1 in c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c2 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1') @@ -533,7 +533,7 @@ join x2 in c2 on x1 equals x2/10 IOperation: (OperationKind.None, Type: null) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x2/10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x2/10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x2/10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x2/10') @@ -547,7 +547,7 @@ join x2 in c2 on x1 equals x2/10 ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x1+x2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1+x2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x1+x2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1+x2') @@ -613,19 +613,19 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Linq.IOrderedEnumerable, IsImplicit) (Syntax: 'i/10 descending') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i/10 descending') IInvocationOperation (System.Linq.IOrderedEnumerable System.Linq.Enumerable.OrderByDescending(this System.Collections.Generic.IEnumerable source, System.Func keySelector)) (OperationKind.Invocation, Type: System.Linq.IOrderedEnumerable, IsImplicit) (Syntax: 'i/10 descending') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i/10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i/10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i/10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i/10') @@ -641,7 +641,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i%10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i%10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i%10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i%10') @@ -712,21 +712,21 @@ join x2 in c2 on x1 equals x2 / 10 into g Instance Receiver: null Arguments(5): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x1 in c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c2 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1') @@ -736,7 +736,7 @@ join x2 in c2 on x1 equals x2 / 10 into g IOperation: (OperationKind.None, Type: null) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x2 / 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x2 / 10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x2 / 10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x2 / 10') @@ -750,7 +750,7 @@ join x2 in c2 on x1 equals x2 / 10 into g ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, System.String>, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, System.String>, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') @@ -823,14 +823,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x in c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c2') @@ -843,7 +843,7 @@ public static void Main(string[] args) ILocalReferenceOperation: c2 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x + y') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x + y') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + y') @@ -929,22 +929,22 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'let z = g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = g + x*100') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> System.Linq.Enumerable.Select<, <>h__TransparentIdentifier0, System.Int32 z>>(this System.Collections.Generic.IEnumerable<> source, System.Func<, <>h__TransparentIdentifier0, System.Int32 z>> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'let z = g + x*100') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let g = x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x * 10') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let g = x * 10') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int x in c1') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -953,7 +953,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x * 10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'x * 10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x * 10') @@ -962,11 +962,11 @@ public static void Main(string[] args) ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Int32 x, System.Int32 g)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'let g = x * 10') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'let g = x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x * 10') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'let g = x * 10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x * 10') IBinaryOperation (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x * 10') Left: IOperation: (OperationKind.None, Type: null) (Syntax: 'x') @@ -980,7 +980,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func<, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'g + x*100') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'g + x*100') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'g + x*100') @@ -989,11 +989,11 @@ public static void Main(string[] args) ReturnedValue: IObjectCreationOperation (Constructor: <>h__TransparentIdentifier0, System.Int32 z>..ctor( <>h__TransparentIdentifier0, System.Int32 z)) (OperationKind.ObjectCreation, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'let z = g + x*100') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: , IsImplicit) (Syntax: 'let z = g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = g + x*100') IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: , IsImplicit) (Syntax: 'let z = g + x*100') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'g + x*100') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'g + x*100') Left: IOperation: (OperationKind.None, Type: null) (Syntax: 'g') @@ -1011,7 +1011,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32>, IsImplicit) (Syntax: 'x + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32>, IsImplicit) (Syntax: 'x + z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + z') @@ -1090,32 +1090,32 @@ from int z in c3 Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'where (x + ... / 100) < 6') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'where (x + ... / 100) < 6') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> System.Linq.Enumerable.Where< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>(this System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> source, System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean> predicate)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'where (x + ... / 100) < 6') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'let g = x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x + y + z') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> System.Linq.Enumerable.Select< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>(this System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> source, System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'let g = x + y + z') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> System.Linq.Enumerable.SelectMany<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.Collections.Generic.IEnumerable> collectionSelector, System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>> resultSelector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.SelectMany>(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func> resultSelector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int x in c1') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1124,7 +1124,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c2') @@ -1135,7 +1135,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1144,7 +1144,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from int y in c2') @@ -1153,11 +1153,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'from int y in c2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: y (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1167,7 +1167,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c3') @@ -1178,7 +1178,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1187,7 +1187,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from int z in c3') @@ -1196,11 +1196,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: <>h__TransparentIdentifier0, System.Int32 z>..ctor( <>h__TransparentIdentifier0, System.Int32 z)) (OperationKind.ObjectCreation, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'from int z in c3') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: , IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: , IsImplicit) (Syntax: 'from int z in c3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IParameterReferenceOperation: z (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int z in c3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1210,7 +1210,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y + z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'x + y + z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + y + z') @@ -1219,11 +1219,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>..ctor( <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g)) (OperationKind.ObjectCreation, Type: <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, IsImplicit) (Syntax: 'let g = x + y + z') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier1) (OperationKind.Argument, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'let g = x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier1) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x + y + z') IParameterReferenceOperation: <>h__TransparentIdentifier1 (OperationKind.ParameterReference, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'let g = x + y + z') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y + z') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y + z') Left: IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y') @@ -1241,7 +1241,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean>, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean>, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') @@ -1273,7 +1273,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Int32>, IsImplicit) (Syntax: 'g') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'g') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Int32>, IsImplicit) (Syntax: 'g') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'g') @@ -1461,17 +1461,17 @@ from int z in c3 Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.SelectMany>(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func> resultSelector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int x in c1') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1480,7 +1480,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c2') @@ -1491,7 +1491,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1500,7 +1500,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from int y in c2') @@ -1509,11 +1509,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'from int y in c2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: y (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1523,7 +1523,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c3') @@ -1534,7 +1534,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1543,7 +1543,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func<, System.Int32, System.Int32>, IsImplicit) (Syntax: 'x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y + z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Int32, System.Int32>, IsImplicit) (Syntax: 'x + y + z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + y + z') @@ -1788,7 +1788,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'new int[] { 1 }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new int[] { 1 }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'new int[] { 1 }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1957,37 +1957,37 @@ join b in Enumerable.Range(1, 13) on 4 * a equals b Instance Receiver: null Arguments(5): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Range(System.Int32 start, System.Int32 count)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable) (Syntax: 'Enumerable.Range(1, 13)') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: System.Int32) (Syntax: '13') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: null) (Syntax: '13') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 13) (Syntax: '13') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Range(System.Int32 start, System.Int32 count)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable) (Syntax: 'Enumerable.Range(1, 13)') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: System.Int32) (Syntax: '13') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: null) (Syntax: '13') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 13) (Syntax: '13') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: '4 * a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '4 * a') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: '4 * a') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: '4 * a') @@ -2001,7 +2001,7 @@ join b in Enumerable.Range(1, 13) on 4 * a equals b IOperation: (OperationKind.None, Type: null) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'b') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'b') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'b') @@ -2011,7 +2011,7 @@ join b in Enumerable.Range(1, 13) on 4 * a equals b IOperation: (OperationKind.None, Type: null) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'a') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'a') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'a') @@ -2707,7 +2707,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsInvalid, IsImplicit) (Syntax: 'string.Empty') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'string.Empty') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsInvalid, IsImplicit) (Syntax: 'string.Empty') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -3537,7 +3537,7 @@ where x.ToString() == y.ToString() Instance Receiver: ILocalReferenceOperation: q (OperationKind.LocalReference, Type: Q) (Syntax: 'q') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'q') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'q') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'q') @@ -3547,7 +3547,7 @@ where x.ToString() == y.ToString() ILocalReferenceOperation: q (OperationKind.LocalReference, Type: Q) (Syntax: 'q') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f2) (OperationKind.Argument, Type: System.Func, y>>, IsImplicit) (Syntax: 'from y in q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f2) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from y in q') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, y>>, IsImplicit) (Syntax: 'from y in q') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from y in q') @@ -3556,11 +3556,11 @@ where x.ToString() == y.ToString() ReturnedValue: IObjectCreationOperation (Constructor: y>..ctor(System.Int32 x, Q y)) (OperationKind.ObjectCreation, Type: y>, IsImplicit) (Syntax: 'from y in q') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from y in q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from y in q') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from y in q') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: Q, IsImplicit) (Syntax: 'from y in q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from y in q') IParameterReferenceOperation: y (OperationKind.ParameterReference, Type: Q, IsImplicit) (Syntax: 'from y in q') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3569,7 +3569,7 @@ where x.ToString() == y.ToString() InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: System.Func< y>, System.Boolean>, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< y>, System.Boolean>, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') @@ -4056,7 +4056,7 @@ static void Main() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from a in new[] { 1 }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from a in new[] { 1 }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from a in new[] { 1 }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -4069,7 +4069,7 @@ Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') @@ -4119,14 +4119,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i + 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i + 1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i + 1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i + 1') @@ -4171,14 +4171,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i + 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i + 1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i + 1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i + 1') diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs index 22dfb26bf57ac..668f704eb3931 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs @@ -568,7 +568,7 @@ static void Test1(int x) Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'new { }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'new { }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new { }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs index b4a05c0052f99..aa92b7d16cc59 100644 --- a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs +++ b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs @@ -201,8 +201,8 @@ public LazyThrowExpression(Lazy expression, SemanticModel semanticMo /// internal abstract partial class BaseArgument : Operation, IArgumentOperation { - protected BaseArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(OperationKind.Argument, semanticModel, syntax, type, constantValue, isImplicit) + protected BaseArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(OperationKind.Argument, semanticModel, syntax, type: null, constantValue: constantValue, isImplicit: isImplicit) { ArgumentKind = argumentKind; Parameter = parameter; @@ -412,8 +412,8 @@ public LazyArrayElementReferenceExpression(Lazy arrayReference, Lazy /// internal abstract partial class BaseArrayInitializer : Operation, IArrayInitializerOperation { - protected BaseArrayInitializer(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(OperationKind.ArrayInitializer, semanticModel, syntax, type, constantValue, isImplicit) + protected BaseArrayInitializer(SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(OperationKind.ArrayInitializer, semanticModel, syntax, type: null, constantValue: constantValue, isImplicit: isImplicit) { } @@ -450,8 +450,8 @@ public override TResult Accept(OperationVisitor internal sealed partial class ArrayInitializer : BaseArrayInitializer, IArrayInitializerOperation { - public ArrayInitializer(ImmutableArray elementValues, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public ArrayInitializer(ImmutableArray elementValues, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(semanticModel, syntax, constantValue, isImplicit) { ElementValuesImpl = elementValues; } @@ -466,7 +466,7 @@ internal sealed partial class LazyArrayInitializer : BaseArrayInitializer, IArra { private readonly Lazy> _lazyElementValues; - public LazyArrayInitializer(Lazy> elementValues, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, type, constantValue, isImplicit) + public LazyArrayInitializer(Lazy> elementValues, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, constantValue, isImplicit) { _lazyElementValues = elementValues; } diff --git a/src/Compilers/Core/Portable/Operations/OperationCloner.cs b/src/Compilers/Core/Portable/Operations/OperationCloner.cs index c9ac85325de80..6b8fc2ba731f5 100644 --- a/src/Compilers/Core/Portable/Operations/OperationCloner.cs +++ b/src/Compilers/Core/Portable/Operations/OperationCloner.cs @@ -367,7 +367,7 @@ public override IOperation VisitArrayCreation(IArrayCreationOperation operation, public override IOperation VisitArrayInitializer(IArrayInitializerOperation operation, object argument) { - return new ArrayInitializer(VisitArray(operation.ElementValues), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new ArrayInitializer(VisitArray(operation.ElementValues), ((Operation)operation).SemanticModel, operation.Syntax, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitSimpleAssignment(ISimpleAssignmentOperation operation, object argument) diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb index 2bedf2ec5ee86..57c1d340c276d 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb @@ -6,8 +6,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Friend MustInherit Class BaseVisualBasicArgument Inherits BaseArgument - Protected Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean) - MyBase.New(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + Protected Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean) + MyBase.New(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) InConversionInternal = inConversion OutConversionInternal = outConversion @@ -33,8 +33,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Friend NotInheritable Class VisualBasicArgument Inherits BaseVisualBasicArgument - Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, value As IOperation, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean) - MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, type, constantValue, isImplicit) + Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, value As IOperation, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean) + MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, constantValue, isImplicit) Me.ValueImpl = value End Sub @@ -47,8 +47,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private ReadOnly _valueLazy As Lazy(Of IOperation) - Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, valueLazy As Lazy(Of IOperation), inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean) - MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, type, constantValue, isImplicit) + Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, valueLazy As Lazy(Of IOperation), inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean) + MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, constantValue, isImplicit) _valueLazy = valueLazy End Sub diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb index 3add6b9f9f15e..b794a68cebdc4 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb @@ -8,7 +8,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Public Shared ReadOnly Property Instance As OperationCloner = New VisualBasicOperationCloner() Public Overrides Function VisitArgument(operation As IArgumentOperation, argument As Object) As IOperation - Return New VisualBasicArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), operation.GetInConversion(), operation.GetOutConversion(), DirectCast(operation, Operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit) + Return New VisualBasicArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), operation.GetInConversion(), operation.GetOutConversion(), DirectCast(operation, Operation).SemanticModel, operation.Syntax, operation.ConstantValue, operation.IsImplicit) End Function Public Overrides Function VisitConversion(operation As IConversionOperation, argument As Object) As IOperation diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 8e06de18a3b4a..ddcc53f0bcec8 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -758,10 +758,9 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundArrayInitializationOperation(boundArrayInitialization As BoundArrayInitialization) As IArrayInitializerOperation Dim elementValues As Lazy(Of ImmutableArray(Of IOperation)) = New Lazy(Of ImmutableArray(Of IOperation))(Function() boundArrayInitialization.Initializers.SelectAsArray(Function(n) Create(n))) Dim syntax As SyntaxNode = boundArrayInitialization.Syntax - Dim type As ITypeSymbol = boundArrayInitialization.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundArrayInitialization.ConstantValueOpt) Dim isImplicit As Boolean = boundArrayInitialization.WasCompilerGenerated - Return New LazyArrayInitializer(elementValues, _semanticModel, syntax, type, constantValue, isImplicit) + Return New LazyArrayInitializer(elementValues, _semanticModel, syntax, constantValue, isImplicit) End Function Private Function CreateBoundPropertyAccessOperation(boundPropertyAccess As BoundPropertyAccess) As IPropertyReferenceOperation diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb index c6165d2b1a1f9..3548fa38b93b7 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb @@ -158,7 +158,6 @@ Namespace Microsoft.CodeAnalysis.Operations outConversion:=outConversion, semanticModel:=_semanticModel, syntax:=If(argument, value.Syntax), - type:=Nothing, constantValue:=Nothing, isImplicit:=isImplicit OrElse argument Is Nothing) End Function diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb index ef4a596d7a293..ce084928d76bd 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb @@ -27,7 +27,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String()) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '0') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.String()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -54,7 +54,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'New M() {}') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -86,7 +86,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'dimension') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -117,7 +117,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'dimension') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -153,7 +153,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'dimension') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -187,7 +187,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'DirectCast( ... n, Integer)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -211,7 +211,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String()) (Sy Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New String( ... ring.Empty}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.String()) (Syntax: '{String.Empty}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{String.Empty}') Element Values(1): IFieldReferenceOperation: System.String.Empty As System.String (Static) (OperationKind.FieldReference, Type: System.String) (Syntax: 'String.Empty') Instance Receiver: @@ -241,7 +241,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C()) (Syntax: 'New C Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{New C, Nothing}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{New C, Nothing}') Element Values(2): IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C') Arguments(0) @@ -276,7 +276,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: C(), IsInvalid) (Syntax: '{New C}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{New C}') Element Values(1): IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'New C') Arguments(0) @@ -316,7 +316,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(), IsIn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'x(0)') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsInvalid) (Syntax: '{1, 2}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{1, 2}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsInvalid) (Syntax: '2') @@ -349,7 +349,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New M() {New M}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{New M}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{New M}') Element Values(1): IObjectCreationOperation (Constructor: Sub M..ctor()) (OperationKind.ObjectCreation, Type: M) (Syntax: 'New M') Arguments(0) @@ -481,7 +481,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Byte(,,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Byte(,,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -507,7 +507,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Byte(,,)) (Sy ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Byte(,, ... {4, 5, 6}}}') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: 'New Byte(,, ... {4, 5, 6}}}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Byte(,,)) (Syntax: '{{{1, 2, 3} ... {4, 5, 6}}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{{{1, 2, 3} ... {4, 5, 6}}}') Element Values(2): IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{{1, 2, 3}}') Element Values(1): @@ -603,7 +603,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32()(,)) ( Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '0') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32()(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -643,7 +643,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'x(1)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -675,7 +675,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -707,7 +707,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{}}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{}}') Element Values(1): IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{}') Element Values(0) @@ -748,7 +748,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{}, {}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{}, {}}') Element Values(2): IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{}') Element Values(0) @@ -791,7 +791,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{1, 2}}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{1, 2}}') Element Values(1): IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{1, 2}') Element Values(2): @@ -831,7 +831,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{1, 2}, {}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{1, 2}, {}}') Element Values(2): IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): @@ -873,7 +873,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,)) (Syntax: '{{1, 2}, {1, 2}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{{1, 2}, {1, 2}}') Element Values(2): IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): @@ -957,7 +957,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String(,), Is Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.String(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -984,7 +984,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'New C() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: C(), IsInvalid) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{1}') Element Values(1): IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: C, IsInvalid, IsImplicit) (Syntax: '1') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1022,7 +1022,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'c') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1060,7 +1060,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C()) (Syntax: 'New C Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M()') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1098,7 +1098,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C()) (Syntax: 'New C Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'DirectCast(M(), Integer)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1136,7 +1136,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'M()') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1178,7 +1178,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'DirectCast(M(), Integer)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1245,7 +1245,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String(), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '0.0') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.String()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb index ff1eb65d5367f..a9c898702e47e 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb @@ -616,7 +616,7 @@ IInvocationOperation ( Sub P.M2(x As System.Int32, ParamArray y As System.Int32( Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(1, 2, 3)') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(1, 2, 3)') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(1, 2, 3)') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -659,7 +659,7 @@ IInvocationOperation ( Sub P.M2(x As System.Int32, ParamArray y As System.Int32( Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(1)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(1)') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(1)') Element Values(0) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1186,7 +1186,7 @@ IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(1)') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(1)') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(1)') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1222,7 +1222,7 @@ IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(0, 1)') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(0, 1)') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(0, 1)') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') @@ -1365,7 +1365,7 @@ IObjectCreationOperation (Constructor: Sub Program..ctor(ParamArray a As System. Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'Program') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'Program') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'Program') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1399,7 +1399,7 @@ IObjectCreationOperation (Constructor: Sub Program..ctor(ParamArray a As System. Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'Program') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'Program') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'Program') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb index 6cb89696a0c50..4cdf3c133e4e8 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb @@ -1430,7 +1430,7 @@ IVariableDeclarationsOperation (1 declarations) (OperationKind.VariableDeclarati Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1469,7 +1469,7 @@ IVariableDeclarationsOperation (1 declarations) (OperationKind.VariableDeclarati Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32()()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1975,7 +1975,7 @@ IVariableDeclarationsOperation (1 declarations) (OperationKind.VariableDeclarati Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Char()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb index 53ba9b2f23ea8..526784f3615c2 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb @@ -157,7 +157,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {x}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{x}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{x}') Element Values(1): IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') Arguments(0) diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidExpression.vb index d8b818a3fe07c..05e5cc8c1ae98 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidExpression.vb @@ -409,7 +409,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: X(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'Program - 1') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: X(), IsInvalid) (Syntax: '{{1}}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{1}}') Element Values(1): IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: '{1}') Children(0) diff --git a/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb b/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb index dcf792e3b3693..2fb3e4d325183 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb @@ -5603,7 +5603,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(1): @@ -5663,7 +5663,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(1): @@ -5754,7 +5754,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {3}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') Arguments(1): @@ -7368,7 +7368,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -7381,7 +7381,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -7460,7 +7460,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -7472,7 +7472,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -7524,7 +7524,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {4, 5}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{4, 5}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{4, 5}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 5) (Syntax: '5') @@ -8701,7 +8701,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -8772,7 +8772,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -8849,7 +8849,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -8933,7 +8933,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -9063,7 +9063,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 2}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -9115,7 +9115,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 2}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -9749,7 +9749,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -9762,7 +9762,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -9849,7 +9849,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -9861,7 +9861,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -9913,7 +9913,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {4, 5}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{4, 5}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{4, 5}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 5) (Syntax: '5') @@ -10025,7 +10025,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -10041,7 +10041,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -10053,7 +10053,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -10100,7 +10100,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11273,7 +11273,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {3, 4}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3, 4}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3, 4}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') @@ -11377,7 +11377,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {3, 4}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3, 4}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3, 4}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') @@ -11396,7 +11396,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -11496,7 +11496,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(2): @@ -11514,7 +11514,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {2}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11547,7 +11547,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {3}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11629,7 +11629,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {3, 4}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3, 4}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3, 4}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') @@ -11690,7 +11690,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(2): @@ -11708,7 +11708,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {2}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11741,7 +11741,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {3}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) From ab63bff37fddf2439d605e7b0d3e0499a27aac49 Mon Sep 17 00:00:00 2001 From: Vladimir Sadov Date: Fri, 3 Nov 2017 12:07:35 -0700 Subject: [PATCH 10/28] Enable peverify-compat mode for langver < 7.2 (#22772) --- .../CSharp/Portable/CodeGen/CodeGenerator.cs | 2 +- .../CSharp/Portable/CodeGen/EmitAddress.cs | 75 ++++--- .../CSharp/Portable/CodeGen/EmitExpression.cs | 67 +++--- .../CSharp/Portable/CodeGen/EmitStatement.cs | 5 +- .../LocalRewriter/LocalRewriter_Call.cs | 2 +- .../LocalRewriter_FixedStatement.cs | 6 +- .../Lowering/SyntheticBoundNodeFactory.cs | 2 +- .../Emit/CodeGen/CodeGenInParametersTests.cs | 195 ++++++++++++++++++ .../CodeGen/CodeGenRefReadonlyReturnTests.cs | 88 ++++---- .../CSharp/Test/Emit/CodeGen/CodeGenTests.cs | 34 ++- 10 files changed, 360 insertions(+), 116 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs b/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs index 24a1bb6495f95..281c9821afef6 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs @@ -139,7 +139,7 @@ private bool IsDebugPlus() private bool EnablePEVerifyCompat() { - return _module.Compilation.FeaturePEVerifyCompatEnabled; + return _module.Compilation.LanguageVersion < LanguageVersion.CSharp7_2 || _module.Compilation.FeaturePEVerifyCompatEnabled; } private LocalDefinition LazyReturnTemp diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs index f8005387d987e..ae3699e0e44e3 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs @@ -24,8 +24,14 @@ private enum AddressKind // reference itself will not be written to, nor it will be used to modify fields. ReadOnly, + + // same as ReadOnly, but we are not supposed to get a reference to a clone + // regardless of compat settings. + ReadOnlyStrict, } + private static bool IsReadOnly(AddressKind addressKind) => addressKind >= AddressKind.ReadOnly; + /// /// Emits address as in & /// @@ -70,7 +76,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr case BoundKind.ThisReference: Debug.Assert(expression.Type.IsValueType, "only value types may need a ref to this"); - Debug.Assert(HasHome(expression, addressKind == AddressKind.Writeable)); + Debug.Assert(HasHome(expression, addressKind)); _builder.EmitOpCode(ILOpCode.Ldarg_0); break; @@ -101,7 +107,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr var methodRefKind = call.Method.RefKind; if (methodRefKind == RefKind.Ref || - (addressKind == AddressKind.ReadOnly && methodRefKind == RefKind.RefReadOnly)) + (IsReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly)) { EmitCallExpression(call, UseKind.UsedAsAddress); break; @@ -121,7 +127,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr case BoundKind.ConditionalOperator: var conditional = (BoundConditionalOperator)expression; - if (!HasHome(conditional, addressKind != AddressKind.ReadOnly)) + if (!HasHome(conditional, addressKind)) { goto default; } @@ -144,7 +150,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr return null; default: - Debug.Assert(!HasHome(expression, addressKind != AddressKind.ReadOnly)); + Debug.Assert(!HasHome(expression, addressKind)); return EmitAddressOfTempClone(expression); } @@ -218,7 +224,7 @@ private LocalDefinition EmitLocalAddress(BoundLocal localAccess, AddressKind add { var local = localAccess.LocalSymbol; - if (!HasHome(localAccess, needWriteable: addressKind != AddressKind.ReadOnly)) + if (!HasHome(localAccess, addressKind)) { return EmitAddressOfTempClone(localAccess); } @@ -249,7 +255,7 @@ private LocalDefinition EmitLocalAddress(BoundLocal localAccess, AddressKind add /// private LocalDefinition EmitDupAddress(BoundDup dup, AddressKind addressKind) { - if (!HasHome(dup, needWriteable: addressKind != AddressKind.ReadOnly)) + if (!HasHome(dup, addressKind)) { return EmitAddressOfTempClone(dup); } @@ -339,7 +345,7 @@ private LocalSymbol DigForValueLocal(BoundSequence topSequence, BoundExpression /// Checks if expression directly or indirectly represents a value with its own home. In /// such cases it is possible to get a reference without loading into a temporary. /// - private bool HasHome(BoundExpression expression, bool needWriteable) + private bool HasHome(BoundExpression expression, AddressKind addressKind) { switch (expression.Kind) { @@ -352,10 +358,11 @@ private bool HasHome(BoundExpression expression, bool needWriteable) case BoundKind.ThisReference: Debug.Assert(expression.Type.IsValueType); - if (needWriteable && expression.Type.IsReadOnly) + if (!IsReadOnly(addressKind) && expression.Type.IsReadOnly) { return _method.MethodKind == MethodKind.Constructor; } + return true; case BoundKind.ThrowExpression: @@ -363,7 +370,7 @@ private bool HasHome(BoundExpression expression, bool needWriteable) return true; case BoundKind.Parameter: - return !needWriteable || + return IsReadOnly(addressKind) || ((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.In; case BoundKind.Local: @@ -371,31 +378,31 @@ private bool HasHome(BoundExpression expression, bool needWriteable) // locals in a mutating call var local = ((BoundLocal)expression).LocalSymbol; return !((IsStackLocal(local) && local.RefKind == RefKind.None) || - (needWriteable && local.RefKind == RefKind.RefReadOnly)); + (!IsReadOnly(addressKind) && local.RefKind == RefKind.RefReadOnly)); case BoundKind.Call: var methodRefKind = ((BoundCall)expression).Method.RefKind; return methodRefKind == RefKind.Ref || - (!needWriteable && methodRefKind == RefKind.RefReadOnly); + (IsReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); case BoundKind.Dup: //NB: Dup represents locals that do not need IL slot var dupRefKind = ((BoundDup)expression).RefKind; return dupRefKind == RefKind.Ref || - (!needWriteable && dupRefKind == RefKind.RefReadOnly); + (IsReadOnly(addressKind) && dupRefKind == RefKind.RefReadOnly); case BoundKind.FieldAccess: - return HasHome((BoundFieldAccess)expression, needWriteable); + return HasHome((BoundFieldAccess)expression, addressKind); case BoundKind.Sequence: - return HasHome(((BoundSequence)expression).Value, needWriteable); + return HasHome(((BoundSequence)expression).Value, addressKind); case BoundKind.AssignmentOperator: return ((BoundAssignmentOperator)expression).RefKind != RefKind.None; case BoundKind.ComplexConditionalReceiver: - Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ValueTypeReceiver, needWriteable)); - Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ReferenceTypeReceiver, needWriteable)); + Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ValueTypeReceiver, addressKind)); + Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ReferenceTypeReceiver, addressKind)); goto case BoundKind.ConditionalReceiver; case BoundKind.ConditionalReceiver: @@ -415,7 +422,7 @@ private bool HasHome(BoundExpression expression, bool needWriteable) // branch that has no home will need a temporary // if both have no home, just say whole expression has no home // so we could just use one temp for the whole thing - return HasHome(ternary.Consequence, needWriteable) && HasHome(ternary.Alternative, needWriteable); + return HasHome(ternary.Consequence, addressKind) && HasHome(ternary.Alternative, addressKind); default: return false; @@ -427,7 +434,7 @@ private bool HasHome(BoundExpression expression, bool needWriteable) /// Fields have readable homes when they are not constants. /// Fields have writeable homes unless they are readonly and used outside of the constructor. /// - private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) + private bool HasHome(BoundFieldAccess fieldAccess, AddressKind addressKind) { FieldSymbol field = fieldAccess.FieldSymbol; @@ -437,7 +444,14 @@ private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) return false; } - if (!needWriteable && !EnablePEVerifyCompat()) + // in readonly situations where ref to a copy is not allowed, consider fields as addressable + if (addressKind == AddressKind.ReadOnlyStrict) + { + return true; + } + + // ReadOnly references can always be taken unless we are in peverify compat mode + if (addressKind == AddressKind.ReadOnly && !EnablePEVerifyCompat()) { return true; } @@ -456,7 +470,7 @@ private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) // we would not be able to dig for the inner field using references and the outer struct will have to be copied to a temp anyways. if (!EnablePEVerifyCompat()) { - Debug.Assert(needWriteable == true); + Debug.Assert(!IsReadOnly(addressKind)); var receiver = fieldAccess.ReceiverOpt; if (receiver?.Type.IsValueType == true) @@ -466,8 +480,8 @@ private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) // has readable home -> return false - we need to copy the field // otherwise -> return true - the copy will be made at higher level so the leaf field can have writeable home - return HasHome(receiver, needWriteable: true) || - !HasHome(receiver, needWriteable: false); + return HasHome(receiver, addressKind) || + !HasHome(receiver, AddressKind.ReadOnly); } } @@ -534,7 +548,7 @@ private LocalDefinition EmitFieldAddress(BoundFieldAccess fieldAccess, AddressKi { FieldSymbol field = fieldAccess.FieldSymbol; - if (!HasHome(fieldAccess, addressKind != AddressKind.ReadOnly)) + if (!HasHome(fieldAccess, addressKind)) { // accessing a field that is not writable (const or readonly) return EmitAddressOfTempClone(fieldAccess); @@ -546,11 +560,7 @@ private LocalDefinition EmitFieldAddress(BoundFieldAccess fieldAccess, AddressKi } else { - //NOTE: we are not propagating AddressKind here. - // the reason is that while Constrained permits calls, it does not permit - // taking field addresses, so we have to turn Constrained into writeable. - // It is less error prone to just pass a bool "isReadonly" - return EmitInstanceFieldAddress(fieldAccess, isReadonly: addressKind == AddressKind.ReadOnly); + return EmitInstanceFieldAddress(fieldAccess, addressKind); } } @@ -564,7 +574,7 @@ private LocalDefinition EmitParameterAddress(BoundParameter parameter, AddressKi { ParameterSymbol parameterSymbol = parameter.ParameterSymbol; - if (!HasHome(parameter, needWriteable: addressKind != AddressKind.ReadOnly)) + if (!HasHome(parameter, addressKind)) { // accessing a parameter that is not writable return EmitAddressOfTempClone(parameter); @@ -634,11 +644,14 @@ private LocalDefinition EmitReceiverRef(BoundExpression receiver, AddressKind ad /// /// May introduce a temp which it will return. (otherwise returns null) /// - private LocalDefinition EmitInstanceFieldAddress(BoundFieldAccess fieldAccess, bool isReadonly) + private LocalDefinition EmitInstanceFieldAddress(BoundFieldAccess fieldAccess, AddressKind addressKind) { var field = fieldAccess.FieldSymbol; - var tempOpt = EmitReceiverRef(fieldAccess.ReceiverOpt, isReadonly? AddressKind.ReadOnly: AddressKind.Writeable); + //NOTE: we are not propagating AddressKind.Constrained here. + // the reason is that while Constrained permits calls, it does not permit + // taking field addresses, so we have to turn Constrained into writeable. + var tempOpt = EmitReceiverRef(fieldAccess.ReceiverOpt, addressKind == AddressKind.Constrained ? AddressKind.Writeable : addressKind); _builder.EmitOpCode(ILOpCode.Ldflda); EmitSymbolToken(field, fieldAccess.Syntax); diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs index 4b2d5e8081c0b..d8fb3dc7b6c08 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs @@ -426,10 +426,7 @@ private void EmitLoweredConditionalAccessExpression(BoundLoweredConditionalAcces { // this does not need to be writeable // we may call "HasValue" on this, but it is not mutating - // (however verification does not know that and considers all calls mutating) - var addressKind = EnablePEVerifyCompat()? - AddressKind.Writeable: - AddressKind.ReadOnly; + var addressKind = AddressKind.ReadOnly; receiverTemp = EmitReceiverRef(receiver, addressKind); _builder.EmitOpCode(ILOpCode.Dup); @@ -605,7 +602,9 @@ private void EmitArgument(BoundExpression argument, RefKind refKind) break; default: - var unexpectedTemp = EmitAddress(argument, AddressKind.Writeable); + // NOTE: passing "ReadOnlyStrict" here. + // we should not get an address of a copy if at all possible + var unexpectedTemp = EmitAddress(argument, refKind == RefKindExtensions.StrictIn? AddressKind.ReadOnlyStrict: AddressKind.Writeable); if (unexpectedTemp != null) { // interestingly enough "ref dynamic" sometimes is passed via a clone @@ -619,8 +618,11 @@ private void EmitArgument(BoundExpression argument, RefKind refKind) private void EmitAddressOfExpression(BoundAddressOfOperator expression, bool used) { - var temp = EmitAddress(expression.Operand, AddressKind.Writeable); + // NOTE: passing "ReadOnlyStrict" here. + // we should not get an address of a copy if at all possible + var temp = EmitAddress(expression.Operand, AddressKind.ReadOnlyStrict); Debug.Assert(temp == null, "If the operand is addressable, then a temp shouldn't be required."); + if (used) { // When computing an address to be used to initialize a fixed-statement variable, we have to be careful @@ -811,15 +813,32 @@ private void EmitSideEffects(BoundSequence sequence) } } - private void EmitArguments(ImmutableArray arguments, ImmutableArray parameters) + private void EmitArguments(ImmutableArray arguments, ImmutableArray parameters, ImmutableArray refKindsOpt) { // We might have an extra argument for the __arglist() of a varargs method. Debug.Assert(arguments.Length == parameters.Length || arguments.Length == parameters.Length + 1, "argument count must match parameter count"); for (int i = 0; i < arguments.Length; i++) { - BoundExpression argument = arguments[i]; - RefKind refKind = (i == parameters.Length) ? RefKind.None : parameters[i].RefKind; - EmitArgument(argument, refKind); + RefKind refKind; + + if (!refKindsOpt.IsDefault && i < refKindsOpt.Length) + { + // if we have an explicit refKind for the given argument, use that + refKind = refKindsOpt[i]; + } + else if (i < parameters.Length) + { + // otherwise check the parameter + refKind = parameters[i].RefKind; + } + else + { + // vararg case + Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); + refKind = RefKind.None; + } + + EmitArgument(arguments[i], refKind); } } @@ -1068,7 +1087,7 @@ private bool FieldLoadPrefersRef(BoundExpression receiver) } // can we take address at all? - if (!HasHome(receiver, needWriteable: false)) + if (!HasHome(receiver, AddressKind.ReadOnly)) { return false; } @@ -1491,13 +1510,8 @@ private void EmitCallExpression(BoundCall call, UseKind useKind) if (method.IsMetadataVirtual()) { // NB: all methods that a struct could inherit from bases are non-mutating - // we are passing here "Writeable" just to keep verifier happy - // we can pass here "ReadOnly" and avoid unnecessary copy - var addressKind = EnablePEVerifyCompat() ? - AddressKind.Writeable : - AddressKind.ReadOnly; - - tempOpt = EmitReceiverRef(receiver, addressKind); + // treat receiver as ReadOnly + tempOpt = EmitReceiverRef(receiver, AddressKind.ReadOnly); callKind = CallKind.ConstrainedCallVirt; } else @@ -1569,7 +1583,7 @@ private void EmitCallExpression(BoundCall call, UseKind useKind) } } - EmitArguments(arguments, method.Parameters); + EmitArguments(arguments, method.Parameters, call.ArgumentRefKindsOpt); int stackBehavior = GetCallStackBehavior(call); switch (callKind) { @@ -1861,7 +1875,7 @@ private void EmitObjectCreationExpression(BoundObjectCreationExpression expressi } else { - EmitArguments(expression.Arguments, constructor.Parameters); + EmitArguments(expression.Arguments, constructor.Parameters, expression.ArgumentRefKindsOpt); var stackAdjustment = GetObjCreationStackBehavior(expression); _builder.EmitOpCode(ILOpCode.Newobj, stackAdjustment); @@ -2033,7 +2047,7 @@ private bool TryEmitAssignmentInPlace(BoundAssignmentOperator assignmentOperator private bool SafeToGetWriteableReference(BoundExpression left) { - if (!HasHome(left, needWriteable: true)) + if (!HasHome(left, AddressKind.Writeable)) { return false; } @@ -2079,7 +2093,7 @@ private void InPlaceCtorCall(BoundExpression target, BoundObjectCreationExpressi Debug.Assert(temp == null, "in-place ctor target should not create temps"); var constructor = objCreation.Constructor; - EmitArguments(objCreation.Arguments, constructor.Parameters); + EmitArguments(objCreation.Arguments, constructor.Parameters, objCreation.ArgumentRefKindsOpt); // -2 to adjust for consumed target address and not produced value. var stackAdjustment = GetObjCreationStackBehavior(objCreation) - 2; _builder.EmitOpCode(ILOpCode.Call, stackAdjustment); @@ -2335,10 +2349,11 @@ private void EmitAssignmentValue(BoundAssignmentOperator assignmentOperator) else { int exprTempsBefore = _expressionTemps?.Count ?? 0; + var local = ((BoundLocal)assignmentOperator.Left).LocalSymbol; - // NOTE: passing "ReadOnly" here. Assuming we do not have compile errors, - // We should not get an address of a copy, even if the RHS is readonly - LocalDefinition temp = EmitAddress(assignmentOperator.Right, AddressKind.ReadOnly); + // NOTE: passing "ReadOnlyStrict" here. + // we should not get an address of a copy if at all possible + LocalDefinition temp = EmitAddress(assignmentOperator.Right, local.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); // Generally taking a ref for the purpose of ref assignment should not be done on homeless values // however, there are very rare cases when we need to get a ref off a temp in synthetic code. @@ -2346,7 +2361,7 @@ private void EmitAssignmentValue(BoundAssignmentOperator assignmentOperator) AddExpressionTemp(temp); // are we, by the way, ref-assigning to something that lives longer than encompassing expression? - if (((BoundLocal)assignmentOperator.Left).LocalSymbol.SynthesizedKind.IsLongLived()) + if (local.SynthesizedKind.IsLongLived()) { var exprTempsAfter = _expressionTemps?.Count ?? 0; diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs index 8deaf3a611613..14d524131c082 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs @@ -724,7 +724,10 @@ private void EmitReturnStatement(BoundReturnStatement boundReturnStatement) } else { - this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly? AddressKind.ReadOnly: AddressKind.Writeable); + // NOTE: passing "ReadOnlyStrict" here. + // we should never return an address of a copy + var unexpectedTemp = this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); + Debug.Assert(unexpectedTemp == null, "ref-returning a temp?"); } if (ShouldUseIndirectReturn()) diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs index 1b8acb8535ab2..99f1676844f01 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs @@ -718,7 +718,6 @@ private void BuildStoresToTemps( if (IsSafeForReordering(argument, argRefKind)) { arguments[p] = argument; - refKinds[p] = argRefKind; } else { @@ -727,6 +726,7 @@ private void BuildStoresToTemps( storesToTemps.Add(assignment); arguments[p] = temp; } + refKinds[p] = argRefKind; } } diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs index ffbe7952cfe6c..7c58d45739225 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs @@ -254,8 +254,10 @@ private BoundStatement InitializeFixedStatementRegularLocal( pinnedTemp = factory.SynthesizedLocal( initializerType, syntax: declarator, - isPinned: true, - refKind: RefKind.Ref, // different from the array and string cases + isPinned: true, + //NOTE: different from the array and string cases + // RefReadOnly to allow referring to readonly variables. (technically we only "read" through the temp anyways) + refKind: RefKind.RefReadOnly, kind: SynthesizedLocalKind.FixedReference); // NOTE: we pin the reference, not the pointer. diff --git a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs index 896e5f0138342..43326ce97bc4c 100644 --- a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs +++ b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs @@ -1269,7 +1269,7 @@ public BoundLocal StoreToTemp( #endif ) { - if (refKind == RefKind.Out || refKind == RefKind.In) + if (refKind == RefKind.Out) { refKind = RefKind.Ref; } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs index 7b3a68a01d894..15cd74fd53b42 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs @@ -233,6 +233,64 @@ .locals init (int V_0) } + [Fact] + [CompilerTrait(CompilerFeature.PEVerifyCompat)] + public void InParamPassRoField1() + { + var text = @" +class Program +{ + public static readonly int F = 42; + + public static void Main() + { + System.Console.WriteLine(M(in F)); + } + + static ref readonly int M(in int x) + { + return ref x; + } +} +"; + + var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular, verify: false, expectedOutput: "42"); + + comp.VerifyIL("Program.Main()", @" +{ + // Code size 17 (0x11) + .maxstack 1 + IL_0000: ldsflda ""int Program.F"" + IL_0005: call ""ref readonly int Program.M(in int)"" + IL_000a: ldind.i4 + IL_000b: call ""void System.Console.WriteLine(int)"" + IL_0010: ret +}"); + + + comp.VerifyIL("Program.M(in int)", @" +{ + // Code size 2 (0x2) + .maxstack 1 + IL_0000: ldarg.0 + IL_0001: ret +}"); + + comp = CompileAndVerify(text, verify: false, expectedOutput: "42", parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature()); + + comp.VerifyIL("Program.Main()", @" +{ + // Code size 17 (0x11) + .maxstack 1 + IL_0000: ldsflda ""int Program.F"" + IL_0005: call ""ref readonly int Program.M(in int)"" + IL_000a: ldind.i4 + IL_000b: call ""void System.Console.WriteLine(int)"" + IL_0010: ret +}"); + + } + [Fact] public void InParamPassRoParamReturn() { @@ -798,6 +856,143 @@ public static void M1(in int arg1, in int arg2, in int arg3) ); } + [Fact] + public void ReadonlyParamAsyncSpillInRoField() + { + var text = @" + using System.Threading.Tasks; + + class Program + { + public static readonly int F = 5; + + static void Main(string[] args) + { + Test().Wait(); + } + + public static async Task Test() + { + int local = 1; + M1(in F, await GetT(2), 3); + } + + public static async Task GetT(T val) + { + await Task.Yield(); + MutateReadonlyField(); + return val; + } + + private static unsafe void MutateReadonlyField() + { + fixed(int* ptr = &F) + { + *ptr = 42; + } + } + + public static void M1(in int arg1, in int arg2, in int arg3) + { + System.Console.WriteLine(arg1 + arg2 + arg3); + } + } + +"; + + var comp = CreateCompilationWithMscorlib46(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseExe); + var result = CompileAndVerify(comp, verify: false, expectedOutput: @"47"); + + var expectedIL = @" +{ + // Code size 162 (0xa2) + .maxstack 3 + .locals init (int V_0, + int V_1, + System.Runtime.CompilerServices.TaskAwaiter V_2, + int V_3, + System.Exception V_4) + IL_0000: ldarg.0 + IL_0001: ldfld ""int Program.d__2.<>1__state"" + IL_0006: stloc.0 + .try + { + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_003f + IL_000a: ldc.i4.2 + IL_000b: call ""System.Threading.Tasks.Task Program.GetT(int)"" + IL_0010: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()"" + IL_0015: stloc.2 + IL_0016: ldloca.s V_2 + IL_0018: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get"" + IL_001d: brtrue.s IL_005b + IL_001f: ldarg.0 + IL_0020: ldc.i4.0 + IL_0021: dup + IL_0022: stloc.0 + IL_0023: stfld ""int Program.d__2.<>1__state"" + IL_0028: ldarg.0 + IL_0029: ldloc.2 + IL_002a: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1"" + IL_002f: ldarg.0 + IL_0030: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.d__2.<>t__builder"" + IL_0035: ldloca.s V_2 + IL_0037: ldarg.0 + IL_0038: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted, Program.d__2>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.d__2)"" + IL_003d: leave.s IL_00a1 + IL_003f: ldarg.0 + IL_0040: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1"" + IL_0045: stloc.2 + IL_0046: ldarg.0 + IL_0047: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1"" + IL_004c: initobj ""System.Runtime.CompilerServices.TaskAwaiter"" + IL_0052: ldarg.0 + IL_0053: ldc.i4.m1 + IL_0054: dup + IL_0055: stloc.0 + IL_0056: stfld ""int Program.d__2.<>1__state"" + IL_005b: ldloca.s V_2 + IL_005d: call ""int System.Runtime.CompilerServices.TaskAwaiter.GetResult()"" + IL_0062: stloc.1 + IL_0063: ldsflda ""int Program.F"" + IL_0068: ldloca.s V_1 + IL_006a: ldc.i4.3 + IL_006b: stloc.3 + IL_006c: ldloca.s V_3 + IL_006e: call ""void Program.M1(in int, in int, in int)"" + IL_0073: leave.s IL_008e + } + catch System.Exception + { + IL_0075: stloc.s V_4 + IL_0077: ldarg.0 + IL_0078: ldc.i4.s -2 + IL_007a: stfld ""int Program.d__2.<>1__state"" + IL_007f: ldarg.0 + IL_0080: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.d__2.<>t__builder"" + IL_0085: ldloc.s V_4 + IL_0087: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)"" + IL_008c: leave.s IL_00a1 + } + IL_008e: ldarg.0 + IL_008f: ldc.i4.s -2 + IL_0091: stfld ""int Program.d__2.<>1__state"" + IL_0096: ldarg.0 + IL_0097: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.d__2.<>t__builder"" + IL_009c: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()"" + IL_00a1: ret +} +"; + + result.VerifyIL("Program.d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", expectedIL); + + comp = CreateCompilationWithMscorlib46(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseExe, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature()); + result = CompileAndVerify(comp, verify: false, expectedOutput: @"47"); + + result.VerifyIL("Program.d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", expectedIL); + + } + [Fact] public void InParamAsyncSpill2() { diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs index eb182c51d140d..c00ebfae00b48 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs @@ -54,35 +54,30 @@ ref readonly S M() } }"; - var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature()); + // WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref assignments + var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: false); comp.VerifyIL("C.M", @" { - // Code size 65 (0x41) + // Code size 59 (0x3b) .maxstack 2 - .locals init (S V_0, - S V_1, - S2 V_2) + .locals init (S V_0) IL_0000: ldsflda ""S C.s1"" IL_0005: dup IL_0006: ldobj ""S"" IL_000b: stloc.0 IL_000c: ldloca.s V_0 IL_000e: call ""void S.AddOne()"" - IL_0013: ldsfld ""S C.s2"" - IL_0018: stloc.0 - IL_0019: ldloca.s V_0 - IL_001b: ldobj ""S"" - IL_0020: stloc.1 - IL_0021: ldloca.s V_1 - IL_0023: call ""void S.AddOne()"" - IL_0028: ldsflda ""S2 C.s3"" - IL_002d: call ""void S2.AddOne()"" - IL_0032: ldarg.0 - IL_0033: ldfld ""S2 C.s4"" - IL_0038: stloc.2 - IL_0039: ldloca.s V_2 - IL_003b: call ""void S2.AddOne()"" - IL_0040: ret + IL_0013: ldsflda ""S C.s2"" + IL_0018: ldobj ""S"" + IL_001d: stloc.0 + IL_001e: ldloca.s V_0 + IL_0020: call ""void S.AddOne()"" + IL_0025: ldsflda ""S2 C.s3"" + IL_002a: call ""void S2.AddOne()"" + IL_002f: ldarg.0 + IL_0030: ldflda ""S2 C.s4"" + IL_0035: call ""void S2.AddOne()"" + IL_003a: ret }"); comp = CompileAndVerify(source, verify: false); @@ -864,47 +859,36 @@ .locals init (bool V_0) //b IL_0033: ldflda ""int System.ValueTuple.Item1"" IL_0038: ret }"); - comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: false); + // WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref returns + comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: false); comp.VerifyIL("Program.Test", @" { - // Code size 70 (0x46) + // Code size 57 (0x39) .maxstack 1 - .locals init (bool V_0, //b - int V_1, - System.ValueTuple V_2, - int V_3, - System.ValueTuple V_4) + .locals init (bool V_0) //b IL_0000: ldc.i4.1 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: brfalse.s IL_0020 + IL_0003: brfalse.s IL_001a IL_0005: ldloc.0 - IL_0006: brfalse.s IL_0012 + IL_0006: brfalse.s IL_000f IL_0008: ldarg.0 - IL_0009: ldfld ""int Program.F"" - IL_000e: stloc.1 - IL_000f: ldloca.s V_1 - IL_0011: ret - IL_0012: ldsfld ""(int Alice, int Bob) Program.F1"" - IL_0017: stloc.2 - IL_0018: ldloca.s V_2 - IL_001a: ldflda ""int System.ValueTuple.Item1"" - IL_001f: ret - IL_0020: ldloc.0 - IL_0021: brfalse.s IL_0032 - IL_0023: ldarg.0 - IL_0024: ldfld ""Program.S Program.S1"" - IL_0029: ldfld ""int Program.S.F"" - IL_002e: stloc.3 - IL_002f: ldloca.s V_3 - IL_0031: ret - IL_0032: ldsfld ""Program.S Program.S2"" - IL_0037: ldfld ""(int Alice, int Bob) Program.S.F1"" - IL_003c: stloc.s V_4 - IL_003e: ldloca.s V_4 - IL_0040: ldflda ""int System.ValueTuple.Item1"" - IL_0045: ret + IL_0009: ldflda ""int Program.F"" + IL_000e: ret + IL_000f: ldsflda ""(int Alice, int Bob) Program.F1"" + IL_0014: ldflda ""int System.ValueTuple.Item1"" + IL_0019: ret + IL_001a: ldloc.0 + IL_001b: brfalse.s IL_0029 + IL_001d: ldarg.0 + IL_001e: ldflda ""Program.S Program.S1"" + IL_0023: ldflda ""int Program.S.F"" + IL_0028: ret + IL_0029: ldsflda ""Program.S Program.S2"" + IL_002e: ldflda ""(int Alice, int Bob) Program.S.F1"" + IL_0033: ldflda ""int System.ValueTuple.Item1"" + IL_0038: ret }"); } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs index 2ade9d50ba8d5..9d9fa9b872913 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs @@ -12025,7 +12025,7 @@ public MyManagedStruct(int x) n.n.num = x; } }"; - var comp = CompileAndVerify(source, expectedOutput: @"42", verify: false); + var comp = CompileAndVerify(source, expectedOutput: @"42", parseOptions: TestOptions.Regular7_2, verify: false); comp.VerifyIL("Program.Main", @" @@ -12088,6 +12088,38 @@ .locals init (MyManagedStruct V_0) IL_0046: call ""void System.Console.WriteLine(int)"" IL_004b: ret } +"); + + comp = CompileAndVerify(source, expectedOutput: @"42", verify: true, parseOptions: TestOptions.Regular7_1); + + comp.VerifyIL("Program.Main", +@" +{ + // Code size 76 (0x4c) + .maxstack 3 + .locals init (MyManagedStruct V_0) + IL_0000: newobj ""cls1..ctor()"" + IL_0005: dup + IL_0006: ldfld ""MyManagedStruct cls1.y"" + IL_000b: stloc.0 + IL_000c: ldloca.s V_0 + IL_000e: ldc.i4.s 123 + IL_0010: call ""void MyManagedStruct.mutate(int)"" + IL_0015: dup + IL_0016: ldfld ""MyManagedStruct cls1.y"" + IL_001b: stloc.0 + IL_001c: ldloca.s V_0 + IL_001e: ldflda ""MyManagedStruct.Nested MyManagedStruct.n"" + IL_0023: ldflda ""MyManagedStruct.Nested.Nested1 MyManagedStruct.Nested.n"" + IL_0028: ldc.i4 0x1c8 + IL_002d: call ""void MyManagedStruct.Nested.Nested1.mutate(int)"" + IL_0032: ldfld ""MyManagedStruct cls1.y"" + IL_0037: ldfld ""MyManagedStruct.Nested MyManagedStruct.n"" + IL_003c: ldfld ""MyManagedStruct.Nested.Nested1 MyManagedStruct.Nested.n"" + IL_0041: ldfld ""int MyManagedStruct.Nested.Nested1.num"" + IL_0046: call ""void System.Console.WriteLine(int)"" + IL_004b: ret +} "); } From 79fc0a8918a47e9720ca8279ae055e9f2bedabb9 Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Fri, 3 Nov 2017 13:34:35 -0700 Subject: [PATCH 11/28] Add IsRef property to IConditionalOperation and ISimpleAssignmentOperation, add RefKind property to ILocalSymbol. (#22933) Closes #21311. --- .../CSharp/Portable/CodeGen/Optimizer.cs | 2 +- .../Operations/CSharpOperationFactory.cs | 9 +- .../CSharpOperationFactory_Methods.cs | 3 +- .../SymbolDisplay/SymbolDisplayVisitor.cs | 6 + .../CSharp/Portable/Symbols/LocalSymbol.cs | 4 +- .../Symbols/Source/SourceLocalSymbol.cs | 2 +- .../Symbols/Synthesized/SynthesizedLocal.cs | 2 +- .../Synthesized/TypeSubstitutedLocalSymbol.cs | 2 +- .../IOperationTests_IConditionalOperation.cs | 71 ++++++++++ .../SymbolDisplay/SymbolDisplayTests.cs | 125 ++++++++++++++++++ .../Generated/Operations.xml.Generated.cs | 36 +++-- .../Operations/IConditionalOperation.cs | 5 + .../Operations/ISimpleAssignmentOperation.cs | 4 + .../Portable/Operations/OperationCloner.cs | 4 +- .../Portable/Operations/OperationFactory.cs | 7 +- .../Core/Portable/PublicAPI.Unshipped.txt | 3 + .../Core/Portable/Symbols/ILocalSymbol.cs | 8 +- .../Operations/VisualBasicOperationFactory.vb | 9 +- .../VisualBasicOperationFactory_Methods.vb | 3 +- .../Portable/Symbols/Source/LocalSymbol.vb | 6 + .../Symbols/EEDisplayClassFieldLocalSymbol.cs | 2 +- .../Symbols/EELocalConstantSymbol.cs | 2 +- .../Symbols/EELocalSymbol.cs | 2 +- .../Symbols/PlaceholderLocalSymbol.cs | 2 +- .../Compilation/OperationTreeVerifier.cs | 12 ++ .../Compilation/TestOperationWalker.cs | 2 + 26 files changed, 299 insertions(+), 34 deletions(-) create mode 100644 src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs diff --git a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs index e6b49b576b52e..612e107c3e445 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs @@ -2152,7 +2152,7 @@ internal override SyntaxNode GetDeclaratorSyntax() throw new NotImplementedException(); } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 0bdf6d24247ea..6341ae608bc39 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -951,12 +951,13 @@ private ISimpleAssignmentOperation CreateBoundAssignmentOperatorOperation(BoundA Debug.Assert(!IsMemberInitializer(boundAssignmentOperator)); Lazy target = new Lazy(() => Create(boundAssignmentOperator.Left)); + bool isRef = boundAssignmentOperator.RefKind != RefKind.None; Lazy value = new Lazy(() => Create(boundAssignmentOperator.Right)); SyntaxNode syntax = boundAssignmentOperator.Syntax; ITypeSymbol type = boundAssignmentOperator.Type; Optional constantValue = ConvertToOptional(boundAssignmentOperator.ConstantValue); bool isImplicit = boundAssignmentOperator.WasCompilerGenerated; - return new LazySimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazySimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit); } private IMemberInitializerOperation CreateBoundMemberInitializerOperation(BoundAssignmentOperator boundAssignmentOperator) @@ -1060,11 +1061,12 @@ private IConditionalOperation CreateBoundConditionalOperatorOperation(BoundCondi Lazy condition = new Lazy(() => Create(boundConditionalOperator.Condition)); Lazy whenTrue = new Lazy(() => Create(boundConditionalOperator.Consequence)); Lazy whenFalse = new Lazy(() => Create(boundConditionalOperator.Alternative)); + bool isRef = boundConditionalOperator.IsByRef; SyntaxNode syntax = boundConditionalOperator.Syntax; ITypeSymbol type = boundConditionalOperator.Type; Optional constantValue = ConvertToOptional(boundConditionalOperator.ConstantValue); bool isImplicit = boundConditionalOperator.WasCompilerGenerated; - return new LazyConditionalOperation(condition, whenTrue, whenFalse, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyConditionalOperation(condition, whenTrue, whenFalse, isRef, _semanticModel, syntax, type, constantValue, isImplicit); } private ICoalesceOperation CreateBoundNullCoalescingOperatorOperation(BoundNullCoalescingOperator boundNullCoalescingOperator) @@ -1298,11 +1300,12 @@ private IConditionalOperation CreateBoundIfStatementOperation(BoundIfStatement b Lazy condition = new Lazy(() => Create(boundIfStatement.Condition)); Lazy ifTrueStatement = new Lazy(() => Create(boundIfStatement.Consequence)); Lazy ifFalseStatement = new Lazy(() => Create(boundIfStatement.AlternativeOpt)); + bool isRef = false; SyntaxNode syntax = boundIfStatement.Syntax; ITypeSymbol type = null; Optional constantValue = default(Optional); bool isImplicit = boundIfStatement.WasCompilerGenerated; - return new LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, isRef, _semanticModel, syntax, type, constantValue, isImplicit); } private IWhileLoopOperation CreateBoundWhileStatementOperation(BoundWhileStatement boundWhileStatement) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs index d61cfbec027ae..288854c1b05c1 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs @@ -199,7 +199,8 @@ private ImmutableArray GetAnonymousObjectCreationInitializers(BoundA SyntaxNode syntax = value.Syntax?.Parent ?? expression.Syntax; ITypeSymbol type = target.Type; Optional constantValue = value.ConstantValue; - var assignment = new SimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit: expression.WasCompilerGenerated); + bool isRef = false; + var assignment = new SimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit: expression.WasCompilerGenerated); builder.Add(assignment); } diff --git a/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs b/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs index cbc2074edeb40..863a9d62f8594 100644 --- a/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs +++ b/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs @@ -183,6 +183,12 @@ public override void VisitLocal(ILocalSymbol symbol) { AddKeyword(SyntaxKind.RefKeyword); AddSpace(); + + if (symbol.RefKind == RefKind.RefReadOnly) + { + AddKeyword(SyntaxKind.ReadOnlyKeyword); + AddSpace(); + } } if (format.LocalOptions.IncludesOption(SymbolDisplayLocalOptions.IncludeType)) diff --git a/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs index 0a3afe13fcea9..b85881a4c001c 100644 --- a/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs @@ -321,9 +321,9 @@ internal abstract bool IsCompilerGenerated internal abstract ImmutableArray GetConstantValueDiagnostics(BoundExpression boundInitValue); - public bool IsRef => RefKind == RefKind.Ref; + public bool IsRef => RefKind != RefKind.None; - internal abstract RefKind RefKind + public abstract RefKind RefKind { get; } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs index 77dac53792fde..979b4d2d37453 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs @@ -458,7 +458,7 @@ internal override ImmutableArray GetConstantValueDiagnostics(BoundEx return ImmutableArray.Empty; } - internal override RefKind RefKind + public override RefKind RefKind { get { return _refKind; } } diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs index 3c5c5219ef074..1bb3cf05cd66b 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs @@ -74,7 +74,7 @@ internal override LocalSymbol WithSynthesizedLocalKindAndSyntax(SynthesizedLocal _refKind); } - internal override RefKind RefKind + public override RefKind RefKind { get { return _refKind; } } diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs index 1f79df6b1b1ae..551b51de5d5e6 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs @@ -88,7 +88,7 @@ internal override bool IsPinned get { return _originalVariable.IsPinned; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return _originalVariable.RefKind; } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs new file mode 100644 index 0000000000000..9434decd5d819 --- /dev/null +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.CSharp.Test.Utilities; +using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests +{ + public partial class IOperationTests : SemanticModelTestBase + { + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void ConditionalExpression_01() + { + string source = @" +class P +{ + private void M() + { + int i = 0; + int j = 2; + var z = (/**/true ? i : j/**/); + } +} +"; + string expectedOperationTree = @" +IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'true ? i : j') + Condition: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') + WhenTrue: + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + WhenFalse: + ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void ConditionalExpression_02() + { + string source = @" +class P +{ + private void M() + { + int i = 0; + int j = 2; + (/**/true ? ref i : ref j/**/) = 4; + } +} +"; + string expectedOperationTree = @" +IConditionalOperation (IsRef) (OperationKind.Conditional, Type: System.Int32) (Syntax: 'true ? ref i : ref j') + Condition: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') + WhenTrue: + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + WhenFalse: + ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + } +} diff --git a/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs b/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs index db5e8d6da25cc..98b8e8429bcac 100644 --- a/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs @@ -5965,5 +5965,130 @@ async unsafe Task Local(in int* x, out char? c) SymbolDisplayPartKind.ParameterName, // c SymbolDisplayPartKind.Punctuation); // ) } + + [Fact] + public void LocalVariable_01() + { + var srcTree = SyntaxFactory.ParseSyntaxTree(@" +class C +{ + void M() + { + int x = 0; + x++; + } +}"); + var root = srcTree.GetRoot(); + var comp = CreateStandardCompilation(srcTree); + + var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single()); + var declarator = root.DescendantNodes().OfType().Single(); + var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat.AddLocalOptions(SymbolDisplayLocalOptions.IncludeRef)), + "int x", + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Assert.False(local.IsRef); + Assert.Equal(RefKind.None, local.RefKind); + } + + [Fact] + public void LocalVariable_02() + { + var srcTree = SyntaxFactory.ParseSyntaxTree(@" +class C +{ + void M(int y) + { + ref int x = y; + x++; + } +}"); + var root = srcTree.GetRoot(); + var comp = CreateStandardCompilation(srcTree); + + var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single()); + var declarator = root.DescendantNodes().OfType().Single(); + var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat.AddLocalOptions(SymbolDisplayLocalOptions.IncludeRef)), + "ref int x", + SymbolDisplayPartKind.Keyword, //ref + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat), + "int x", + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Assert.True(local.IsRef); + Assert.Equal(RefKind.Ref, local.RefKind); + } + + [Fact] + public void LocalVariable_03() + { + var srcTree = SyntaxFactory.ParseSyntaxTree(@" +class C +{ + void M(int y) + { + ref readonly int x = y; + x++; + } +}"); + var root = srcTree.GetRoot(); + var comp = CreateStandardCompilation(srcTree); + + var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single()); + var declarator = root.DescendantNodes().OfType().Single(); + var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat.AddLocalOptions(SymbolDisplayLocalOptions.IncludeRef)), + "ref readonly int x", + SymbolDisplayPartKind.Keyword, //ref + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.Keyword, //readonly + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat), + "int x", + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Assert.True(local.IsRef); + Assert.Equal(RefKind.RefReadOnly, local.RefKind); + } } } diff --git a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs index 20e140d9f56bf..7ff47351bd8b5 100644 --- a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs +++ b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs @@ -514,9 +514,10 @@ public sealed override IEnumerable Children /// internal abstract partial class BaseSimpleAssignmentExpression : AssignmentExpression, ISimpleAssignmentOperation { - public BaseSimpleAssignmentExpression(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + public BaseSimpleAssignmentExpression(bool isRef, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(OperationKind.SimpleAssignment, semanticModel, syntax, type, constantValue, isImplicit) { + IsRef = isRef; } public override void Accept(OperationVisitor visitor) { @@ -526,6 +527,11 @@ public override TResult Accept(OperationVisitor + /// Is this a ref assignment + /// + public bool IsRef { get; } } /// @@ -533,8 +539,8 @@ public override TResult Accept(OperationVisitor internal sealed partial class SimpleAssignmentExpression : BaseSimpleAssignmentExpression, ISimpleAssignmentOperation { - public SimpleAssignmentExpression(IOperation target, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public SimpleAssignmentExpression(IOperation target, bool isRef, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { TargetImpl = target; ValueImpl = value; @@ -551,8 +557,8 @@ internal sealed partial class LazySimpleAssignmentExpression : BaseSimpleAssignm private readonly Lazy _lazyTarget; private readonly Lazy _lazyValue; - public LazySimpleAssignmentExpression(Lazy target, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public LazySimpleAssignmentExpression(Lazy target, bool isRef, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { _lazyTarget = target ?? throw new System.ArgumentNullException(nameof(target)); _lazyValue = value ?? throw new System.ArgumentNullException(nameof(value)); @@ -1279,9 +1285,10 @@ public override TResult Accept(OperationVisitor internal abstract partial class BaseConditionalOperation : Operation, IConditionalOperation { - protected BaseConditionalOperation(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + protected BaseConditionalOperation(bool isRef, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(OperationKind.Conditional, semanticModel, syntax, type, constantValue, isImplicit) { + IsRef = isRef; } protected abstract IOperation ConditionImpl { get; } protected abstract IOperation WhenTrueImpl { get; } @@ -1324,6 +1331,11 @@ public override TResult Accept(OperationVisitor + /// Is result a managed reference + /// + public bool IsRef { get; } } /// @@ -1336,8 +1348,10 @@ public override TResult Accept(OperationVisitor internal sealed partial class ConditionalOperation : BaseConditionalOperation, IConditionalOperation { - public ConditionalOperation(IOperation condition, IOperation whenTrue, IOperation whenFalse, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public ConditionalOperation( + IOperation condition, IOperation whenTrue, IOperation whenFalse, bool isRef, + SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { ConditionImpl = condition; WhenTrueImpl = whenTrue; @@ -1363,8 +1377,10 @@ internal sealed partial class LazyConditionalOperation : BaseConditionalOperatio private readonly Lazy _lazyWhenTrue; private readonly Lazy _lazyWhenFalse; - public LazyConditionalOperation(Lazy condition, Lazy whenTrue, Lazy whenFalse, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) - : base(semanticModel, syntax, type, constantValue, isImplicit) + public LazyConditionalOperation( + Lazy condition, Lazy whenTrue, Lazy whenFalse, bool isRef, + SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) + : base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { _lazyCondition = condition ?? throw new System.ArgumentNullException(nameof(condition)); _lazyWhenTrue = whenTrue ?? throw new System.ArgumentNullException(nameof(whenTrue)); diff --git a/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs b/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs index 7fa07e9fb4833..7df2f4130b951 100644 --- a/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs @@ -31,6 +31,11 @@ public interface IConditionalOperation : IOperation /// Operation to be executed if the is false. /// IOperation WhenFalse { get; } + + /// + /// Is result a managed reference + /// + bool IsRef { get; } } } diff --git a/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs b/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs index 3532f4410edb4..b0f99d8a5eaa3 100644 --- a/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs +++ b/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs @@ -16,6 +16,10 @@ namespace Microsoft.CodeAnalysis.Operations /// public interface ISimpleAssignmentOperation : IAssignmentOperation { + /// + /// Is this a ref assignment + /// + bool IsRef { get; } } } diff --git a/src/Compilers/Core/Portable/Operations/OperationCloner.cs b/src/Compilers/Core/Portable/Operations/OperationCloner.cs index c0621f3f78134..b54b66385f106 100644 --- a/src/Compilers/Core/Portable/Operations/OperationCloner.cs +++ b/src/Compilers/Core/Portable/Operations/OperationCloner.cs @@ -262,7 +262,7 @@ public override IOperation VisitBinaryOperator(IBinaryOperation operation, objec public override IOperation VisitConditional(IConditionalOperation operation, object argument) { - return new ConditionalOperation(Visit(operation.Condition), Visit(operation.WhenTrue), Visit(operation.WhenFalse), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new ConditionalOperation(Visit(operation.Condition), Visit(operation.WhenTrue), Visit(operation.WhenFalse), operation.IsRef, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitCoalesce(ICoalesceOperation operation, object argument) @@ -377,7 +377,7 @@ public override IOperation VisitArrayInitializer(IArrayInitializerOperation oper public override IOperation VisitSimpleAssignment(ISimpleAssignmentOperation operation, object argument) { - return new SimpleAssignmentExpression(Visit(operation.Target), Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new SimpleAssignmentExpression(Visit(operation.Target), operation.IsRef, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitDeconstructionAssignment(IDeconstructionAssignmentOperation operation, object argument) diff --git a/src/Compilers/Core/Portable/Operations/OperationFactory.cs b/src/Compilers/Core/Portable/Operations/OperationFactory.cs index 862b3bfd02e0f..0863786c1a617 100644 --- a/src/Compilers/Core/Portable/Operations/OperationFactory.cs +++ b/src/Compilers/Core/Portable/Operations/OperationFactory.cs @@ -12,12 +12,13 @@ public static IVariableInitializerOperation CreateVariableInitializer(SyntaxNode return new VariableInitializer(initializerValue, semanticModel, syntax, type: null, constantValue: default, isImplicit: isImplicit); } - public static IConditionalOperation CreateConditionalExpression(IOperation condition, IOperation whenTrue, IOperation whenFalse, ITypeSymbol resultType, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) + public static IConditionalOperation CreateConditionalExpression(IOperation condition, IOperation whenTrue, IOperation whenFalse, bool isRef, ITypeSymbol resultType, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) { return new ConditionalOperation( condition, whenTrue, whenFalse, + isRef, semanticModel, syntax, resultType, @@ -25,9 +26,9 @@ public static IConditionalOperation CreateConditionalExpression(IOperation condi isImplicit); } - public static IExpressionStatementOperation CreateSimpleAssignmentExpressionStatement(IOperation target, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) + public static IExpressionStatementOperation CreateSimpleAssignmentExpressionStatement(IOperation target, bool isRef, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) { - var expression = new SimpleAssignmentExpression(target, value, semanticModel, syntax, target.Type, default(Optional), isImplicit); + var expression = new SimpleAssignmentExpression(target, isRef, value, semanticModel, syntax, target.Type, default(Optional), isImplicit); return new ExpressionStatement(expression, semanticModel, syntax, type: null, constantValue: default(Optional), isImplicit: isImplicit); } diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index cd10c337c2bd0..8d4b551ae8d9c 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -36,6 +36,7 @@ Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBloc Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBlockEndActionsCount.set -> void Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBlockStartActionsCount.get -> int Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBlockStartActionsCount.set -> void +Microsoft.CodeAnalysis.ILocalSymbol.RefKind.get -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.IMethodSymbol.RefKind.get -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.IMethodSymbol.ReturnsByRefReadonly.get -> bool Microsoft.CodeAnalysis.IOperation @@ -260,6 +261,7 @@ Microsoft.CodeAnalysis.Operations.IConditionalAccessOperation.Operation.get -> M Microsoft.CodeAnalysis.Operations.IConditionalAccessOperation.WhenNotNull.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IConditionalOperation Microsoft.CodeAnalysis.Operations.IConditionalOperation.Condition.get -> Microsoft.CodeAnalysis.IOperation +Microsoft.CodeAnalysis.Operations.IConditionalOperation.IsRef.get -> bool Microsoft.CodeAnalysis.Operations.IConditionalOperation.WhenFalse.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IConditionalOperation.WhenTrue.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IConstantPatternOperation @@ -418,6 +420,7 @@ Microsoft.CodeAnalysis.Operations.IRelationalCaseClauseOperation.Value.get -> Mi Microsoft.CodeAnalysis.Operations.IReturnOperation Microsoft.CodeAnalysis.Operations.IReturnOperation.ReturnedValue.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.ISimpleAssignmentOperation +Microsoft.CodeAnalysis.Operations.ISimpleAssignmentOperation.IsRef.get -> bool Microsoft.CodeAnalysis.Operations.ISingleValueCaseClauseOperation Microsoft.CodeAnalysis.Operations.ISingleValueCaseClauseOperation.Value.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.ISizeOfOperation diff --git a/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs b/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs index 2400c52c3c07d..7be622258ef27 100644 --- a/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs +++ b/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs @@ -23,10 +23,16 @@ public interface ILocalSymbol : ISymbol bool IsConst { get; } /// - /// Returns true if this local is a ref-local. + /// Returns true if this local is a ref local or a ref readonly local. + /// Use to get more detailed information. /// bool IsRef { get; } + /// + /// Whether the variable is a ref or ref readonly local. + /// + RefKind RefKind { get; } + /// /// Returns false if the local variable wasn't declared as "const", or constant value was omitted or erroneous. /// True otherwise. diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index b556dcfde2560..1d4977c86ef51 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -296,10 +296,11 @@ Namespace Microsoft.CodeAnalysis.Operations Else Dim target As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundAssignmentOperator.Left)) Dim value As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundAssignmentOperator.Right)) + Dim isRef As Boolean = False Dim syntax As SyntaxNode = boundAssignmentOperator.Syntax Dim type As ITypeSymbol = boundAssignmentOperator.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundAssignmentOperator.ConstantValueOpt) - Return New LazySimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit) + Return New LazySimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit) End If End Function @@ -640,7 +641,8 @@ Namespace Microsoft.CodeAnalysis.Operations Dim type As ITypeSymbol = boundTernaryConditionalExpression.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundTernaryConditionalExpression.ConstantValueOpt) Dim isImplicit As Boolean = boundTernaryConditionalExpression.WasCompilerGenerated - Return New LazyConditionalOperation(condition, whenTrue, whenFalse, _semanticModel, syntax, type, constantValue, isImplicit) + Dim isRef As Boolean = False + Return New LazyConditionalOperation(condition, whenTrue, whenFalse, isRef, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundTypeOfOperation(boundTypeOf As BoundTypeOf) As IIsTypeOperation @@ -951,7 +953,8 @@ Namespace Microsoft.CodeAnalysis.Operations Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() Dim isImplicit As Boolean = boundIfStatement.WasCompilerGenerated - Return New LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, _semanticModel, syntax, type, constantValue, isImplicit) + Dim isRef As Boolean = False + Return New LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, isRef, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundSelectStatementOperation(boundSelectStatement As BoundSelectStatement) As ISwitchOperation diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb index 745fe2bc4ec30..dbbfd41b1f777 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb @@ -203,11 +203,12 @@ Namespace Microsoft.CodeAnalysis.Operations Continue For End If + Dim isRef As Boolean = False Dim target As IOperation = Create(expression.Declarations(i)) Dim syntax As SyntaxNode = If(value.Syntax?.Parent, expression.Syntax) Dim type As ITypeSymbol = target.Type Dim constantValue As [Optional](Of Object) = value.ConstantValue - Dim assignment = New SimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit:=expression.WasCompilerGenerated) + Dim assignment = New SimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit:=expression.WasCompilerGenerated) builder.Add(assignment) Next i diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb index 2b32e737107a7..994b7ae34b95e 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb @@ -286,6 +286,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property + Public ReadOnly Property RefKind As RefKind Implements ILocalSymbol.RefKind + Get + Return RefKind.None + End Get + End Property + Public MustOverride ReadOnly Property IsFunctionValue As Boolean Implements ILocalSymbol.IsFunctionValue Friend ReadOnly Property IsCompilerGenerated As Boolean diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs index 4f29cbd5b876c..f80772feecfb0 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs @@ -63,7 +63,7 @@ internal override bool IsCompilerGenerated get { return false; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs index a08ac4d8316ab..aec494998799b 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs @@ -76,7 +76,7 @@ internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol in return _value; } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs index d604dcce76a54..4e57f20aff86e 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs @@ -112,7 +112,7 @@ internal override bool IsCompilerGenerated get { return _isCompilerGenerated; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return _refKind; } } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs index c8ff0acaf5fc3..b852ba06650ad 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs @@ -102,7 +102,7 @@ internal override bool IsCompilerGenerated get { return true; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs index 1fd4f3a74e009..c3f89dfd33b47 100644 --- a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs @@ -965,6 +965,12 @@ public override void VisitConversion(IConversionOperation operation) public override void VisitConditional(IConditionalOperation operation) { LogString(nameof(IConditionalOperation)); + + if (operation.IsRef) + { + LogString(" (IsRef)"); + } + LogCommonPropertiesAndNewLine(operation); Visit(operation.Condition, "Condition"); @@ -1236,6 +1242,12 @@ public override void VisitArrayInitializer(IArrayInitializerOperation operation) public override void VisitSimpleAssignment(ISimpleAssignmentOperation operation) { LogString(nameof(ISimpleAssignmentOperation)); + + if (operation.IsRef) + { + LogString(" (IsRef)"); + } + LogCommonPropertiesAndNewLine(operation); Visit(operation.Target, "Left"); diff --git a/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs b/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs index 3aacb0a188b04..6d572b0eb7090 100644 --- a/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs +++ b/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs @@ -371,6 +371,7 @@ public override void VisitConversion(IConversionOperation operation) public override void VisitConditional(IConditionalOperation operation) { + bool isRef = operation.IsRef; base.VisitConditional(operation); } @@ -536,6 +537,7 @@ public override void VisitArrayInitializer(IArrayInitializerOperation operation) public override void VisitSimpleAssignment(ISimpleAssignmentOperation operation) { + bool isRef = operation.IsRef; base.VisitSimpleAssignment(operation); } From 3d35314a0ea092b10487ad4fb2b2513c874d64a1 Mon Sep 17 00:00:00 2001 From: Charles Stoner Date: Fri, 3 Nov 2017 14:59:41 -0700 Subject: [PATCH 12/28] Use ICollection.Contains to avoid Enumerator allocation --- .../CSharp/Portable/Declarations/MergedTypeDeclaration.cs | 2 +- .../Portable/Symbols/Source/SourceMemberContainerSymbol.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs b/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs index ae9b9486e2eab..51c6baf4dee2b 100644 --- a/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs +++ b/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs @@ -211,7 +211,7 @@ protected override ImmutableArray GetDeclarationChildren() return StaticCast.From(this.Children); } - public IEnumerable MemberNames + public ICollection MemberNames { get { diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs index 36c7a4dadb144..bbd3f8d9d9fb2 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs @@ -1219,7 +1219,7 @@ public sealed override ImmutableArray GetMembers(string name) internal override ImmutableArray GetSimpleNonTypeMembers(string name) { - if (_lazyMembersDictionary != null || MemberNames.Contains(name)) + if (_lazyMembersDictionary != null || declaration.MemberNames.Contains(name)) { return GetMembers(name); } From 72b8f88b0daf42e1a8b1d6687cbfc9ccbb0cc21a Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Sat, 4 Nov 2017 19:31:38 -0700 Subject: [PATCH 13/28] Fix InvalidCastException in CSharpOperationFactory for invalid nested member initializer (#22983) Fixes #22967 --- .../Operations/CSharpOperationFactory.cs | 2 +- ...perationTests_IObjectCreationExpression.cs | 132 +++++++++++++++++ .../Generated/Operations.xml.Generated.cs | 14 +- .../Operations/IMemberInitializerOperation.cs | 9 +- .../Core/Portable/PublicAPI.Unshipped.txt | 2 +- ...perationTests_IObjectCreationExpression.vb | 135 ++++++++++++++++++ 6 files changed, 280 insertions(+), 14 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 6341ae608bc39..b7cd69f90bcdd 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -964,7 +964,7 @@ private IMemberInitializerOperation CreateBoundMemberInitializerOperation(BoundA { Debug.Assert(IsMemberInitializer(boundAssignmentOperator)); - Lazy target = new Lazy(() => (IMemberReferenceOperation)Create(boundAssignmentOperator.Left)); + Lazy target = new Lazy(() => Create(boundAssignmentOperator.Left)); Lazy value = new Lazy(() => (IObjectOrCollectionInitializerOperation)Create(boundAssignmentOperator.Right)); SyntaxNode syntax = boundAssignmentOperator.Syntax; ITypeSymbol type = boundAssignmentOperator.Type; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs index 26c09ceeb2540..294ad767595ed 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs @@ -472,5 +472,137 @@ static void Main() VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(22967, "https://github.com/dotnet/roslyn/issues/22967")] + public void ObjectCreationWithInvalidInitializer() + { + string source = @" +class C +{ + public void M1() + { + var x1 = /**/new C() { MissingMember = 1 }/**/; + } +} +"; + string expectedOperationTree = @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C() { M ... ember = 1 }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C, IsInvalid) (Syntax: '{ MissingMember = 1 }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'MissingMember = 1') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingMember') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'MissingMember') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(6,38): error CS0117: 'C' does not contain a definition for 'MissingMember' + // var x1 = /**/new C() { MissingMember = 1 }/**/; + Diagnostic(ErrorCode.ERR_NoSuchMember, "MissingMember").WithArguments("C", "MissingMember").WithLocation(6, 38) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(22967, "https://github.com/dotnet/roslyn/issues/22967")] + public void ObjectCreationWithInvalidMemberInitializer() + { + string source = @" +class C +{ + public void M1() + { + var x1 = /**/new C(){ MissingField = { x = 1 } }/**/; + } +} +"; + string expectedOperationTree = @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(){ Mi ... { x = 1 } }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C, IsInvalid) (Syntax: '{ MissingFi ... { x = 1 } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: ?, IsInvalid) (Syntax: 'MissingField = { x = 1 }') + InitializedMember: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingField') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'MissingField') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: ?) (Syntax: '{ x = 1 }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?) (Syntax: 'x = 1') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsImplicit) (Syntax: 'x') + Children(1): + IOperation: (OperationKind.None, Type: null) (Syntax: 'x') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingField') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(6,37): error CS0117: 'C' does not contain a definition for 'MissingField' + // var x1 = /**/new C(){ MissingField = { x = 1 } }/**/; + Diagnostic(ErrorCode.ERR_NoSuchMember, "MissingField").WithArguments("C", "MissingField").WithLocation(6, 37) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(22967, "https://github.com/dotnet/roslyn/issues/22967")] + public void ObjectCreationWithInvalidCollectionInitializer() + { + string source = @" +using System.Collections.Generic; + +class C +{ + public void M1() + { + var x1 = /**/new C(){ MissingField = new List() { 1 }}/**/; + } +} +"; + string expectedOperationTree = @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(){ Mi ... t>() { 1 }}') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C, IsInvalid) (Syntax: '{ MissingFi ... t>() { 1 }}') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'MissingFiel ... nt>() { 1 }') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingField') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'MissingField') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') + Right: + IObjectCreationOperation (Constructor: System.Collections.Generic.List..ctor()) (OperationKind.ObjectCreation, Type: System.Collections.Generic.List) (Syntax: 'new List() { 1 }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Collections.Generic.List) (Syntax: '{ 1 }') + Initializers(1): + ICollectionElementInitializerOperation (AddMethod: void System.Collections.Generic.List.Add(System.Int32 item)) (IsDynamic: False) (OperationKind.CollectionElementInitializer, Type: System.Void, IsImplicit) (Syntax: '1') + Arguments(1): + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(8,37): error CS0117: 'C' does not contain a definition for 'MissingField' + // var x1 = /**/new C(){ MissingField = new List() { 1 }}/**/; + Diagnostic(ErrorCode.ERR_NoSuchMember, "MissingField").WithArguments("C", "MissingField").WithLocation(8, 37) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } } } diff --git a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs index 7ff47351bd8b5..8043982ff2689 100644 --- a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs +++ b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs @@ -6304,7 +6304,7 @@ protected BaseMemberInitializerExpression(SemanticModel semanticModel, SyntaxNod { } - protected abstract IMemberReferenceOperation InitializedMemberImpl { get; } + protected abstract IOperation InitializedMemberImpl { get; } protected abstract IObjectOrCollectionInitializerOperation InitializerImpl { get; } public override IEnumerable Children { @@ -6323,7 +6323,7 @@ public override IEnumerable Children /// /// Initialized member. /// - public IMemberReferenceOperation InitializedMember => Operation.SetParentOperation(InitializedMemberImpl, this); + public IOperation InitializedMember => Operation.SetParentOperation(InitializedMemberImpl, this); /// /// Member initializer. @@ -6344,14 +6344,14 @@ public override TResult Accept(OperationVisitor internal sealed partial class MemberInitializerExpression : BaseMemberInitializerExpression, IMemberInitializerOperation { - public MemberInitializerExpression(IMemberReferenceOperation initializedMember, IObjectOrCollectionInitializerOperation initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + public MemberInitializerExpression(IOperation initializedMember, IObjectOrCollectionInitializerOperation initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, type, constantValue, isImplicit) { InitializedMemberImpl = initializedMember; InitializerImpl = initializer; } - protected override IMemberReferenceOperation InitializedMemberImpl { get; } + protected override IOperation InitializedMemberImpl { get; } protected override IObjectOrCollectionInitializerOperation InitializerImpl { get; } } @@ -6360,17 +6360,17 @@ public MemberInitializerExpression(IMemberReferenceOperation initializedMember, /// internal sealed partial class LazyMemberInitializerExpression : BaseMemberInitializerExpression, IMemberInitializerOperation { - private readonly Lazy _lazyInitializedMember; + private readonly Lazy _lazyInitializedMember; private readonly Lazy _lazyInitializer; - public LazyMemberInitializerExpression(Lazy initializedMember, Lazy initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + public LazyMemberInitializerExpression(Lazy initializedMember, Lazy initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, type, constantValue, isImplicit) { _lazyInitializedMember = initializedMember ?? throw new System.ArgumentNullException(nameof(initializedMember)); _lazyInitializer = initializer ?? throw new System.ArgumentNullException(nameof(initializer)); } - protected override IMemberReferenceOperation InitializedMemberImpl => _lazyInitializedMember.Value; + protected override IOperation InitializedMemberImpl => _lazyInitializedMember.Value; protected override IObjectOrCollectionInitializerOperation InitializerImpl => _lazyInitializer.Value; } diff --git a/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs b/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs index 3787cddcb6239..5c95b56a50ac8 100644 --- a/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs @@ -3,11 +3,10 @@ namespace Microsoft.CodeAnalysis.Operations { /// - /// Represents an initialization of member within an object initializer. + /// Represents an initialization of member within an object initializer with a nested object or collection initializer. /// /// Current usage: - /// (1) C# member initializer expression. - /// (2) VB member initializer expression. + /// (1) C# nested member initializer expression. /// For example, given an object creation with initializer "new Class() { X = x, Y = { x, y, 3 }, Z = { X = z } }", /// member initializers for Y and Z, i.e. "Y = { x, y, 3 }", and "Z = { X = z }" are nested member initializers represented by this operation. /// @@ -19,9 +18,9 @@ namespace Microsoft.CodeAnalysis.Operations public interface IMemberInitializerOperation : IOperation { /// - /// Initialized member. + /// Initialized member reference or an invalid operation for error cases. /// - IMemberReferenceOperation InitializedMember { get; } + IOperation InitializedMember { get; } /// /// Member initializer. diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index 8d4b551ae8d9c..3243b06ac1172 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -375,7 +375,7 @@ Microsoft.CodeAnalysis.Operations.ILoopOperation.Body.get -> Microsoft.CodeAnaly Microsoft.CodeAnalysis.Operations.ILoopOperation.Locals.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.ILoopOperation.LoopKind.get -> Microsoft.CodeAnalysis.Operations.LoopKind Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation -Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation.InitializedMember.get -> Microsoft.CodeAnalysis.Operations.IMemberReferenceOperation +Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation.InitializedMember.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation.Initializer.get -> Microsoft.CodeAnalysis.Operations.IObjectOrCollectionInitializerOperation Microsoft.CodeAnalysis.Operations.IMemberReferenceOperation Microsoft.CodeAnalysis.Operations.IMemberReferenceOperation.Instance.get -> Microsoft.CodeAnalysis.IOperation diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb index d5163a9306b22..c544989e586dd 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb @@ -404,5 +404,140 @@ IObjectCreationOperation (Constructor: Sub [Class]..ctor()) (OperationKind.Objec VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + Public Sub ObjectCreationWithInvalidInitializer() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub ObjectCreationWithInvalidCollectionInitializer() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub ObjectCreationWithInvalidCollectionInitializer02() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace From fcff6e45c20b88c23641b693ecae894cda760509 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Mon, 6 Nov 2017 14:42:46 -0800 Subject: [PATCH 14/28] Do not invoke GetStandaloneNode helper in GetOperationWorker Fixes #23001 --- .../Compilation/SyntaxTreeSemanticModel.cs | 3 -- .../Semantic/IOperation/IOperationTests.cs | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs index 08bd5a05b442e..afe1ac351b39f 100644 --- a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs @@ -163,9 +163,6 @@ internal override Binder GetEnclosingBinderInternal(int position) internal override IOperation GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken) { - // in case this is right side of a qualified name or member access (or part of a cref) - node = SyntaxFactory.GetStandaloneNode(node); - var model = this.GetMemberModel(node); if (model != null) { diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs index 3f36ef79b0846..d7845119f48a2 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs @@ -159,5 +159,45 @@ public void TestParentOperations() VerifyParentOperations(model); } + + [CompilerTrait(CompilerFeature.IOperation)] + [WorkItem(23001, "https://github.com/dotnet/roslyn/issues/23001")] + [Fact] + public void TestGetOperationForQualifiedName() + { + var text = @"using System; + +public class Test +{ + class A + { + public B b; + } + class B + { + } + + void M(A a) + { + int x2 = /**/a.b/**/; + } +} +"; + var comp = CreateStandardCompilation(text, parseOptions: TestOptions.RegularWithIOperationFeature); + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + + // Verify we return non-null operation only for topmost member access expression. + var expr = (MemberAccessExpressionSyntax)GetExprSyntaxForBinding(GetExprSyntaxList(tree)); + Assert.Equal("a.b", expr.ToString()); + var operation = model.GetOperation(expr); + Assert.NotNull(operation); + Assert.Equal(OperationKind.FieldReference, operation.Kind); + var fieldOperation = (IFieldReferenceOperation)operation; + Assert.Equal("b", fieldOperation.Field.Name); + + // Verify we return null operation for child nodes of member access expression. + Assert.Null(model.GetOperation(expr.Name)); + } } } From cfe43702a720172a2ee88ed4e11a93ce719bd95b Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Mon, 6 Nov 2017 16:25:01 -0800 Subject: [PATCH 15/28] Address PR feedback --- .../Compilation/CompilationExtensions.cs | 4 +++- .../Compilation/OperationTreeVerifier.cs | 2 ++ .../Extensions/OperationExtensions.cs | 21 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/Test/Utilities/Portable/Extensions/OperationExtensions.cs diff --git a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs index cd69843d2e6a4..6024b872452bc 100644 --- a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs +++ b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; @@ -268,6 +268,8 @@ public static void ValidateIOperations(Func createCompilation) { // Make sure IOperation returned by GetOperation(syntaxnode) will have same syntaxnode as the given syntaxnode(IOperation.Syntax == syntaxnode). Assert.True(node == operation.Syntax, $"Expected : {node} - Actual : {operation.Syntax}"); + + Assert.True(operation.Type == null || !operation.MustHaveNullType(), $"Unexpected non-null type: {operation.Type}"); } } } diff --git a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs index 9fdae908702a0..fb0c187a58434 100644 --- a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs @@ -258,6 +258,8 @@ public override void Visit(IOperation operation) } } + Assert.True(operation.Type == null || !operation.MustHaveNullType(), $"Unexpected non-null type: {operation.Type}"); + if (operation != _root) { Indent(); diff --git a/src/Test/Utilities/Portable/Extensions/OperationExtensions.cs b/src/Test/Utilities/Portable/Extensions/OperationExtensions.cs new file mode 100644 index 0000000000000..b96eaee14f223 --- /dev/null +++ b/src/Test/Utilities/Portable/Extensions/OperationExtensions.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Test.Extensions +{ + internal static class OperationExtensions + { + public static bool MustHaveNullType(this IOperation operation) + { + switch(operation.Kind) + { + // TODO: Expand to cover all operations that must always have null type. + case OperationKind.ArrayInitializer: + case OperationKind.Argument: + return true; + + default: + return false; + } + } + } +} From 06d6fd72ceb6b6efaac92b8d65489defa21b3a5a Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Mon, 6 Nov 2017 16:38:26 -0800 Subject: [PATCH 16/28] Address PR feedback --- .../Operations/VisualBasicOperationFactory.vb | 6 +- .../Semantic/IOperation/IOperationTests.vb | 5 +- .../IOperationTests_IForEachLoopStatement.vb | 45 ++++++++++--- .../IOperationTests_IForLoopStatement.vb | 65 +++++++++++++++---- .../IOperationTests_InvalidStatement.vb | 5 +- 5 files changed, 99 insertions(+), 27 deletions(-) diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index df922050431e4..53668c24bda57 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -1135,9 +1135,9 @@ Namespace Microsoft.CodeAnalysis.Operations End Function Private Function CreateBoundControlVariableOperation(boundForStatement As BoundForStatement) As IOperation - Dim localOpt = boundForStatement.DeclaredOrInferredLocalOpt - Dim controlVariable = boundForStatement.ControlVariable - Return If(localOpt IsNot Nothing AndAlso controlVariable?.Syntax.Kind = SyntaxKind.VariableDeclarator, + Dim localOpt As LocalSymbol = boundForStatement.DeclaredOrInferredLocalOpt + Dim controlVariable As BoundExpression = boundForStatement.ControlVariable + Return If(localOpt IsNot Nothing, OperationFactory.CreateVariableDeclaration(localOpt, initializer:=Nothing, semanticModel:=_semanticModel, syntax:=controlVariable.Syntax), Create(controlVariable)) End Function diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index bdddeb50c8392..427a3520005a5 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -290,7 +290,10 @@ End Class]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i = 0 T ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i') + Variables: Local_1: i As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb index 9502efd0651b6..ef11f4e328fb2 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb @@ -383,7 +383,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') + Variables: Local_1: x As System.Object + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'New Enumerable()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -429,7 +432,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y') + Variables: Local_1: y As System.Char + Initializer: + null Collection: ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String, Constant: null) (Syntax: 's') Body: @@ -475,7 +481,10 @@ End Structure IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') + Variables: Local_1: x As System.Object + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'New Enumerable()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -556,7 +565,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each co ... Next') Locals: Local_1: country As LoopControlVariable: - ILocalReferenceOperation: country (OperationKind.LocalReference, Type: ) (Syntax: 'country') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'country') + Variables: Local_1: country As + Initializer: + null Collection: ILocalReferenceOperation: countries (OperationKind.LocalReference, Type: System.Linq.IOrderedEnumerable(Of )) (Syntax: 'countries') Body: @@ -589,7 +601,10 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each cu ... Next') Locals: Local_1: customer As Customer LoopControlVariable: - ILocalReferenceOperation: customer (OperationKind.LocalReference, Type: Customer) (Syntax: 'customer') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'customer') + Variables: Local_1: customer As Customer + Initializer: + null Collection: IPropertyReferenceOperation: ReadOnly Property .CustomersInCountry As System.Collections.Generic.IEnumerable(Of Customer) (OperationKind.PropertyReference, Type: System.Collections.Generic.IEnumerable(Of Customer)) (Syntax: 'country.Cus ... rsInCountry') Instance Receiver: @@ -662,7 +677,10 @@ End Module IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each [C ... Next') Locals: Local_1: Custom As System.Int32 LoopControlVariable: - ILocalReferenceOperation: Custom (OperationKind.LocalReference, Type: System.Int32) (Syntax: '[Custom]') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: '[Custom]') + Variables: Local_1: Custom As System.Int32 + Initializer: + null Collection: ILocalReferenceOperation: k (OperationKind.LocalReference, Type: System.Int32(,)) (Syntax: 'k') Body: @@ -739,7 +757,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') + Variables: Local_1: x As System.Object + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'o') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -799,7 +820,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Int32 LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') + Variables: Local_1: x As System.Int32 + Initializer: + null Collection: IObjectCreationOperation (Constructor: Sub Enumerable..ctor()) (OperationKind.ObjectCreation, Type: Enumerable) (Syntax: 'New Enumerable()') Arguments(0) @@ -1019,7 +1043,10 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each o ... Next') Locals: Local_1: o As System.Object LoopControlVariable: - ILocalReferenceOperation: o (OperationKind.LocalReference, Type: System.Object) (Syntax: 'o') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'o') + Variables: Local_1: o As System.Object + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb index afc01571728dd..261182b1662f9 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb @@ -260,7 +260,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For AVarNam ... xt AVarName') Locals: Local_1: AVarName As System.Int32 LoopControlVariable: - ILocalReferenceOperation: AVarName (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'AVarName') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'AVarName') + Variables: Local_1: AVarName As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -275,7 +278,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For B = 1 T ... Next B') Locals: Local_1: B As System.Int32 LoopControlVariable: - ILocalReferenceOperation: B (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'B') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'B') + Variables: Local_1: B As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -290,7 +296,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For C = 1 T ... Next C') Locals: Local_1: C As System.Int32 LoopControlVariable: - ILocalReferenceOperation: C (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'C') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'C') + Variables: Local_1: C As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -305,7 +314,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For D = 1 T ... Next D') Locals: Local_1: D As System.Int32 LoopControlVariable: - ILocalReferenceOperation: D (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'D') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'D') + Variables: Local_1: D As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -354,7 +366,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - ILocalReferenceOperation: I (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'I') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'I') + Variables: Local_1: I As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -369,7 +384,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = 1 T ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - ILocalReferenceOperation: J (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'J') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'J') + Variables: Local_1: J As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -428,7 +446,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - ILocalReferenceOperation: I (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'I') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'I') + Variables: Local_1: I As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -443,7 +464,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = I + ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - ILocalReferenceOperation: J (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'J') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'J') + Variables: Local_1: J As System.Int32 + Initializer: + null InitialValue: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'I + 1') Left: @@ -499,7 +523,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - ILocalReferenceOperation: I (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'I') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'I') + Variables: Local_1: I As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -514,7 +541,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = 1 T ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - ILocalReferenceOperation: J (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'J') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'J') + Variables: Local_1: J As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -804,7 +834,10 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For element ... Next') Locals: Local_1: element1 As System.Int32 LoopControlVariable: - ILocalReferenceOperation: element1 (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'element1') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'element1') + Variables: Local_1: element1 As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 23) (Syntax: '23') LimitValue: @@ -992,7 +1025,10 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For A = 1 T ... Next B, A') Locals: Local_1: A As System.Int32 LoopControlVariable: - ILocalReferenceOperation: A (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'A') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'A') + Variables: Local_1: A As System.Int32 + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -1007,7 +1043,10 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For B = A T ... Next B, A') Locals: Local_1: B As System.Int32 LoopControlVariable: - ILocalReferenceOperation: B (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'B') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'B') + Variables: Local_1: B As System.Int32 + Initializer: + null InitialValue: ILocalReferenceOperation: A (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'A') LimitValue: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb index f9a1bf3c2687d..5f1dfd2024d6f 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb @@ -283,7 +283,10 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For Step (M ... Next') Locals: Local_1: As System.Object LoopControlVariable: - ILocalReferenceOperation: (OperationKind.LocalReference, Type: System.Object, IsInvalid) (Syntax: '') + IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: '') + Variables: Local_1: As System.Object + Initializer: + null InitialValue: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) From 627168dac20c46b8fc2baaa0a3019dc5a37513af Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 08:31:35 -0800 Subject: [PATCH 17/28] Address PR feedback and use singleton for null instance --- .../Portable/Operations/CSharpOperationFactory.cs | 11 +++++++---- .../Operations/VisualBasicOperationFactory.vb | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index d9b23a6f84a36..da70a853b2566 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -18,6 +18,9 @@ internal sealed partial class CSharpOperationFactory private readonly ConcurrentDictionary _cache = new ConcurrentDictionary(concurrencyLevel: 2, capacity: 10); + private readonly Lazy _lazyNullOperation = + new Lazy(() => null); + private readonly SemanticModel _semanticModel; public CSharpOperationFactory(SemanticModel semanticModel) @@ -479,7 +482,7 @@ private IAnonymousObjectCreationOperation CreateBoundAnonymousObjectCreationExpr private IPropertyReferenceOperation CreateBoundAnonymousPropertyDeclarationOperation(BoundAnonymousPropertyDeclaration boundAnonymousPropertyDeclaration) { PropertySymbol property = boundAnonymousPropertyDeclaration.Property; - Lazy instance = new Lazy(() => null); + Lazy instance = _lazyNullOperation; Lazy> arguments = new Lazy>(() => ImmutableArray.Empty); SyntaxNode syntax = boundAnonymousPropertyDeclaration.Syntax; ITypeSymbol type = boundAnonymousPropertyDeclaration.Type; @@ -1309,7 +1312,7 @@ private IWhileLoopOperation CreateBoundWhileStatementOperation(BoundWhileStateme { Lazy condition = new Lazy(() => Create(boundWhileStatement.Condition)); Lazy body = new Lazy(() => Create(boundWhileStatement.Body)); - Lazy ignoredCondition = new Lazy(() => null); + Lazy ignoredCondition = _lazyNullOperation; ImmutableArray locals = boundWhileStatement.Locals.As(); bool conditionIsTop = true; bool conditionIsUntil = false; @@ -1324,7 +1327,7 @@ private IWhileLoopOperation CreateBoundDoStatementOperation(BoundDoStatement bou { Lazy condition = new Lazy(() => Create(boundDoStatement.Condition)); Lazy body = new Lazy(() => Create(boundDoStatement.Body)); - Lazy ignoredCondition = new Lazy(() => null); + Lazy ignoredCondition = _lazyNullOperation; bool conditionIsTop = false; bool conditionIsUntil = false; ImmutableArray locals = boundDoStatement.Locals.As(); @@ -1366,7 +1369,7 @@ private IForEachLoopOperation CreateBoundForEachStatementOperation(BoundForEachS } else { - loopControlVariable = new Lazy(() => null); + loopControlVariable = _lazyNullOperation; } Lazy collection = new Lazy(() => Create(boundForEachStatement.Expression)); diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 934991158476f..7730f9a851634 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -13,6 +13,9 @@ Namespace Microsoft.CodeAnalysis.Operations Private ReadOnly _cache As ConcurrentDictionary(Of BoundNode, IOperation) = New ConcurrentDictionary(Of BoundNode, IOperation)(concurrencyLevel:=2, capacity:=10) + Private ReadOnly _lazyNothingOperation As Lazy(Of IOperation) = + New Lazy(Of IOperation)(Function() Nothing) + Private ReadOnly _semanticModel As SemanticModel Public Sub New(semanticModel As SemanticModel) @@ -1215,7 +1218,7 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundWhileStatementOperation(boundWhileStatement As BoundWhileStatement) As IWhileLoopOperation Dim condition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundWhileStatement.Condition)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundWhileStatement.Body)) - Dim ignoredCondition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Nothing) + Dim ignoredCondition As Lazy(Of IOperation) = _lazyNothingOperation Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty Dim conditionIsTop As Boolean = True Dim conditionIsUntil As Boolean = False @@ -1246,7 +1249,7 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundLabelStatementOperation(boundLabelStatement As BoundLabelStatement) As ILabeledOperation Dim label As ILabelSymbol = boundLabelStatement.Label - Dim statement As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Nothing) + Dim statement As Lazy(Of IOperation) = _lazyNothingOperation Dim syntax As SyntaxNode = boundLabelStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() @@ -1493,7 +1496,7 @@ Namespace Microsoft.CodeAnalysis.Operations End Function Private Function CreateBoundAnonymousTypePropertyAccessOperation(boundAnonymousTypePropertyAccess As BoundAnonymousTypePropertyAccess) As IPropertyReferenceOperation - Dim instance As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Nothing) + Dim instance As Lazy(Of IOperation) = _lazyNothingOperation Dim [property] As IPropertySymbol = DirectCast(boundAnonymousTypePropertyAccess.ExpressionSymbol, IPropertySymbol) Dim arguments As Lazy(Of ImmutableArray(Of IArgumentOperation)) = New Lazy(Of ImmutableArray(Of IArgumentOperation))(Function() ImmutableArray(Of IArgumentOperation).Empty) Dim syntax As SyntaxNode = boundAnonymousTypePropertyAccess.Syntax From 15756779f4c0fbeaa5bd7fe9f2cfe77d1daecf33 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 09:23:53 -0800 Subject: [PATCH 18/28] Address recent feedback and do not generate an IParenthesizedOperation for C#. This change is now just a test-only change that verifies the current behavior. --- .../Operations/CSharpOperationFactory.cs | 29 +- .../Diagnostics/OperationAnalyzerTests.cs | 2 +- ...ationTests_IAnonymousFunctionExpression.cs | 63 ++-- ...nTests_IArrayElementReferenceExpression.cs | 8 +- ...perationTests_IBinaryOperatorExpression.cs | 264 +++++++-------- .../IOperationTests_IConversionExpression.cs | 6 +- ...rationTests_IDelegateCreationExpression.cs | 72 ++-- .../IOperationTests_IForLoopStatement.cs | 12 +- .../IOperationTests_IIfStatement.cs | 8 +- ...tionTests_IParameterReferenceExpression.cs | 12 +- .../IOperationTests_IParenthesized.cs | 317 +++++++++++------- ...OperationTests_IWhileUntilLoopStatement.cs | 90 +++-- .../IOperationTests_InvalidExpression.cs | 18 +- .../Semantic/Semantics/DeconstructionTests.cs | 28 +- .../ObjectAndCollectionInitializerTests.cs | 12 +- .../Test/Semantic/Semantics/OperatorTests.cs | 24 +- .../Test/Semantic/Semantics/QueryTests.cs | 40 +-- .../Symbols/AnonymousTypesSemanticsTests.cs | 44 +-- .../Diagnostics/OperationTestAnalyzer.cs | 2 +- 19 files changed, 495 insertions(+), 556 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 492f4226762b9..b7cd69f90bcdd 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -43,26 +43,6 @@ public IOperation Create(BoundNode boundNode) } private IOperation CreateInternal(BoundNode boundNode) - { - IOperation operation = CreateInternalCore(boundNode); - - // If the syntax for the bound node is parenthesized, walk up the parentheses wrapping the operation with ParenthesizedExpression operation nodes. - // Compiler generated and lowered bound nodes shouldn't be parenthesized. - if (!boundNode.WasCompilerGenerated && - boundNode.Syntax.Parent is ParenthesizedExpressionSyntax parenthesizedSyntax) - { - do - { - operation = new ParenthesizedExpression(operation, _semanticModel, parenthesizedSyntax, operation.Type, operation.ConstantValue, isImplicit: false); - parenthesizedSyntax = parenthesizedSyntax.Parent as ParenthesizedExpressionSyntax; - } - while (parenthesizedSyntax != null); - } - - return operation; - } - - private IOperation CreateInternalCore(BoundNode boundNode) { switch (boundNode.Kind) { @@ -730,7 +710,7 @@ private IOperation CreateUnboundLambdaOperation(UnboundLambda unboundLambda) // We are counting on the fact that will do the error recovery and actually create the BoundLambda node appropriate for // this syntax node. BoundLambda boundLambda = unboundLambda.BindForErrorRecovery(); - return CreateInternalCore(boundLambda); + return CreateInternal(boundLambda); } private IAnonymousFunctionOperation CreateBoundLambdaOperation(BoundLambda boundLambda) @@ -791,13 +771,10 @@ private IOperation CreateBoundConversionOperation(BoundConversion boundConversio // and instead directly return the operand, which will be a BoundBadExpression. When we generate a node for the BoundBadExpression, // the resulting IOperation will also have a null Type. Debug.Assert(boundConversion.Operand.Kind == BoundKind.BadExpression); - - // We invoke CreateInternalCore for implicit conversions to avoid duplicate IParenthesizedOperation for bound conversion and its operand. - return isImplicit ? CreateInternalCore(boundConversion.Operand) : Create(boundConversion.Operand); + return Create(boundConversion.Operand); } - // We invoke CreateInternalCore for implicit conversions to avoid duplicate IParenthesizedOperation for bound conversion and its operand. - Lazy operand = new Lazy(() => isImplicit ? CreateInternalCore(boundConversion.Operand) : Create(boundConversion.Operand)); + Lazy operand = new Lazy(() => Create(boundConversion.Operand)); ITypeSymbol type = boundConversion.Type; Optional constantValue = ConvertToOptional(boundConversion.ConstantValue); diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs index d572bc7da1b23..ce7e1ff69fab2 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs @@ -1392,7 +1392,7 @@ public unsafe void M1() .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_InvalidAddrOp, "a + b").WithLocation(7, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AddressOfTestAnalyzer() }, null, null, false, Diagnostic("AddressOfOperation", "&(a + b)").WithLocation(7, 16), - Diagnostic("InvalidAddressOfReference", "(a + b)").WithLocation(7, 17), + Diagnostic("InvalidAddressOfReference", "a + b").WithLocation(7, 18), Diagnostic("AddressOfOperation", "&a").WithLocation(9, 16), Diagnostic("AddressOfOperation", "&i").WithLocation(28, 22), Diagnostic("AddressOfOperation", "&_i").WithLocation(31, 25), diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs index a56b74bc9f5bd..f8c73d4ad3aeb 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs @@ -122,19 +122,17 @@ static void F() IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= (Action)(() => F())') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action) (Syntax: '(Action)(() => F())') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null) (Syntax: '(() => F())') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => F()') - IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: 'F()') - IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsImplicit) (Syntax: 'F()') - Expression: - IInvocationOperation (void Program.F()) (OperationKind.Invocation, Type: System.Void) (Syntax: 'F()') - Instance Receiver: - null - Arguments(0) - IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: 'F()') - ReturnedValue: + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => F()') + IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: 'F()') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsImplicit) (Syntax: 'F()') + Expression: + IInvocationOperation (void Program.F()) (OperationKind.Invocation, Type: System.Void) (Syntax: 'F()') + Instance Receiver: null + Arguments(0) + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: 'F()') + ReturnedValue: + null Initializer: null "; @@ -305,22 +303,19 @@ static void F() Operand: IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => F())') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '(() => F())') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => F()') - IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') - IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') - Expression: - IInvocationOperation (void Program.F()) (OperationKind.Invocation, Type: System.Void, IsInvalid) (Syntax: 'F()') - Instance Receiver: - null - Arguments(0) - IReturnOperation (OperationKind.Return, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') - ReturnedValue: + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => F()') + IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') + Expression: + IInvocationOperation (void Program.F()) (OperationKind.Invocation, Type: System.Void, IsInvalid) (Syntax: 'F()') + Instance Receiver: null + Arguments(0) + IReturnOperation (OperationKind.Return, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') + ReturnedValue: + null Initializer: null - "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0029: Cannot implicitly convert type 'System.Action' to 'System.Action' @@ -359,16 +354,14 @@ static void F() IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= (Action F())') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => F())') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '(() => F())') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => F()') - IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') - IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') - Expression: - IInvocationOperation (void Program.F()) (OperationKind.Invocation, Type: System.Void, IsInvalid) (Syntax: 'F()') - Instance Receiver: - null - Arguments(0) + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => F()') + IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: 'F()') + Expression: + IInvocationOperation (void Program.F()) (OperationKind.Invocation, Type: System.Void, IsInvalid) (Syntax: 'F()') + Instance Receiver: + null + Arguments(0) Initializer: null "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs index dbabbe8e0f9fa..34ce3157a02ca 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArrayElementReferenceExpression.cs @@ -416,12 +416,10 @@ public static explicit operator string[](C c) string expectedOperationTree = @" IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.String) (Syntax: '((string[])c)[x]') Array reference: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.String[]) (Syntax: '((string[])c)') + IConversionOperation (TryCast: False, Unchecked) (OperatorMethod: System.String[] C.op_Explicit(C c)) (OperationKind.Conversion, Type: System.String[]) (Syntax: '(string[])c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: True) (MethodSymbol: System.String[] C.op_Explicit(C c)) Operand: - IConversionOperation (TryCast: False, Unchecked) (OperatorMethod: System.String[] C.op_Explicit(C c)) (OperationKind.Conversion, Type: System.String[]) (Syntax: '(string[])c') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: True) (MethodSymbol: System.String[] C.op_Explicit(C c)) - Operand: - IParameterReferenceOperation: c (OperationKind.ParameterReference, Type: C) (Syntax: 'c') + IParameterReferenceOperation: c (OperationKind.ParameterReference, Type: C) (Syntax: 'c') Indices(1): IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs index fdefef58f54ab..68618e82c85d5 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs @@ -197,21 +197,17 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + (b << 20)') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a >> 10)') - Operand: - IBinaryOperation (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a >> 10') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') + IBinaryOperation (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a >> 10') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(b << 20)') - Operand: - IBinaryOperation (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'b << 20') - Left: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 20) (Syntax: '20') + IBinaryOperation (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'b << 20') + Left: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 20) (Syntax: '20') Right: IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'c * d / e % f') Left: @@ -233,79 +229,67 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IParameterReferenceOperation: h (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'h') Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(i == (j != ... 0) ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') - Left: - IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') - Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(j != ((((k ... 0) ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') + Left: + IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') + Right: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') + Left: + IParameterReferenceOperation: j (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'j') + Right: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') Condition: - IBinaryOperation (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') + IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') Left: - IParameterReferenceOperation: j (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'j') - Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((((k < l ? ... p ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') - Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(((k < l ? ... o ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') + Left: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') + Left: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') Condition: - IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') + IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'k < l') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((k < l ? 1 ... m ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') - Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(k < l ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'k < l') - Left: - IParameterReferenceOperation: k (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'k') - Right: - IParameterReferenceOperation: l (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'l') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceOperation: m (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'm') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + IParameterReferenceOperation: k (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'k') Right: - IParameterReferenceOperation: o (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'o') + IParameterReferenceOperation: l (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'l') WhenTrue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'p') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceOperation: m (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'm') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceOperation: o (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'o') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'p') WhenTrue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; @@ -347,21 +331,17 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + (b << 20)') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a >> 10)') - Operand: - IBinaryOperation (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a >> 10') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') + IBinaryOperation (BinaryOperatorKind.RightShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a >> 10') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(b << 20)') - Operand: - IBinaryOperation (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'b << 20') - Left: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 20) (Syntax: '20') + IBinaryOperation (BinaryOperatorKind.LeftShift) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'b << 20') + Left: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 20) (Syntax: '20') Right: IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'c * d / e % f') Left: @@ -383,79 +363,67 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Left: IParameterReferenceOperation: h (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'h') Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(i == (j != ... 0) ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') - Left: - IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') - Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(j != ((((k ... 0) ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'i == (j != ... 0) ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i == (j != ... 0) ? 1 : 0)') + Left: + IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') + Right: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'j != ((((k ... 0) ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') + Left: + IParameterReferenceOperation: j (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'j') + Right: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') Condition: - IBinaryOperation (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j != ((((k ... p ? 1 : 0)') + IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') Left: - IParameterReferenceOperation: j (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'j') - Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((((k < l ? ... p ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(((k < l ? ... = p ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(((k < l ? ... 1 : 0) >= p') - Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(((k < l ? ... o ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '((k < l ? 1 ... = o ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') + Left: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') + Condition: + IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') + Left: + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') Condition: - IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '((k < l ? 1 ... 1 : 0) <= o') + IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'k < l') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((k < l ? 1 ... m ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: '(k < l ? 1 ... > m ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(k < l ? 1 : 0) > m') - Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(k < l ? 1 : 0)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'k < l ? 1 : 0') - Condition: - IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'k < l') - Left: - IParameterReferenceOperation: k (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'k') - Right: - IParameterReferenceOperation: l (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'l') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceOperation: m (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'm') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + IParameterReferenceOperation: k (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'k') Right: - IParameterReferenceOperation: o (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'o') + IParameterReferenceOperation: l (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'l') WhenTrue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - Right: - IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'p') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceOperation: m (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'm') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceOperation: o (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'o') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'p') WhenTrue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') WhenFalse: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs index 19fc3975a0c2b..f45b4f6930116 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConversionExpression.cs @@ -3981,10 +3981,8 @@ static void M1() IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: I2, IsInvalid) (Syntax: '(I2)()') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '()') - Operand: - IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') - Children(0) + IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') + Children(0) "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1525: Invalid expression term ')' diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs index 8b71d31b978c1..8213f9fef86b1 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IDelegateCreationExpression.cs @@ -168,13 +168,11 @@ void Main() string expectedOperationTree = @" IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action) (Syntax: '(Action)(() => { })') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null) (Syntax: '(() => { })') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => { }') - IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ }') - IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '{ }') - ReturnedValue: - null + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => { }') + IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ }') + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '{ }') + ReturnedValue: + null "; var expectedDiagnostics = DiagnosticDescription.None; @@ -198,16 +196,14 @@ void Main() string expectedOperationTree = @" IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => 1)') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '(() => 1)') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => 1') - IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: '1') - IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: '1') - Expression: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') - IReturnOperation (OperationKind.Return, Type: null, IsInvalid, IsImplicit) (Syntax: '1') - ReturnedValue: - null + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => 1') + IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: '1') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: '1') + Expression: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') + IReturnOperation (OperationKind.Return, Type: null, IsInvalid, IsImplicit) (Syntax: '1') + ReturnedValue: + null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement @@ -235,10 +231,8 @@ void Main() string expectedOperationTree = @" IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action, IsInvalid) (Syntax: '(Action)((int i) => { })') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '((int i) => { })') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '(int i) => { }') - IBlockOperation (0 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ }') + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '(int i) => { }') + IBlockOperation (0 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ }') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1593: Delegate 'Action' does not take 1 arguments @@ -1313,13 +1307,11 @@ void Main() Target: IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action) (Syntax: '(Action)(() => { })') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null) (Syntax: '(() => { })') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => { }') - IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ }') - IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '{ }') - ReturnedValue: - null + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => { }') + IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ }') + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '{ }') + ReturnedValue: + null "; var expectedDiagnostics = DiagnosticDescription.None; @@ -1345,16 +1337,14 @@ void Main() Children(1): IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action, IsInvalid) (Syntax: '(Action)(() => 1)') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '(() => 1)') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => 1') - IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: '1') - IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: '1') - Expression: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') - IReturnOperation (OperationKind.Return, Type: null, IsInvalid, IsImplicit) (Syntax: '1') - ReturnedValue: - null + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '() => 1') + IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: '1') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: '1') + Expression: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') + IReturnOperation (OperationKind.Return, Type: null, IsInvalid, IsImplicit) (Syntax: '1') + ReturnedValue: + null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement @@ -1384,10 +1374,8 @@ void Main() Children(1): IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Action, IsInvalid) (Syntax: '(Action)((int i) => { })') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '((int i) => { })') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '(int i) => { }') - IBlockOperation (0 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ }') + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: '(int i) => { }') + IBlockOperation (0 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ }') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS1593: Delegate 'Action' does not take 1 arguments diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index 41fc152a6ef05..08cf1431e8b9d 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1158,13 +1158,11 @@ static void Main(string[] args) Condition: IBinaryOperation (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(j % 2) != 0') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(j % 2)') - Operand: - IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'j % 2') - Left: - ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'j % 2') + Left: + ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') WhenTrue: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs index 3d10082bf2b02..b842d5cb88ac7 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs @@ -1140,12 +1140,10 @@ Type Arguments(0) Right: IInvocationOperation (virtual System.Boolean System.ValueType.Equals(System.Object obj)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: '((T)d).Equals(x)') Instance Receiver: - IParenthesizedOperation (OperationKind.Parenthesized, Type: T) (Syntax: '((T)d)') + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: T) (Syntax: '(T)d') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: T) (Syntax: '(T)d') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: - IParameterReferenceOperation: d (OperationKind.ParameterReference, Type: dynamic) (Syntax: 'd') + IParameterReferenceOperation: d (OperationKind.ParameterReference, Type: dynamic) (Syntax: 'd') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'x') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index 51922d25237ab..35ea6190e4e4d 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -817,13 +817,11 @@ public void M(int x) Pattern: IDeclarationPatternOperation (Declared Symbol: System.Int32 y) (OperationKind.DeclarationPattern, Type: null) (Syntax: 'var y') Guard Expression: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Boolean) (Syntax: '(x >= 10)') - Operand: - IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'x >= 10') - Left: - IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') + IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'x >= 10') + Left: + IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') Body: IBranchOperation (BranchKind.Break) (OperationKind.Branch, Type: null) (Syntax: 'break;') "; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs index fd75c0055230f..a208328f2154a 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs @@ -1,12 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Operations; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.CodeAnalysis.VisualBasic; -using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests @@ -26,18 +21,8 @@ static int M1(int a, int b) } } "; - string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') -"; - var expectedDiagnostics = DiagnosticDescription.None; - - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); } [CompilerTrait(CompilerFeature.IOperation)] @@ -81,13 +66,11 @@ static int M1(int a, int b) string expectedOperationTree = @" IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (a + b);') ReturnedValue: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') "; var expectedDiagnostics = DiagnosticDescription.None; @@ -106,21 +89,36 @@ static int M1(int a, int b) return (/**/((a + b))/**/); } } +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNestingParent() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + /**/return (((a + b)));/**/ + } +} "; string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((a + b))') - Operand: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (((a + b)));') + ReturnedValue: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') "; var expectedDiagnostics = DiagnosticDescription.None; - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [CompilerTrait(CompilerFeature.IOperation)] @@ -135,25 +133,40 @@ static int M1(int a, int b, int c) return (/**/((a + b) * c)/**/); } } +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting02Parent() + { + string source = @" +class P +{ + static int M1(int a, int b, int c) + { + /**/return (((a + b) * c));/**/ + } +} "; string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((a + b) * c)') - Operand: +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (((a + b) * c));') + ReturnedValue: IBinaryOperation (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a + b) * c') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') Right: IParameterReferenceOperation: c (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'c') "; var expectedDiagnostics = DiagnosticDescription.None; - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [CompilerTrait(CompilerFeature.IOperation)] @@ -169,40 +182,26 @@ static int M1(int a, int b) } } "; - string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(((a + b)))') - Operand: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '((a + b))') - Operand: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') -"; - var expectedDiagnostics = DiagnosticDescription.None; - - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); } [CompilerTrait(CompilerFeature.IOperation)] [Fact] - public void TestParenthesizedMultipleNesting04() + public void TestParenthesizedMultipleNesting03Parent() { string source = @" class P { static int M1(int a, int b) { - return ((/**/(a + b)/**/)); + /**/return (((a + b)));/**/ } } "; string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (((a + b)));') + ReturnedValue: IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') Left: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -211,7 +210,24 @@ static int M1(int a, int b) "; var expectedDiagnostics = DiagnosticDescription.None; - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting04() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return ((/**/(a + b)/**/)); + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); } [CompilerTrait(CompilerFeature.IOperation)] @@ -227,16 +243,8 @@ static int M1(int a, int b) } } "; - string expectedOperationTree = @" -IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') -"; - var expectedDiagnostics = DiagnosticDescription.None; - - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); } [CompilerTrait(CompilerFeature.IOperation)] @@ -252,21 +260,8 @@ static long M1(int a, int b) } } "; - string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int64) (Syntax: '(a + b)') - Operand: - IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') -"; - var expectedDiagnostics = DiagnosticDescription.None; - - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); } [CompilerTrait(CompilerFeature.IOperation)] @@ -285,16 +280,14 @@ static long M1(int a, int b) string expectedOperationTree = @" IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (a + b);') ReturnedValue: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int64) (Syntax: '(a + b)') + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') "; var expectedDiagnostics = DiagnosticDescription.None; @@ -314,18 +307,8 @@ static double M1(int a, int b) } } "; - string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') -"; - var expectedDiagnostics = DiagnosticDescription.None; - - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); } [CompilerTrait(CompilerFeature.IOperation)] @@ -347,13 +330,11 @@ static double M1(int a, int b) IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Double) (Syntax: '(double)(a + b)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(a + b)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') - Left: - IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') - Right: - IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') "; var expectedDiagnostics = DiagnosticDescription.None; @@ -372,15 +353,32 @@ static int M1() return /**/(5)/**/; } } +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedConstantValueParent() + { + string source = @" +class P +{ + static int M1() + { + /**/return (5);/**/ + } +} "; string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32, Constant: 5) (Syntax: '(5)') - Operand: +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (5);') + ReturnedValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 5) (Syntax: '5') "; var expectedDiagnostics = DiagnosticDescription.None; - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [CompilerTrait(CompilerFeature.IOperation)] @@ -397,17 +395,61 @@ static object M1(int[] a) return from r in a select /**/(-r)/**/; } } +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedQueryClauseParent() + { + string source = @" +using System.Linq; + +class P +{ + static object M1(int[] a) + { + /**/return from r in a select (-r);/**/ + } +} "; string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(-r)') - Operand: - IUnaryOperation (UnaryOperatorKind.Minus) (OperationKind.UnaryOperator, Type: System.Int32) (Syntax: '-r') +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return from ... elect (-r);') + ReturnedValue: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'from r in a select (-r)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: - IOperation: (OperationKind.None, Type: null) (Syntax: 'r') + ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from r in a select (-r)') + Expression: + IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select (-r)') + Instance Receiver: + null + Arguments(2): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from r in a') + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from r in a') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32[]) (Syntax: 'a') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: '(-r)') + IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: '(-r)') + Target: + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: '(-r)') + IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: '(-r)') + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '(-r)') + ReturnedValue: + IUnaryOperation (UnaryOperatorKind.Minus) (OperationKind.UnaryOperator, Type: System.Int32) (Syntax: '-r') + Operand: + IOperation: (OperationKind.None, Type: null) (Syntax: 'r') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; var expectedDiagnostics = DiagnosticDescription.None; - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [CompilerTrait(CompilerFeature.IOperation)] @@ -422,10 +464,27 @@ static int M1() return /**/(a)/**/; } } +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedErrorOperandParent() + { + string source = @" +class P +{ + static int M1() + { + /**/return (a);/**/ + } +} "; string expectedOperationTree = @" -IParenthesizedOperation (OperationKind.Parenthesized, Type: ?, IsInvalid) (Syntax: '(a)') - Operand: +IReturnOperation (OperationKind.Return, Type: null, IsInvalid) (Syntax: 'return (a);') + ReturnedValue: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'a') Children(0) "; @@ -435,7 +494,7 @@ static int M1() Diagnostic(ErrorCode.ERR_NameNotInContext, "a").WithArguments("a").WithLocation(6, 27) }; - VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs index dafe6a36f19df..7a8c9948a067b 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs @@ -358,13 +358,11 @@ static void Main() Condition: IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(i = value) >= 0') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(i = value)') - Operand: - ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'i = value') - Left: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') - Right: - ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'value') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'i = value') + Left: + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + Right: + ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'value') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') Body: @@ -467,13 +465,11 @@ public static int GetFirstEvenNumber(int number) Condition: IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(number % 2) == 0') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(number % 2)') - Operand: - IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'number % 2') - Left: - IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'number % 2') + Left: + IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') WhenTrue: @@ -528,13 +524,11 @@ public static int GetFirstEvenNumber(int number) Condition: IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(number % 2) == 0') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(number % 2)') - Operand: - IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'number % 2') - Left: - IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + IBinaryOperation (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'number % 2') + Left: + IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') WhenTrue: @@ -1133,16 +1127,14 @@ public void TryMethod() IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.SByte) (Syntax: '(sbyte)(x / 2)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(x / 2)') - Operand: - IBinaryOperation (BinaryOperatorKind.Divide) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x / 2') - Left: - IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'x') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.SByte) (Syntax: 'x') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + IBinaryOperation (BinaryOperatorKind.Divide) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x / 2') + Left: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.SByte) (Syntax: 'x') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') Catch clauses(0) Finally: IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') @@ -1206,16 +1198,14 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '(f ? 1 : 2)') - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(f ? 1 : 2)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') - Condition: - ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'f ? 1 : 2') + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') + Condition: + ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var x1') @@ -1305,16 +1295,14 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '(f ? 1 : 2)') - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(f ? 1 : 2)') - Operand: - IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') - Condition: - ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') - WhenTrue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - WhenFalse: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'f ? 1 : 2') + IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') + Condition: + ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') + WhenTrue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + WhenFalse: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var x1') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs index 2b7fb2160d9f8..983971f5dd93e 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_InvalidExpression.cs @@ -306,16 +306,14 @@ void F() Left: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: Program) (Syntax: 'x') Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: ?, IsInvalid) (Syntax: '(y * args.Length)') - Operand: - IBinaryOperation (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperator, Type: ?, IsInvalid) (Syntax: 'y * args.Length') - Left: - IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'y') - Children(0) - Right: - IPropertyReferenceOperation: System.Int32 System.Array.Length { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'args.Length') - Instance Receiver: - IParameterReferenceOperation: args (OperationKind.ParameterReference, Type: System.String[]) (Syntax: 'args') + IBinaryOperation (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperator, Type: ?, IsInvalid) (Syntax: 'y * args.Length') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'y') + Children(0) + Right: + IPropertyReferenceOperation: System.Int32 System.Array.Length { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'args.Length') + Instance Receiver: + IParameterReferenceOperation: args (OperationKind.ParameterReference, Type: System.String[]) (Syntax: 'args') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0103: The name 'y' does not exist in the current context diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs index 5df5fa84f727a..bc55c44d99edf 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs @@ -885,12 +885,10 @@ static void Main() string expectedOperationTree = @" IInvocationOperation (virtual System.String (System.Int32, System.String).ToString()) (OperationKind.Invocation, Type: System.String, IsInvalid) (Syntax: '((int, stri ... .ToString()') Instance Receiver: - IParenthesizedOperation (OperationKind.Parenthesized, Type: (System.Int32, System.String), IsInvalid) (Syntax: '((int, string))') - Operand: - ITupleOperation (OperationKind.Tuple, Type: (System.Int32, System.String), IsInvalid) (Syntax: '(int, string)') - Elements(2): - IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'int') - IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'string') + ITupleOperation (OperationKind.Tuple, Type: (System.Int32, System.String), IsInvalid) (Syntax: '(int, string)') + Elements(2): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'int') + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'string') Arguments(0) "; var expectedDiagnostics = new DiagnosticDescription[] { @@ -2119,16 +2117,14 @@ static void Main() string expectedOperationTree = @" ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: '(var(x, y)) ... reate(1, 2)') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: ?, IsInvalid) (Syntax: '(var(x, y))') - Operand: - IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'var(x, y)') - Children(3): - IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'var') - Children(0) - IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'x') - Children(0) - IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'y') - Children(0) + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'var(x, y)') + Children(3): + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'var') + Children(0) + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'x') + Children(0) + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'y') + Children(0) Right: IInvocationOperation (Pair Pair.Create(System.Int32 item1, System.Int32 item2)) (OperationKind.Invocation, Type: Pair) (Syntax: 'Pair.Create(1, 2)') Instance Receiver: diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs index 5c42d79e7e378..2c8d7490bbf25 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ObjectAndCollectionInitializerTests.cs @@ -3131,13 +3131,11 @@ static void Main() Initializers(1): ICollectionElementInitializerOperation (AddMethod: void C.Add(System.Int32 i)) (IsDynamic: False) (OperationKind.CollectionElementInitializer, Type: System.Void, IsImplicit) (Syntax: '(i = 1)') Arguments(1): - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(i = 1)') - Operand: - ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'i = 1') - Left: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'i = 1') + Left: + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0165: Use of unassigned local variable 'i' diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs index 3ea4b7c555434..3652fb1e36b25 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs @@ -1238,21 +1238,17 @@ static void Main() Left: IBinaryOperation (BinaryOperatorKind.Add) (OperatorMethod: S S.op_Addition(S x, S y)) (OperationKind.BinaryOperator, Type: S) (Syntax: '(a >> 10) + (b << 20)') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: S) (Syntax: '(a >> 10)') - Operand: - IBinaryOperation (BinaryOperatorKind.RightShift) (OperatorMethod: S S.op_RightShift(S x, System.Int32 y)) (OperationKind.BinaryOperator, Type: S) (Syntax: 'a >> 10') - Left: - ILocalReferenceOperation: a (OperationKind.LocalReference, Type: S) (Syntax: 'a') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') + IBinaryOperation (BinaryOperatorKind.RightShift) (OperatorMethod: S S.op_RightShift(S x, System.Int32 y)) (OperationKind.BinaryOperator, Type: S) (Syntax: 'a >> 10') + Left: + ILocalReferenceOperation: a (OperationKind.LocalReference, Type: S) (Syntax: 'a') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') Right: - IParenthesizedOperation (OperationKind.Parenthesized, Type: S) (Syntax: '(b << 20)') - Operand: - IBinaryOperation (BinaryOperatorKind.LeftShift) (OperatorMethod: S S.op_LeftShift(S x, System.Int32 y)) (OperationKind.BinaryOperator, Type: S) (Syntax: 'b << 20') - Left: - ILocalReferenceOperation: b (OperationKind.LocalReference, Type: S) (Syntax: 'b') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 20) (Syntax: '20') + IBinaryOperation (BinaryOperatorKind.LeftShift) (OperatorMethod: S S.op_LeftShift(S x, System.Int32 y)) (OperationKind.BinaryOperator, Type: S) (Syntax: 'b << 20') + Left: + ILocalReferenceOperation: b (OperationKind.LocalReference, Type: S) (Syntax: 'b') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 20) (Syntax: '20') Right: IBinaryOperation (BinaryOperatorKind.Remainder) (OperatorMethod: S S.op_Modulus(S x, S y)) (OperationKind.BinaryOperator, Type: S) (Syntax: 'c * d / e % f') Left: diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs index 8d4d93fe8210e..1f586848c3264 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs @@ -1250,25 +1250,23 @@ from int z in c3 ReturnedValue: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(x + y / 10 ... / 100) < 6') Left: - IParenthesizedOperation (OperationKind.Parenthesized, Type: System.Int32) (Syntax: '(x + y / 10 + z / 100)') - Operand: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y / 10 + z / 100') + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y / 10 + z / 100') + Left: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y / 10') Left: - IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y / 10') - Left: - IOperation: (OperationKind.None, Type: null) (Syntax: 'x') - Right: - IBinaryOperation (BinaryOperatorKind.Divide) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'y / 10') - Left: - IOperation: (OperationKind.None, Type: null) (Syntax: 'y') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') + IOperation: (OperationKind.None, Type: null) (Syntax: 'x') Right: - IBinaryOperation (BinaryOperatorKind.Divide) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'z / 100') + IBinaryOperation (BinaryOperatorKind.Divide) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'y / 10') Left: - IOperation: (OperationKind.None, Type: null) (Syntax: 'z') + IOperation: (OperationKind.None, Type: null) (Syntax: 'y') Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 100) (Syntax: '100') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') + Right: + IBinaryOperation (BinaryOperatorKind.Divide) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'z / 100') + Left: + IOperation: (OperationKind.None, Type: null) (Syntax: 'z') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 100) (Syntax: '100') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6) (Syntax: '6') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -4080,13 +4078,11 @@ Element Values(1): ReturnedValue: IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsInvalid) (Syntax: '(Func)(a => 1)') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null, IsInvalid) (Syntax: '(a => 1)') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: 'a => 1') - IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: '1') - IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '1') - ReturnedValue: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid) (Syntax: 'a => 1') + IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: '1') + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '1') + ReturnedValue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs index 354a20081e6bd..3da9d45bb378e 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs @@ -210,12 +210,10 @@ public int aa Initializers(3): IPropertyReferenceOperation: System.Int32 ClassA.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: '(new ClassA()).aa') Instance Receiver: - IParenthesizedOperation (OperationKind.Parenthesized, Type: ClassA) (Syntax: '(new ClassA())') - Operand: - IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') - Arguments(0) - Initializer: - null + IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') + Arguments(0) + Initializer: + null IFieldReferenceOperation: System.String ClassA.BB (Static) (OperationKind.FieldReference, Type: System.String, Constant: ""-=-= -"") (Syntax: 'ClassA.BB') Instance Receiver: null @@ -356,12 +354,10 @@ public int select Initializers(2): IPropertyReferenceOperation: System.Int32 ClassA.select { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: '(new ClassA()).select') Instance Receiver: - IParenthesizedOperation (OperationKind.Parenthesized, Type: ClassA) (Syntax: '(new ClassA())') - Operand: - IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') - Arguments(0) - Initializer: - null + IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') + Arguments(0) + Initializer: + null IFieldReferenceOperation: System.String ClassA.global (Static) (OperationKind.FieldReference, Type: System.String, Constant: "" -=-= -"") (Syntax: 'global') Instance Receiver: null @@ -418,13 +414,11 @@ void Main() Right: IDelegateCreationOperation (OperationKind.DelegateCreation, Type: D1) (Syntax: '(D1)(() => false)') Target: - IParenthesizedOperation (OperationKind.Parenthesized, Type: null) (Syntax: '(() => false)') - Operand: - IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => false') - IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: 'false') - IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: 'false') - ReturnedValue: - ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => false') + IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: 'false') + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: 'false') + ReturnedValue: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') "; var expectedDiagnostics = DiagnosticDescription.None; @@ -1193,12 +1187,10 @@ public static void Test1(int x) Initializers(3): IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: '(new ClassA()).aa') Children(1): - IParenthesizedOperation (OperationKind.Parenthesized, Type: ClassA) (Syntax: '(new ClassA())') - Operand: - IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') - Arguments(0) - Initializer: - null + IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') + Arguments(0) + Initializer: + null IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'ClassA.BB') Children(1): IOperation: (OperationKind.None, Type: null) (Syntax: 'ClassA') @@ -1898,4 +1890,4 @@ private int NumberOfNewKeywords(string source) #endregion } -} +} \ No newline at end of file diff --git a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs index 3904e65228089..25798e11c13c1 100644 --- a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs +++ b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs @@ -1272,7 +1272,7 @@ public sealed override void Initialize(AnalysisContext context) var addressOfOperation = (IAddressOfOperation)operationContext.Operation; operationContext.ReportDiagnostic(Diagnostic.Create(AddressOfDescriptor, addressOfOperation.Syntax.GetLocation())); - if (addressOfOperation.Reference.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) + if (addressOfOperation.Reference.Kind == OperationKind.Invalid && addressOfOperation.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) { operationContext.ReportDiagnostic(Diagnostic.Create(InvalidAddressOfReferenceDescriptor, addressOfOperation.Reference.Syntax.GetLocation())); } From 3b096a50e73093bbd10794a63109554bb955806c Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 09:26:37 -0800 Subject: [PATCH 19/28] Revert unintentional newline deletion --- .../CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs index 3da9d45bb378e..5be6c22f5293b 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs @@ -1890,4 +1890,4 @@ private int NumberOfNewKeywords(string source) #endregion } -} \ No newline at end of file +} From 893a437525a4da4f715967e7307806352ccde51e Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 09:32:29 -0800 Subject: [PATCH 20/28] Fix build errors from merge resolution --- .../CSharp/Portable/Operations/CSharpOperationFactory.cs | 2 +- .../Portable/Operations/VisualBasicOperationFactory.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 5e8985a0e0099..fd519b31eaa93 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -1361,7 +1361,7 @@ private IForEachLoopOperation CreateBoundForEachStatementOperation(BoundForEachS var local = (LocalSymbol)locals.Single(); // We use iteration variable type syntax as the underlying syntax node as there is no variable declarator syntax in the syntax tree. var declaratorSyntax = boundForEachStatement.IterationVariableType.Syntax; - loopControlVariable = new Lazy(() => OperationFactory.CreateVariableDeclaration(local, initializer: null, semanticModel: _semanticModel, syntax: declaratorSyntax)); + loopControlVariable = new Lazy(() => new VariableDeclarator(local, initializer: null, semanticModel: _semanticModel, syntax: declaratorSyntax, type: null, constantValue: default, isImplicit: false)); } else { diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index cd576c91f38a1..90836fe88dee3 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -1141,7 +1141,7 @@ Namespace Microsoft.CodeAnalysis.Operations Dim localOpt As LocalSymbol = boundForStatement.DeclaredOrInferredLocalOpt Dim controlVariable As BoundExpression = boundForStatement.ControlVariable Return If(localOpt IsNot Nothing, - OperationFactory.CreateVariableDeclaration(localOpt, initializer:=Nothing, semanticModel:=_semanticModel, syntax:=controlVariable.Syntax), + New VariableDeclarator(localOpt, initializer:=Nothing, semanticModel:=_semanticModel, syntax:=controlVariable.Syntax, type:=Nothing, constantValue:=Nothing, isImplicit:=boundForStatement.WasCompilerGenerated), Create(controlVariable)) End Function From a6ed17b26ca8891e3871d2d971b2a31ee16188b1 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 09:48:32 -0800 Subject: [PATCH 21/28] Fix unit tests --- .../IOperationTests_IForEachLoopStatement.cs | 60 ++++++------------ .../IOperationTests_IForLoopStatement.cs | 3 +- ...tionTests_IParameterReferenceExpression.cs | 3 +- .../Semantic/IOperation/IOperationTests.vb | 3 +- .../IOperationTests_IForEachLoopStatement.vb | 57 ++++++----------- .../IOperationTests_IForLoopStatement.vb | 63 +++++++------------ .../IOperationTests_InvalidStatement.vb | 9 +-- 7 files changed, 66 insertions(+), 132 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs index 05dcc5ddf09c5..98654def23dd7 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs @@ -31,8 +31,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String value LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') - Variables: Local_1: System.String value + IVariableDeclaratorOperation (Symbol: System.String value) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') Initializer: null Collection: @@ -85,8 +84,7 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String item LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') - Variables: Local_1: System.String item + IVariableDeclaratorOperation (Symbol: System.String item) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') Initializer: null Collection: @@ -140,8 +138,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (Ke ... }') Locals: Local_1: System.Collections.Generic.KeyValuePair pair LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'KeyValuePair') - Variables: Local_1: System.Collections.Generic.KeyValuePair pair + IVariableDeclaratorOperation (Symbol: System.Collections.Generic.KeyValuePair pair) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'KeyValuePair') Initializer: null Collection: @@ -212,8 +209,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 num + IVariableDeclaratorOperation (Symbol: System.Int32 num) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: @@ -276,8 +272,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 num + IVariableDeclaratorOperation (Symbol: System.Int32 num) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: @@ -338,8 +333,7 @@ orderby letter IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String value LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') - Variables: Local_1: System.String value + IVariableDeclaratorOperation (Symbol: System.String value) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') Initializer: null Collection: @@ -402,8 +396,7 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (Fi ... }') Locals: Local_1: System.Reflection.FieldInfo fi LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'FieldInfo') - Variables: Local_1: System.Reflection.FieldInfo fi + IVariableDeclaratorOperation (Symbol: System.Reflection.FieldInfo fi) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'FieldInfo') Initializer: null Collection: @@ -484,8 +477,7 @@ public void M() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (ch ... }') Locals: Local_1: System.Char c LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'char') - Variables: Local_1: System.Char c + IVariableDeclaratorOperation (Symbol: System.Char c) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'char') Initializer: null Collection: @@ -537,8 +529,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... }') Locals: Local_1: System.Collections.Generic.KeyValuePair pair LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') - Variables: Local_1: System.Collections.Generic.KeyValuePair pair + IVariableDeclaratorOperation (Symbol: System.Collections.Generic.KeyValuePair pair) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') Initializer: null Collection: @@ -604,8 +595,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (Mi ... }') Locals: Local_1: MissingType x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'MissingType') - Variables: Local_1: MissingType x + IVariableDeclaratorOperation (Symbol: MissingType x) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'MissingType') Initializer: null Collection: @@ -656,8 +646,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 x + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: @@ -688,8 +677,7 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 x + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: @@ -721,8 +709,7 @@ void F(int[] a) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... a) { x++; }') Locals: Local_1: System.Int32 x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 x + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: @@ -773,8 +760,7 @@ class Enumerator IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (lo ... x in e) { }') Locals: Local_1: System.Int64 x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'long') - Variables: Local_1: System.Int64 x + IVariableDeclaratorOperation (Symbol: System.Int64 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'long') Initializer: null Collection: @@ -806,8 +792,7 @@ void F(string s) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (var x in s) { }') Locals: Local_1: System.Char x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') - Variables: Local_1: System.Char x + IVariableDeclaratorOperation (Symbol: System.Char x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') Initializer: null Collection: @@ -841,8 +826,7 @@ class var { } IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (var x in a) { }') Locals: Local_1: C.var x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') - Variables: Local_1: C.var x + IVariableDeclaratorOperation (Symbol: C.var x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') Initializer: null Collection: @@ -874,8 +858,7 @@ void F(dynamic d) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (int x in d) { }') Locals: Local_1: System.Int32 x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 x + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: @@ -915,8 +898,7 @@ public class Enumerable IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (ob ... }') Locals: Local_1: System.Object x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object') - Variables: Local_1: System.Object x + IVariableDeclaratorOperation (Symbol: System.Object x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'object') Initializer: null Collection: @@ -963,8 +945,7 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... e)args) { }') Locals: Local_1: System.String x LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'string') - Variables: Local_1: System.String x + IVariableDeclaratorOperation (Symbol: System.String x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') Initializer: null Collection: @@ -1009,8 +990,7 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'int') - Variables: Local_1: System.Int32 num + IVariableDeclaratorOperation (Symbol: System.Int32 num) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') Initializer: null Collection: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index a0dcd597673cb..f1a872f527b95 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1969,8 +1969,7 @@ select z into w IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... }') Locals: Local_1: System.String item LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') - Variables: Local_1: System.String item + IVariableDeclaratorOperation (Symbol: System.String item) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') Initializer: null Collection: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index e44eebd7d9d57..cd33bd738f8ac 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -1040,8 +1040,7 @@ static IEnumerable MyIterator(IEnumerable source, Func predica IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... rn element;') Locals: Local_1: T element LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var') - Variables: Local_1: T element + IVariableDeclaratorOperation (Symbol: T element) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') Initializer: null Collection: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index 4396b90ae204e..1c9e00336bf3f 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -289,8 +289,7 @@ End Class]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i = 0 T ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i') Initializer: null InitialValue: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb index ef11f4e328fb2..1c9a5801cfe67 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb @@ -31,8 +31,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each s ... Next') Locals: Local_1: s As System.String LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 's As String') - Variables: Local_1: s As System.String + IVariableDeclaratorOperation (Symbol: s As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 's As String') Initializer: null Collection: @@ -80,8 +79,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each it ... Next') Locals: Local_1: item As System.String LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'item As String') - Variables: Local_1: item As System.String + IVariableDeclaratorOperation (Symbol: item As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'item As String') Initializer: null Collection: @@ -129,8 +127,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Char') - Variables: Local_1: y As System.Char + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Char') Initializer: null Collection: @@ -188,8 +185,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next y, x') Locals: Local_1: x As System.String LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As String') - Variables: Local_1: x As System.String + IVariableDeclaratorOperation (Symbol: x As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As String') Initializer: null Collection: @@ -202,8 +198,7 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next y, x') Locals: Local_1: y As System.Char LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Char') - Variables: Local_1: y As System.Char + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Char') Initializer: null Collection: @@ -266,8 +261,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Integer') - Variables: Local_1: y As System.Int32 + IVariableDeclaratorOperation (Symbol: y As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Integer') Initializer: null Collection: @@ -314,8 +308,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.String LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As String') - Variables: Local_1: x As System.String + IVariableDeclaratorOperation (Symbol: x As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As String') Initializer: null Collection: @@ -328,8 +321,7 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y As Char') - Variables: Local_1: y As System.Char + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Char') Initializer: null Collection: @@ -383,8 +375,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') - Variables: Local_1: x As System.Object + IVariableDeclaratorOperation (Symbol: x As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') Initializer: null Collection: @@ -432,8 +423,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'y') - Variables: Local_1: y As System.Char + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y') Initializer: null Collection: @@ -481,8 +471,7 @@ End Structure IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') - Variables: Local_1: x As System.Object + IVariableDeclaratorOperation (Symbol: x As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') Initializer: null Collection: @@ -565,8 +554,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each co ... Next') Locals: Local_1: country As LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'country') - Variables: Local_1: country As + IVariableDeclaratorOperation (Symbol: country As ) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'country') Initializer: null Collection: @@ -601,8 +589,7 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each cu ... Next') Locals: Local_1: customer As Customer LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'customer') - Variables: Local_1: customer As Customer + IVariableDeclaratorOperation (Symbol: customer As Customer) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'customer') Initializer: null Collection: @@ -677,8 +664,7 @@ End Module IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each [C ... Next') Locals: Local_1: Custom As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: '[Custom]') - Variables: Local_1: Custom As System.Int32 + IVariableDeclaratorOperation (Symbol: Custom As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: '[Custom]') Initializer: null Collection: @@ -757,8 +743,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') - Variables: Local_1: x As System.Object + IVariableDeclaratorOperation (Symbol: x As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') Initializer: null Collection: @@ -820,8 +805,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x') - Variables: Local_1: x As System.Int32 + IVariableDeclaratorOperation (Symbol: x As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') Initializer: null Collection: @@ -931,8 +915,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For Each el ... Next') Locals: Local_1: element As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'element As Integer') - Variables: Local_1: element As System.Int32 + IVariableDeclaratorOperation (Symbol: element As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'element As Integer') Initializer: null Collection: @@ -979,8 +962,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each s ... Next') Locals: Local_1: s As System.String LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 's As String') - Variables: Local_1: s As System.String + IVariableDeclaratorOperation (Symbol: s As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 's As String') Initializer: null Collection: @@ -1043,8 +1025,7 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each o ... Next') Locals: Local_1: o As System.Object LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'o') - Variables: Local_1: o As System.Object + IVariableDeclaratorOperation (Symbol: o As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'o') Initializer: null Collection: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb index 261182b1662f9..f6fb8a32c65d3 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb @@ -27,8 +27,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') Initializer: null InitialValue: @@ -93,8 +92,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') Initializer: null InitialValue: @@ -152,8 +150,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As Do ... Next') Locals: Local_1: i As System.Double LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Double') - Variables: Local_1: i As System.Double + IVariableDeclaratorOperation (Symbol: i As System.Double) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Double') Initializer: null InitialValue: @@ -260,8 +257,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For AVarNam ... xt AVarName') Locals: Local_1: AVarName As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'AVarName') - Variables: Local_1: AVarName As System.Int32 + IVariableDeclaratorOperation (Symbol: AVarName As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'AVarName') Initializer: null InitialValue: @@ -278,8 +274,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For B = 1 T ... Next B') Locals: Local_1: B As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'B') - Variables: Local_1: B As System.Int32 + IVariableDeclaratorOperation (Symbol: B As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'B') Initializer: null InitialValue: @@ -296,8 +291,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For C = 1 T ... Next C') Locals: Local_1: C As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'C') - Variables: Local_1: C As System.Int32 + IVariableDeclaratorOperation (Symbol: C As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'C') Initializer: null InitialValue: @@ -314,8 +308,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For D = 1 T ... Next D') Locals: Local_1: D As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'D') - Variables: Local_1: D As System.Int32 + IVariableDeclaratorOperation (Symbol: D As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'D') Initializer: null InitialValue: @@ -366,8 +359,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'I') - Variables: Local_1: I As System.Int32 + IVariableDeclaratorOperation (Symbol: I As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'I') Initializer: null InitialValue: @@ -384,8 +376,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = 1 T ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'J') - Variables: Local_1: J As System.Int32 + IVariableDeclaratorOperation (Symbol: J As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'J') Initializer: null InitialValue: @@ -446,8 +437,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'I') - Variables: Local_1: I As System.Int32 + IVariableDeclaratorOperation (Symbol: I As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'I') Initializer: null InitialValue: @@ -464,8 +454,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = I + ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'J') - Variables: Local_1: J As System.Int32 + IVariableDeclaratorOperation (Symbol: J As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'J') Initializer: null InitialValue: @@ -523,8 +512,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'I') - Variables: Local_1: I As System.Int32 + IVariableDeclaratorOperation (Symbol: I As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'I') Initializer: null InitialValue: @@ -541,8 +529,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = 1 T ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'J') - Variables: Local_1: J As System.Int32 + IVariableDeclaratorOperation (Symbol: J As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'J') Initializer: null InitialValue: @@ -597,8 +584,7 @@ End Enum IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For x As e1 ... Next') Locals: Local_1: x As e1 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As e1') - Variables: Local_1: x As e1 + IVariableDeclaratorOperation (Symbol: x As e1) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As e1') Initializer: null InitialValue: @@ -649,8 +635,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') Initializer: null InitialValue: @@ -708,8 +693,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For global_ ... Next') Locals: Local_1: global_x As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'global_x As Integer') - Variables: Local_1: global_x As System.Int32 + IVariableDeclaratorOperation (Symbol: global_x As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'global_x As Integer') Initializer: null InitialValue: @@ -751,8 +735,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For x As In ... o 10 : Next') Locals: Local_1: x As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'x As Integer') - Variables: Local_1: x As System.Int32 + IVariableDeclaratorOperation (Symbol: x As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As Integer') Initializer: null InitialValue: @@ -834,8 +817,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For element ... Next') Locals: Local_1: element1 As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'element1') - Variables: Local_1: element1 As System.Int32 + IVariableDeclaratorOperation (Symbol: element1 As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'element1') Initializer: null InitialValue: @@ -881,8 +863,7 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') Initializer: null InitialValue: @@ -1025,8 +1006,7 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For A = 1 T ... Next B, A') Locals: Local_1: A As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'A') - Variables: Local_1: A As System.Int32 + IVariableDeclaratorOperation (Symbol: A As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'A') Initializer: null InitialValue: @@ -1043,8 +1023,7 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For B = A T ... Next B, A') Locals: Local_1: B As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'B') - Variables: Local_1: B As System.Int32 + IVariableDeclaratorOperation (Symbol: B As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'B') Initializer: null InitialValue: diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb index 81b3bb3dfdc3f..b374f8197a490 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_InvalidStatement.vb @@ -236,8 +236,7 @@ End Module IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For i As In ... Next i') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') Initializer: null InitialValue: @@ -284,8 +283,7 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For Step (M ... Next') Locals: Local_1: As System.Object LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: '') - Variables: Local_1: As System.Object + IVariableDeclaratorOperation (Symbol: As System.Object) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: '') Initializer: null InitialValue: @@ -337,8 +335,7 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For i As In ... Next i') Locals: Local_1: i As System.Int32 LoopControlVariable: - IVariableDeclarationOperation (1 variables) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'i As Integer') - Variables: Local_1: i As System.Int32 + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') Initializer: null InitialValue: From 81d0ba521ad18086235ca337802c6c58b8b147d0 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 10:34:57 -0800 Subject: [PATCH 22/28] Address review feedback and add more unit tests --- .../IOperationTests_IForEachLoopStatement.cs | 44 +++++++++++++++++ .../IOperationTests_IForLoopStatement.cs | 48 +++++++++++++++++++ .../IOperationTests_IForEachLoopStatement.vb | 42 ++++++++++++++++ .../IOperationTests_IForLoopStatement.vb | 47 ++++++++++++++++++ 4 files changed, 181 insertions(+) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs index 98654def23dd7..2cc9a80e02b40 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs @@ -1232,5 +1232,49 @@ public static void M(int[] x) VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] + public void IForEachLoopStatement_InvalidLoopControlVariableDeclaration() + { + string source = @" +class X +{ + public static void M(int[] x) + { + int i = 0; + /**/foreach (int i in x) + { + }/**/ + } +} +"; + string expectedOperationTree = @" +IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') + Locals: Local_1: System.Int32 i + LoopControlVariable: + IVariableDeclaratorOperation (Symbol: System.Int32 i) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null + Collection: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32[]) (Syntax: 'x') + Body: + IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + NextVariables(0) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(7,32): error CS0136: A local or parameter named 'i' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // /**/foreach (int i in x) + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "i").WithArguments("i").WithLocation(7, 32), + // file.cs(6,13): warning CS0219: The variable 'i' is assigned but its value is never used + // int i = 0; + Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "i").WithArguments("i").WithLocation(6, 13) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index f1a872f527b95..58eaafd439424 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -2816,5 +2816,53 @@ private void M() VerifyOperationTreeForTest(source, expectedOperationTree); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void IForLoopStatement_InvalidIterationVariableDeclaration() + { + string source = @" +class Program +{ + static void Main(string[] args) + { + int i = 0; + /**/for (int i = 0; true;) + { + System.Console.WriteLine(i); + }/**/ + } +} +"; + string expectedOperationTree = @" +IForLoopOperation (LoopKind.For) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'for (int i ... }') + Locals: Local_1: System.Int32 i + Condition: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') + Before: + IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null, IsInvalid, IsImplicit) (Syntax: 'int i = 0') + IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'int i = 0') + Declarators: + IVariableDeclaratorOperation (Symbol: System.Int32 i) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'i = 0') + Initializer: + IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= 0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Initializer: + null + AtLoopBottom(0) + Body: + IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'System.Cons ... iteLine(i);') + Expression: + IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'System.Cons ... riteLine(i)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"; + VerifyOperationTreeForTest(source, expectedOperationTree); + } } } diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb index 1c9a5801cfe67..2ffb81cd35994 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb @@ -1138,5 +1138,47 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta VerifyOperationTreeAndDiagnosticsForTest(Of ForEachBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + Public Sub IForEachLoopStatement_InvalidLoopControlVariableDeclaration() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ForEachBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb index f6fb8a32c65d3..a1dcc02e8382c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb @@ -1437,5 +1437,52 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' VerifyOperationTreeAndDiagnosticsForTest(Of ForBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + Public Sub VerifyForToLoop_InvalidLoopControlVariableDeclaration() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ForBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace From c96bbb4dc0120c033527e52c47b0b5063247410c Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 12:59:58 -0800 Subject: [PATCH 23/28] Add unit test for VB --- .../Semantic/IOperation/IOperationTests.vb | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index 379aa893f7e3e..7483f1aba7fd2 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -832,5 +832,39 @@ IAnonymousFunctionOperation (Symbol: Sub ()) (OperationKind.AnonymousFunction, T VerifyOperationTreeAndDiagnosticsForTest(Of MultiLineLambdaExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + Public Sub TestGetOperationForQualifiedName() + Dim source = .Value + + Dim comp = CreateVisualBasicCompilation(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim tree = comp.SyntaxTrees.Single() + Dim model = comp.GetSemanticModel(tree) + + ' Verify we return non-null operation only for topmost member access expression. + Dim expr = CompilationUtils.FindBindingText(Of MemberAccessExpressionSyntax)(comp, tree.FilePath) + Assert.Equal("a.b", expr.ToString()) + Dim operation = model.GetOperation(expr) + Assert.NotNull(operation) + Assert.Equal(OperationKind.FieldReference, operation.Kind) + Dim fieldOperation = DirectCast(operation, IFieldReferenceOperation) + Assert.Equal("b", fieldOperation.Field.Name) + + ' Verify we return null operation for child nodes of member access expression. + Assert.Null(model.GetOperation(expr.Name)) + End Sub End Class End Namespace From 4979aef609e12756b3dc6f9ff1d0510e037ebcc9 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Wed, 27 Sep 2017 14:06:16 -0700 Subject: [PATCH 24/28] Remove IOperation feature flag and internal registration APIs for operations --- .../CSharp/Portable/Binder/Binder_Symbols.cs | 6 - .../CSharp/Portable/CSharpParseOptions.cs | 5 - .../Portable/Compilation/CSharpCompilation.cs | 6 - .../CSharp/Portable/Errors/MessageID.cs | 19 +-- src/Compilers/CSharp/Portable/Parser/Lexer.cs | 11 -- .../CSharp/Portable/Parser/SyntaxParser.cs | 28 +--- .../Diagnostics/DiagnosticAnalyzerTests.cs | 6 +- .../Diagnostics/OperationAnalyzerTests.cs | 144 +++++------------- .../Semantic/IOperation/IOperationTests.cs | 4 +- ...ationTests_IAnonymousFunctionExpression.cs | 8 +- .../IOperationTests_ISymbolInitializer.cs | 2 +- .../Test/Semantic/Semantics/OutVarTests.cs | 2 +- .../Test/Syntax/Parsing/ParsingTests.cs | 3 - .../CodeAnalysisResources.Designer.cs | 11 +- .../Core/Portable/CodeAnalysisResources.resx | 3 - .../Core/Portable/Compilation/Compilation.cs | 2 - .../Portable/Compilation/SemanticModel.cs | 10 -- .../DiagnosticAnalyzer/AnalyzerDriver.cs | 2 +- .../DiagnosticAnalyzer/AnalyzerExecutor.cs | 2 +- .../DiagnosticAnalysisContext.cs | 40 ----- .../DiagnosticAnalysisContextHelpers.cs | 8 - .../DiagnosticStartAnalysisScope.cs | 44 +----- .../Core/Portable/Operations/Operation.cs | 2 +- .../Test/Utilities/CSharp/CSharpTestBase.cs | 65 +------- .../Utilities/CSharp/SemanticModelTestBase.cs | 6 - .../Test/Utilities/CSharp/TestOptions.cs | 30 ---- .../Utilities/VisualBasic/BasicTestBase.vb | 4 +- .../Test/Utilities/VisualBasic/TestOptions.vb | 26 ---- .../Compilation/VisualBasicCompilation.vb | 12 -- .../VisualBasic/Portable/Errors/Errors.vb | 1 - .../Portable/Parser/ParserFeature.vb | 13 -- .../VisualBasic/Portable/Scanner/Scanner.vb | 5 - .../Diagnostics/OperationAnalyzerTests.vb | 140 +++++------------ .../Semantic/IOperation/IOperationTests.vb | 6 +- .../IOperationTests_ISymbolInitializer.vb | 2 +- .../IOperationTests_IUsingStatement.vb | 10 +- ...ddParameterCheckCodeRefactoringProvider.cs | 2 +- ...tializeParameterCodeRefactoringProvider.cs | 16 +- .../PopulateSwitchCodeFixProvider.cs | 3 +- .../PopulateSwitchDiagnosticAnalyzer.cs | 8 +- ...ctQualifyMemberAccessDiagnosticAnalyzer.cs | 8 +- .../UseExplicitTupleNameDiagnosticAnalyzer.cs | 8 +- ...actUseThrowExpressionDiagnosticAnalyzer.cs | 30 +--- src/Test/Utilities/Portable/CommonTestBase.cs | 6 +- .../Compilation/CompilationExtensions.cs | 2 +- .../Diagnostics/OperationTestAnalyzer.cs | 106 ------------- .../Extensions/SemanticModelExtensions.cs | 13 -- 47 files changed, 126 insertions(+), 764 deletions(-) delete mode 100644 src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs index 865c195b0898c..da9092875fd1f 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs @@ -2113,12 +2113,6 @@ private static CSDiagnosticInfo GetFeatureAvailabilityDiagnosticInfo(SyntaxTree return null; } - string requiredFeature = feature.RequiredFeature(); - if (requiredFeature != null) - { - return new CSDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature); - } - LanguageVersion availableVersion = options.LanguageVersion; LanguageVersion requiredVersion = feature.RequiredVersion(); if (requiredVersion > availableVersion) diff --git a/src/Compilers/CSharp/Portable/CSharpParseOptions.cs b/src/Compilers/CSharp/Portable/CSharpParseOptions.cs index 66ad37bc0006e..b20b5ee767be6 100644 --- a/src/Compilers/CSharp/Portable/CSharpParseOptions.cs +++ b/src/Compilers/CSharp/Portable/CSharpParseOptions.cs @@ -202,11 +202,6 @@ internal override void ValidateOptions(ArrayBuilder builder) internal bool IsFeatureEnabled(MessageID feature) { - string featureFlag = feature.RequiredFeature(); - if (featureFlag != null) - { - return Features.ContainsKey(featureFlag); - } LanguageVersion availableVersion = LanguageVersion; LanguageVersion requiredVersion = feature.RequiredVersion(); return availableVersion >= requiredVersion; diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs index 8bfa13f270fd2..ab3feffe8183e 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs @@ -3081,12 +3081,6 @@ internal bool EnableEnumArrayBlockInitialization } } - internal override bool IsIOperationFeatureEnabled() - { - var options = (CSharpParseOptions)this.SyntaxTrees.FirstOrDefault()?.Options; - return options?.IsFeatureEnabled(MessageID.IDS_FeatureIOperation) ?? false; - } - private class SymbolSearcher { private readonly Dictionary _cache; diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs index 7764903e8d2e1..935a0f2d0495b 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs @@ -126,7 +126,7 @@ internal enum MessageID IDS_FeatureTuples = MessageBase + 12711, IDS_FeatureOutVar = MessageBase + 12713, - IDS_FeatureIOperation = MessageBase + 12714, + // IDS_FeatureIOperation = MessageBase + 12714, IDS_FeatureExpressionBodiedAccessor = MessageBase + 12715, IDS_FeatureExpressionBodiedDeOrConstructor = MessageBase + 12716, IDS_ThrowExpression = MessageBase + 12717, @@ -178,23 +178,6 @@ public static LocalizableErrorArgument Localize(this MessageID id) return new LocalizableErrorArgument(id); } - // Returns the string to be used in the /features flag switch to enable the MessageID feature. - // Always call this before RequiredVersion: - // If this method returns null, call RequiredVersion and use that. - // If this method returns non-null, use that. - // Features should be mutually exclusive between RequiredFeature and RequiredVersion. - // (hence the above rule - RequiredVersion throws when RequiredFeature returns non-null) - internal static string RequiredFeature(this MessageID feature) - { - switch (feature) - { - case MessageID.IDS_FeatureIOperation: - return "IOperation"; - default: - return null; - } - } - internal static LanguageVersion RequiredVersion(this MessageID feature) { // Based on CSourceParser::GetFeatureUsage from SourceParser.cpp. diff --git a/src/Compilers/CSharp/Portable/Parser/Lexer.cs b/src/Compilers/CSharp/Portable/Parser/Lexer.cs index 2d9192cf99eb7..963cab075d827 100644 --- a/src/Compilers/CSharp/Portable/Parser/Lexer.cs +++ b/src/Compilers/CSharp/Portable/Parser/Lexer.cs @@ -901,17 +901,6 @@ private void CheckFeatureAvailability(MessageID feature) return; } - string requiredFeature = feature.RequiredFeature(); - if (requiredFeature != null) - { - if (!options.IsFeatureEnabled(feature)) - { - this.AddError(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature); - } - - return; - } - LanguageVersion availableVersion = this.Options.LanguageVersion; var requiredVersion = feature.RequiredVersion(); if (availableVersion >= requiredVersion) return; diff --git a/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs b/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs index 2dc021bd3b172..e1b4d5233f7e0 100644 --- a/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs +++ b/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs @@ -1058,30 +1058,16 @@ protected TNode CheckFeatureAvailability(TNode node, MessageID feature, b } var featureName = feature.Localize(); - var requiredFeature = feature.RequiredFeature(); - if (requiredFeature != null) - { - if (forceWarning) - { - SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, featureName, requiredFeature); - return this.AddError(node, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code); - } + var requiredVersion = feature.RequiredVersion(); - return this.AddError(node, ErrorCode.ERR_FeatureIsExperimental, featureName, requiredFeature); - } - else + if (forceWarning) { - var requiredVersion = feature.RequiredVersion(); - - if (forceWarning) - { - SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(availableVersion.GetErrorCode(), featureName, - new CSharpRequiredLanguageVersion(requiredVersion)); - return this.AddError(node, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code); - } - - return this.AddError(node, availableVersion.GetErrorCode(), featureName, new CSharpRequiredLanguageVersion(requiredVersion)); + SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(availableVersion.GetErrorCode(), featureName, + new CSharpRequiredLanguageVersion(requiredVersion)); + return this.AddError(node, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code); } + + return this.AddError(node, availableVersion.GetErrorCode(), featureName, new CSharpRequiredLanguageVersion(requiredVersion)); } protected bool IsFeatureEnabled(MessageID feature) diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs index 14bbf39255734..fa12510e08ebd 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs @@ -893,7 +893,7 @@ public void TestReportingDiagnosticWithInvalidLocation() { var source1 = @"class C1 { void M() { int i = 0; i++; } }"; var source2 = @"class C2 { void M() { int i = 0; i++; } }"; - var compilation = CreateCompilationWithMscorlib45(source1, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateCompilationWithMscorlib45(source1); var anotherCompilation = CreateCompilationWithMscorlib45(source2); var treeInAnotherCompilation = anotherCompilation.SyntaxTrees.Single(); @@ -920,7 +920,7 @@ public void TestReportingDiagnosticWithInvalidLocation() public void TestReportingDiagnosticWithInvalidSpan() { var source1 = @"class C1 { void M() { int i = 0; i++; } }"; - var compilation = CreateCompilationWithMscorlib45(source1, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateCompilationWithMscorlib45(source1); var treeInAnotherCompilation = compilation.SyntaxTrees.Single(); var badSpan = new Text.TextSpan(100000, 10000); @@ -1990,7 +1990,7 @@ void MixMethod() } } "; - var tree = CSharpSyntaxTree.ParseText(source, TestOptions.RegularWithIOperationFeature, "Source.cs"); + var tree = CSharpSyntaxTree.ParseText(source, path: "Source.cs"); var compilation = CreateCompilationWithMscorlib45(new[] { tree }); compilation.VerifyDiagnostics(); diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs index ce7e1ff69fab2..0f181fdde8cde 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs @@ -39,7 +39,7 @@ void M1() int[,][] arr12 = new int[0,0][]; // no } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new EmptyArrayAnalyzer() }, null, null, false, Diagnostic(EmptyArrayAnalyzer.UseArrayEmptyDescriptor.Id, "new int[0]").WithLocation(6, 22), @@ -101,7 +101,7 @@ class D object OField = 33; object SField = ""Zap""; }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BoxingOperationAnalyzer() }, null, null, false, Diagnostic(BoxingOperationAnalyzer.BoxingDescriptor.Id, "3").WithLocation(9, 25), @@ -132,7 +132,7 @@ public void M1(int z) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BadStuffTestAnalyzer() }, null, null, false, Diagnostic(BadStuffTestAnalyzer.InvalidExpressionDescriptor.Id, "Framitz()").WithLocation(6, 9), Diagnostic(BadStuffTestAnalyzer.IsInvalidDescriptor.Id, "Framitz()").WithLocation(6, 9), @@ -180,7 +180,7 @@ public void M1(object o) } } "; - CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions.WithIOperationsFeature()) + CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BadStuffTestAnalyzer() }, null, null, false ); @@ -209,7 +209,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BigForTestAnalyzer() }, null, null, false, Diagnostic(BigForTestAnalyzer.BigForDescriptor.Id, "for (x = 0; x < 2000000; x++) {}").WithLocation(9, 9), @@ -273,7 +273,7 @@ public void M1(int x, int y) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_EmptySwitch, "{").WithLocation(40, 20), Diagnostic(ErrorCode.ERR_ConstantExpected, ":").WithLocation(44, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SwitchTestAnalyzer() }, null, null, false, @@ -339,7 +339,7 @@ public void M6() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new InvocationTestAnalyzer() }, null, null, false, Diagnostic(InvocationTestAnalyzer.BigParamArrayArgumentsDescriptor.Id, "M0(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)").WithLocation(19, 9), @@ -417,7 +417,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new FieldCouldBeReadOnlyAnalyzer() }, null, null, false, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(8, 9), @@ -490,7 +490,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new FieldCouldBeReadOnlyAnalyzer() }, null, null, false, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(8, 16), @@ -546,7 +546,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LocalCouldBeConstAnalyzer() }, null, null, false, Diagnostic(LocalCouldBeConstAnalyzer.LocalCouldBeConstDescriptor.Id, "e").WithLocation(13, 13), @@ -718,7 +718,7 @@ interface IDerived : IMiddle, IBase2 } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SymbolCouldHaveMoreSpecificTypeAnalyzer() }, null, null, false, Diagnostic(SymbolCouldHaveMoreSpecificTypeAnalyzer.LocalCouldHaveMoreSpecificTypeDescriptor.Id, "a").WithArguments("a", "Middle").WithLocation(6, 16), @@ -784,7 +784,7 @@ enum E D = 18 } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SeventeenTestAnalyzer() }, null, null, false, Diagnostic(SeventeenTestAnalyzer.SeventeenDescriptor.Id, "17").WithLocation(4, 40), @@ -825,7 +825,7 @@ public void M3() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NullArgumentTestAnalyzer() }, null, null, false, Diagnostic(NullArgumentTestAnalyzer.NullArgumentsDescriptor.Id, "null").WithLocation(16, 12), @@ -867,7 +867,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (25,30): error CS1010: Newline in constant // var e2 = new Goo() { " }; @@ -929,7 +929,7 @@ public void M2() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AssignmentTestAnalyzer() }, null, null, false, Diagnostic("DoNotUseMemberAssignment", "Property2 = new Bar { Field = true }").WithLocation(27, 30), @@ -978,7 +978,7 @@ void M1() int[][] arr14 = new int[][] { new int[] { 1,2,3 }, new[] { 1, 2, 3, 4, 5, 6 } }; // LargeList } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ArrayInitializerTestAnalyzer() }, null, null, false, Diagnostic(ArrayInitializerTestAnalyzer.DoNotUseLargeListOfArrayInitializersDescriptor.Id, "{ 1, 2, 3, 4, 5, 6 }").WithLocation(14, 32), @@ -1012,7 +1012,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( Diagnostic(ErrorCode.ERR_IdentifierExpected, ";").WithLocation(12, 25), Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(13, 29)) @@ -1077,7 +1077,7 @@ public void M1(int x, int y) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_EmptySwitch, "{").WithLocation(37, 20), Diagnostic(ErrorCode.ERR_ConstantExpected, ":").WithLocation(41, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CaseTestAnalyzer() }, null, null, false, @@ -1119,7 +1119,7 @@ public override void M1() M2(); } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ExplicitVsImplicitInstanceAnalyzer() }, null, null, false, Diagnostic(ExplicitVsImplicitInstanceAnalyzer.ExplicitInstanceDescriptor.Id, "this").WithLocation(6, 9), @@ -1156,7 +1156,7 @@ private void Mumbler(object sender, System.EventArgs args) { } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new MemberReferenceAnalyzer() }, null, null, false, // Bug: we are missing diagnostics of "MethodBindingDescriptor" here. https://github.com/dotnet/roslyn/issues/20095 @@ -1219,7 +1219,7 @@ public D(string a, params int[] b) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ParamsArrayTestAnalyzer() }, null, null, false, Diagnostic(ParamsArrayTestAnalyzer.LongParamsDescriptor.Id, "M0(1, 2, 3, 4, 5)").WithLocation(13, 9), @@ -1245,7 +1245,7 @@ class C static int Bar(int P1 = 15, int F2 = 33) { return P1 + F2; } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new EqualsValueTestAnalyzer() }, null, null, false, Diagnostic(EqualsValueTestAnalyzer.EqualsValueDescriptor.Id, "= 44").WithLocation(4, 19), @@ -1277,7 +1277,7 @@ public void FunkyMethod() public int UnFunkyField = 12; } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new OwningSymbolTestAnalyzer() }, null, null, false, Diagnostic(OwningSymbolTestAnalyzer.ExpressionDescriptor.Id, "0").WithLocation(12, 17), @@ -1301,7 +1301,7 @@ public void M0() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NoneOperationTestAnalyzer() }, null, null, false); } @@ -1339,7 +1339,7 @@ public static long Calculate1(long[] f) } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AssignmentOperationSyntaxTestAnalyzer() }, null, null, true, Diagnostic(AssignmentOperationSyntaxTestAnalyzer.AssignmentOperationDescriptor.Id, $"x = { buildSequenceOfBinaryExpressions(8192) }").WithLocation(7, 9), @@ -1388,7 +1388,7 @@ public unsafe void M1() private int _i = 0; }"; - CreateCompilationWithMscorlib45(source, options: TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source, options: TestOptions.UnsafeReleaseDll) .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_InvalidAddrOp, "a + b").WithLocation(7, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AddressOfTestAnalyzer() }, null, null, false, Diagnostic("AddressOfOperation", "&(a + b)").WithLocation(7, 16), @@ -1432,7 +1432,7 @@ public void OnMumble(System.EventArgs args) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LambdaTestAnalyzer() }, null, null, false, Diagnostic(LambdaTestAnalyzer.LambdaExpressionDescriptor.Id, "input => { }").WithLocation(8, 31), @@ -1481,7 +1481,7 @@ void Goo() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E").WithArguments("D.E").WithLocation(6, 32)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new StaticMemberTestAnalyzer() }, null, null, false, Diagnostic(StaticMemberTestAnalyzer.StaticMemberDescriptor.Id, "C.E").WithLocation(23, 9), @@ -1508,7 +1508,7 @@ public void Fred() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LabelOperationsTestAnalyzer() }, null, null, false, Diagnostic(LabelOperationsTestAnalyzer.LabelDescriptor.Id, "Wilma: goto Betty;").WithLocation(6, 9), @@ -1568,7 +1568,7 @@ static void Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new UnaryAndBinaryOperationsTestAnalyzer() }, null, null, false, Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.BooleanNotDescriptor.Id, "!b").WithLocation(41, 13), @@ -1615,7 +1615,7 @@ static void Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_BadBinaryOps, "x + 10", new object[] { "+", "A", "int" }).WithLocation(29, 13), Diagnostic(ErrorCode.ERR_BadUnaryOp, "-x", new object[] { "-", "A" }).WithLocation(31, 13)) // no diagnostics from the analyzer since node it is looking for is invalid @@ -1643,7 +1643,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NullOperationSyntaxTestAnalyzer() }, null, null, false, Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "M0()"), @@ -1669,7 +1669,7 @@ static void Main() int i = global::MyType(); } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (8,17): error CS0023: Operator '.' cannot be applied to operand of type '' // int x = null.Length; @@ -1709,7 +1709,7 @@ public void Increment(string f) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( Diagnostic(ErrorCode.ERR_NoSuchMember, "Nan").WithArguments("float", "Nan").WithLocation(6, 27), Diagnostic(ErrorCode.ERR_BadUnaryOp, "-f").WithArguments("-", "string").WithLocation(11, 16), @@ -1736,7 +1736,7 @@ public static int Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (4,28): error CS0225: The params parameter must be a single dimensional array // public static void Goo(params int a) {} @@ -1785,7 +1785,7 @@ public void M0(C p) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ConditionalAccessOperationTestAnalyzer() }, null, null, false, Diagnostic(ConditionalAccessOperationTestAnalyzer.ConditionalAccessOperationDescriptor.Id, "p?.Prop").WithLocation(24, 17), @@ -1830,7 +1830,7 @@ void M( } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "a").WithArguments("a").WithLocation(6, 16)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LiteralTestAnalyzer() }, null, null, false, Diagnostic("Literal", "null").WithArguments("null").WithLocation(6, 20), @@ -1878,79 +1878,13 @@ public void M() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new TrueFalseUnaryOperationTestAnalyzer() }, null, null, false, Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x && y").WithLocation(29, 13), Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x").WithLocation(30, 18)); } - [Fact, WorkItem(9202, "https://github.com/dotnet/roslyn/issues/9202")] - public void IOperationFeatureFlagCSharp() - { - const string source = @" -public class A -{ - public void M() - { - var a = 1; - } -} - -"; - // with IOperation disabled (by default), public methods - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextAnalyzer() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.AnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextAnalyzer() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.CompilationStartAnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelAnalyzer() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.SemanticModelAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - // with IOperation disabled (by default), internal methods - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelInternalAnalyzer() }, null, null, true, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(6, 17)); - - // with IOperation enabled, public methods - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextAnalyzer() }, null, null, true, - Diagnostic(AnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextAnalyzer() }, null, null, true, - Diagnostic(CompilationStartAnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelAnalyzer() }, null, null, true, - Diagnostic(SemanticModelAnalyzer.GetOperationDescriptor.Id, "1").WithLocation(6, 17)); - - // with IOperation enabled, internal methods - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelInternalAnalyzer() }, null, null, true, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(6, 17)); - } - [Fact] public void TestOperationBlockAnalyzer_EmptyMethodBody() { @@ -1970,7 +1904,7 @@ public void M3(int i = 0) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new OperationBlockAnalyzer() }, null, null, false, Diagnostic("ID", "M2").WithArguments("M2", "Block").WithLocation(8, 17), diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs index 31443be10b6a3..9057d8f048af0 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs @@ -88,7 +88,7 @@ public void Deconstruct(out int a, out int b, out int c) a = b = c = 1; } }"; - var compilation = CreateStandardCompilation(text, references: new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateStandardCompilation(text, references: new[] { ValueTupleRef, SystemRuntimeFacadeRef }); compilation.VerifyDiagnostics(); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); @@ -141,7 +141,7 @@ public void GlobalStatement_Parent() var tree = compilation.SyntaxTrees.Single(); var statement = tree.GetRoot().DescendantNodes().OfType().Single(); var model = compilation.GetSemanticModel(tree); - var operation = model.GetOperationInternal(statement); + var operation = model.GetOperation(statement); Assert.Equal(OperationKind.ExpressionStatement, operation.Kind); Assert.Null(operation.Parent); diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs index f8c73d4ad3aeb..2d7ac2a0e8ace 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs @@ -401,17 +401,17 @@ static void F() var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType().Single(); var lambdaSyntax = (LambdaExpressionSyntax)variableDeclaration.Declaration.Variables.Single().Initializer.Value; - var variableDeclarationGroupOperation = (IVariableDeclarationGroupOperation)semanticModel.GetOperationInternal(variableDeclaration); + var variableDeclarationGroupOperation = (IVariableDeclarationGroupOperation)semanticModel.GetOperation(variableDeclaration); var variableTreeLambdaOperation = (IAnonymousFunctionOperation)variableDeclarationGroupOperation.Declarations.Single().Declarators.Single().Initializer.Value; - var lambdaOperation = (IAnonymousFunctionOperation)semanticModel.GetOperationInternal(lambdaSyntax); + var lambdaOperation = (IAnonymousFunctionOperation)semanticModel.GetOperation(lambdaSyntax); // Assert that both ways of getting to the lambda (requesting the lambda directly, and requesting via the lambda syntax) // return the same bound node. Assert.Same(variableTreeLambdaOperation, lambdaOperation); - var variableDeclarationGroupOperationSecondRequest = (IVariableDeclarationGroupOperation)semanticModel.GetOperationInternal(variableDeclaration); + var variableDeclarationGroupOperationSecondRequest = (IVariableDeclarationGroupOperation)semanticModel.GetOperation(variableDeclaration); var variableTreeLambdaOperationSecondRequest = (IAnonymousFunctionOperation)variableDeclarationGroupOperation.Declarations.Single().Declarators.Single(). Initializer.Value; - var lambdaOperationSecondRequest = (IAnonymousFunctionOperation)semanticModel.GetOperationInternal(lambdaSyntax); + var lambdaOperationSecondRequest = (IAnonymousFunctionOperation)semanticModel.GetOperation(lambdaSyntax); // Assert that, when request the variable declaration or the lambda for a second time, there is no rebinding of the // underlying UnboundLambda, and we get the same IAnonymousFunctionExpression as before diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs index 3a58bcb610572..42617245ac57d 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs @@ -32,7 +32,7 @@ class C var semanticModel = compilation.GetSemanticModel(tree); foreach (var node in nodes) { - Assert.Null(semanticModel.GetOperationInternal(node)); + Assert.Null(semanticModel.GetOperation(node)); } } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs index f4f8a985f1c58..8f03113f9959a 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs @@ -1097,7 +1097,7 @@ private static void AssertTypeFromOperation(SemanticModel model, TypeSymbol expe return; } - Assert.Equal(expectedType, model.GetOperationInternal(decl)?.Type); + Assert.Equal(expectedType, model.GetOperation(decl)?.Type); } private static void VerifyDataFlow(SemanticModel model, DeclarationExpressionSyntax decl, bool isDelegateCreation, bool isExecutableCode, IdentifierNameSyntax[] references, ISymbol symbol) diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs index 552d72c29af5c..5c17f8ed8e1b5 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs @@ -49,9 +49,6 @@ public static void ParseAndValidateFirst(string text, DiagnosticDescription expe public CompilationUnitSyntax ParseFile(string text, CSharpParseOptions parseOptions = null) => SyntaxFactory.ParseCompilationUnit(text, options: parseOptions); - internal CompilationUnitSyntax ParseFileExperimental(string text, MessageID feature) => - ParseFile(text, parseOptions: TestOptions.Regular.WithExperimental(feature)); - protected virtual CSharpSyntaxNode ParseNode(string text, CSharpParseOptions options) => ParseTree(text, options).GetCompilationUnitRoot(); diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs index a269db33fafcb..02d9b7fb9ee1d 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs @@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class CodeAnalysisResources { @@ -838,15 +838,6 @@ internal static string InvalidTree { } } - /// - /// Looks up a localized string similar to Feature 'IOperation' is disabled.. - /// - internal static string IOperationFeatureDisabled { - get { - return ResourceManager.GetString("IOperationFeatureDisabled", resourceCulture); - } - } - /// /// Looks up a localized string similar to Argument to '/keepalive' option is not a 32-bit integer.. /// diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.resx b/src/Compilers/Core/Portable/CodeAnalysisResources.resx index d53562649f721..5bdc66e9a3a13 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.resx +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.resx @@ -579,9 +579,6 @@ The underlying type for a tuple must be tuple-compatible. - - Feature 'IOperation' is disabled. - Unrecognized resource file format. diff --git a/src/Compilers/Core/Portable/Compilation/Compilation.cs b/src/Compilers/Core/Portable/Compilation/Compilation.cs index 8e4765099fc59..6aea4a713b8c7 100644 --- a/src/Compilers/Core/Portable/Compilation/Compilation.cs +++ b/src/Compilers/Core/Portable/Compilation/Compilation.cs @@ -2933,8 +2933,6 @@ internal bool IsTypeMissing(WellKnownType type) { return _lazyMakeWellKnownTypeMissingMap != null && _lazyMakeWellKnownTypeMissingMap.ContainsKey((int)type); } - - internal abstract bool IsIOperationFeatureEnabled(); /// /// Given a reporting unreferenced s, returns diff --git a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs index f556338ee40b1..c69bebb905d48 100644 --- a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs +++ b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs @@ -70,16 +70,6 @@ public SyntaxTree SyntaxTree /// An optional cancellation token. /// public IOperation GetOperation(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) - { - if (!this.Compilation.IsIOperationFeatureEnabled()) - { - throw new InvalidOperationException(CodeAnalysisResources.IOperationFeatureDisabled); - } - - return GetOperationInternal(node, cancellationToken); - } - - internal IOperation GetOperationInternal(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) { try { diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs index 370f6747e3da0..233877a8b6f8d 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs @@ -2058,7 +2058,7 @@ private static ImmutableArray GetOperationBlocksToAnalyze( foreach (SyntaxNode executableBlock in executableBlocks) { - IOperation operation = semanticModel.GetOperationInternal(executableBlock, cancellationToken); + IOperation operation = semanticModel.GetOperation(executableBlock, cancellationToken); if (operation != null) { operationBlocksToAnalyze.AddRange(operation); diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs index f21f9c4a2abd1..5aadc10391970 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs @@ -202,7 +202,7 @@ public AnalyzerExecutor WithCancellationToken(CancellationToken cancellationToke /// public void ExecuteInitializeMethod(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope sessionScope) { - var context = new AnalyzerAnalysisContext(analyzer, sessionScope, _compilation.IsIOperationFeatureEnabled()); + var context = new AnalyzerAnalysisContext(analyzer, sessionScope); // The Initialize method should be run asynchronously in case it is not well behaved, e.g. does not terminate. ExecuteAndCatchIfThrows( diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs index 44f6c6b17d675..e79425fa0a9fe 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs @@ -139,11 +139,6 @@ public virtual void RegisterOperationBlockStartAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body. /// An operation block action reports s about operation blocks. @@ -154,11 +149,6 @@ public virtual void RegisterOperationBlockAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed at completion of semantic analysis of an with an appropriate Kind. /// An operation action can report s about s, and can also collect @@ -171,11 +161,6 @@ public void RegisterOperationAction(Action action, par this.RegisterOperationAction(action, operationKinds.AsImmutableOrEmpty()); } - internal void RegisterOperationActionParamsArrayInternal(Action action, params OperationKind[] operationKinds) - { - this.RegisterOperationActionImmutableArrayInternal(action, operationKinds.AsImmutableOrEmpty()); - } - /// /// Register an action to be executed at completion of semantic analysis of an with an appropriate Kind. /// An operation action can report s about s, and can also collect @@ -188,11 +173,6 @@ public virtual void RegisterOperationAction(Action act throw new NotImplementedException(); } - internal virtual void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) - { - throw new NotImplementedException(); - } - /// /// Enable concurrent execution of analyzer actions registered by this analyzer. /// An analyzer that registers for concurrent execution can have better performance than a non-concurrent analyzer. @@ -383,11 +363,6 @@ public virtual void RegisterOperationBlockStartAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body. /// An operation block action reports s about operation blocks. @@ -398,11 +373,6 @@ public virtual void RegisterOperationBlockAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed at completion of parsing of a code document. /// A syntax tree action reports s about the of a document. @@ -445,11 +415,6 @@ public void RegisterOperationAction(Action action, par this.RegisterOperationAction(action, operationKinds.AsImmutableOrEmpty()); } - internal void RegisterOperationActionParamsArrayInternal(Action action, params OperationKind[] operationKinds) - { - this.RegisterOperationActionImmutableArrayInternal(action, operationKinds.AsImmutableOrEmpty()); - } - /// /// Register an action to be executed at completion of semantic analysis of an with an appropriate Kind. /// An operation action can report s about s, and can also collect @@ -462,11 +427,6 @@ public virtual void RegisterOperationAction(Action act throw new NotImplementedException(); } - internal virtual void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) - { - throw new NotImplementedException(); - } - /// /// Attempts to compute or get the cached value provided by the given for the given . /// Note that the pair {, } acts as the key. diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs index 58cf39ca3a59b..194277a4b3407 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs @@ -74,14 +74,6 @@ internal static void VerifyDiagnosticLocationsInCompilation(Diagnostic diagnosti } } - internal static void VerifyIOperationFeatureFlag(bool isIOperationFeatureEnabled) - { - if (!isIOperationFeatureEnabled) - { - throw new InvalidOperationException(CodeAnalysisResources.IOperationFeatureDisabled); - } - } - private static void VerifyDiagnosticLocationInCompilation(string id, Location location, Compilation compilation) { if (!location.IsInSource) diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs index fdbf1917ce182..17ed346982c67 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs @@ -17,14 +17,11 @@ internal sealed class AnalyzerAnalysisContext : AnalysisContext { private readonly DiagnosticAnalyzer _analyzer; private readonly HostSessionStartAnalysisScope _scope; - - private readonly bool _isIOperationFeatureEnabled; - public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope, bool isIOperationFeatureEnabled = false) + public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope) { _analyzer = analyzer; _scope = scope; - _isIOperationFeatureEnabled = isIOperationFeatureEnabled; } public override void RegisterCompilationStartAction(Action action) @@ -76,36 +73,18 @@ public override void RegisterSyntaxNodeAction(Action action, ImmutableArray operationKinds) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationActionImmutableArrayInternal(action, operationKinds); - } - - internal override void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) { DiagnosticAnalysisContextHelpers.VerifyArguments(action, operationKinds); _scope.RegisterOperationAction(_analyzer, action, operationKinds); } public override void RegisterOperationBlockStartAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockStartActionInternal(action); - } - - internal override void RegisterOperationBlockStartActionInternal(Action action) { DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockStartAction(_analyzer, action); } public override void RegisterOperationBlockAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockActionInternal(action); - } - - internal override void RegisterOperationBlockActionInternal(Action action) { DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockAction(_analyzer, action); @@ -130,8 +109,6 @@ internal sealed class AnalyzerCompilationStartAnalysisContext : CompilationStart private readonly DiagnosticAnalyzer _analyzer; private readonly HostCompilationStartAnalysisScope _scope; private readonly CompilationAnalysisValueProviderFactory _compilationAnalysisValueProviderFactory; - - private readonly bool _isIOperationFeatureEnabled; public AnalyzerCompilationStartAnalysisContext( DiagnosticAnalyzer analyzer, @@ -145,7 +122,6 @@ public AnalyzerCompilationStartAnalysisContext( _analyzer = analyzer; _scope = scope; _compilationAnalysisValueProviderFactory = compilationAnalysisValueProviderFactory; - _isIOperationFeatureEnabled = compilation.IsIOperationFeatureEnabled(); } public override void RegisterCompilationEndAction(Action action) @@ -184,35 +160,17 @@ public override void RegisterSyntaxNodeAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockStartActionInternal(action); - } - - internal override void RegisterOperationBlockStartActionInternal(Action action) { _scope.RegisterOperationBlockStartAction(_analyzer, action); } public override void RegisterOperationBlockAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockActionInternal(action); - } - - internal override void RegisterOperationBlockActionInternal(Action action) { DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockAction(_analyzer, action); } public override void RegisterOperationAction(Action action, ImmutableArray operationKinds) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationActionImmutableArrayInternal(action, operationKinds); - } - - internal override void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) { _scope.RegisterOperationAction(_analyzer, action, operationKinds); } diff --git a/src/Compilers/Core/Portable/Operations/Operation.cs b/src/Compilers/Core/Portable/Operations/Operation.cs index ff619bd638643..41b31d4c668d6 100644 --- a/src/Compilers/Core/Portable/Operations/Operation.cs +++ b/src/Compilers/Core/Portable/Operations/Operation.cs @@ -274,7 +274,7 @@ internal IOperation SearchParentOperation() while (currentCandidate != null) { // get operation - var tree = SemanticModel.GetOperationInternal(currentCandidate); + var tree = SemanticModel.GetOperation(currentCandidate); if (tree != null) { // walk down operation tree to see whether this tree contains parent of this operation diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 071ff745e1e1b..1a3c4a6f3f843 100644 --- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -125,35 +125,6 @@ internal CompilationVerifier CompileAndVerify( verify); } - internal CompilationVerifier CompileAndVerifyExperimental( - string source, - MessageID feature, - string expectedOutput = null, - MetadataReference[] additionalRefs = null, - IEnumerable dependencies = null, - Action sourceSymbolValidator = null, - Action assemblyValidator = null, - Action symbolValidator = null, - SignatureDescription[] expectedSignatures = null, - CSharpCompilationOptions options = null, - bool verify = true) - { - options = options ?? - ((expectedOutput != null) ? TestOptions.ReleaseExe : TestOptions.ReleaseDll); - - var compilation = CreateExperimentalCompilationWithMscorlib45(source, feature, additionalRefs, options); - - return CompileAndVerify( - compilation: compilation, - dependencies: dependencies, - sourceSymbolValidator: Translate2(sourceSymbolValidator), - assemblyValidator: assemblyValidator, - symbolValidator: Translate2(symbolValidator), - expectedSignatures: expectedSignatures, - expectedOutput: expectedOutput, - verify: verify); - } - internal CompilationVerifier CompileAndVerifyWinRt( string source, string expectedOutput = null, @@ -409,40 +380,6 @@ public static CSharpCompilation CreateStandardCompilation( assemblyName: assemblyName); } - internal static CSharpCompilation CreateExperimentalCompilationWithMscorlib45( - string text, - MessageID feature, - IEnumerable references = null, - CSharpCompilationOptions options = null, - string assemblyName = "", - string sourceFileName = "") - { - var refs = new List(); - if (references != null) - { - refs.AddRange(references); - } - refs.Add(MscorlibRef_v4_0_30316_17626); - return CreateCompilation(new[] { Parse(text, sourceFileName, TestOptions.Regular.WithExperimental(feature)) }, refs, options, assemblyName); - } - - internal static CSharpCompilation CreateExperimentalCompilationWithMscorlib45( - string[] texts, - MessageID feature, - IEnumerable references = null, - CSharpCompilationOptions options = null, - string assemblyName = "", - string sourceFileName = "") - { - var refs = new List(); - if (references != null) - { - refs.AddRange(references); - } - refs.Add(MscorlibRef_v4_0_30316_17626); - return CreateCompilation((from text in texts select Parse(text, sourceFileName, TestOptions.Regular.WithExperimental(feature))).ToArray(), refs, options, assemblyName); - } - public static CSharpCompilation CreateCompilationWithMscorlib45AndCSruntime( string text, CSharpCompilationOptions options = null, @@ -1157,7 +1094,7 @@ protected static (IOperation operation, SyntaxNode node) GetOperationAndSyntaxFo return (null, null); } - return (model.GetOperationInternal(syntaxNode), syntaxNode); + return (model.GetOperation(syntaxNode), syntaxNode); } protected static string GetOperationTreeForTest(CSharpCompilation compilation) diff --git a/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs b/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs index 4e8e871982a5a..0ee847322e7ba 100644 --- a/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs @@ -113,12 +113,6 @@ protected CompilationUtils.SemanticInfoSummary GetSemanticInfoForTest(str return GetSemanticInfoForTest(compilation); } - internal CompilationUtils.SemanticInfoSummary GetSemanticInfoForTestExperimental(string testSrc, MessageID feature) where TNode : SyntaxNode - { - var compilation = CreateExperimentalCompilationWithMscorlib45(testSrc, feature, new[] { SystemCoreRef }); - return GetSemanticInfoForTest(compilation); - } - protected CompilationUtils.SemanticInfoSummary GetSemanticInfoForTest(CSharpCompilation compilation) where TNode : SyntaxNode { var tree = compilation.SyntaxTrees[0]; diff --git a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs index bace46be72fab..2e39cb3eef536 100644 --- a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs +++ b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs @@ -27,8 +27,6 @@ public static class TestOptions // to help ensure compatibility of the semantics of the new switch binder with the old switch // binder, so that we may eliminate the old one in the future. public static readonly CSharpParseOptions Regular6WithV7SwitchBinder = Regular6.WithFeatures(new Dictionary() { { "testV7SwitchBinder", "true" } }); - - public static readonly CSharpParseOptions RegularWithIOperationFeature = Regular.WithIOperationsFeature(); public static readonly CSharpCompilationOptions ReleaseDll = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release); public static readonly CSharpCompilationOptions ReleaseExe = new CSharpCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel: OptimizationLevel.Release); @@ -83,34 +81,6 @@ public static CSharpParseOptions WithReplaceFeature(this CSharpParseOptions opti { return options; } - - internal static CSharpParseOptions WithExperimental(this CSharpParseOptions options, params MessageID[] features) - { - if (features.Length == 0) - { - throw new InvalidOperationException("Need at least one feature to enable"); - } - - var list = new List>(); - foreach (var feature in features) - { - var name = feature.RequiredFeature(); - if (name == null) - { - throw new InvalidOperationException($"{feature} is not a valid experimental feature"); - } - - - list.Add(new KeyValuePair(name, "true")); - } - - return options.WithFeatures(options.Features.Concat(list)); - } - - public static CSharpParseOptions WithIOperationsFeature(this CSharpParseOptions options) - { - return options.WithFeatures(options.Features.Concat(new[] { new KeyValuePair("IOperation", "true") })); - } } } diff --git a/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb b/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb index 6b739a42a9f21..3adfa6b8c1ef8 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb @@ -798,7 +798,7 @@ Public MustInherit Class BasicTestBaseBase Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single() Dim semanticModel = compilation.GetSemanticModel(tree) - Dim operation = semanticModel.GetOperationInternal(node) + Dim operation = semanticModel.GetOperation(node) If operation IsNot Nothing Then Return (OperationTreeVerifier.GetOperationTree(compilation, operation), node, operation) Else @@ -892,7 +892,7 @@ Public MustInherit Class BasicTestBaseBase End If Dim semanticModel = compilation.GetSemanticModel(node.SyntaxTree) - Dim operation = semanticModel.GetOperationInternal(node) + Dim operation = semanticModel.GetOperation(node) Return (operation, node) End Function diff --git a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb index b2c7183431725..2596c99399ca1 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb @@ -7,8 +7,6 @@ Public Class TestOptions Public Shared ReadOnly Script As New VisualBasicParseOptions(kind:=SourceCodeKind.Script) Public Shared ReadOnly Regular As New VisualBasicParseOptions(kind:=SourceCodeKind.Regular) - Public Shared ReadOnly RegularWithIOperationFeature As VisualBasicParseOptions = Regular.WithIOperationFeature() - Public Shared ReadOnly ReleaseDll As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel:=OptimizationLevel.Release) Public Shared ReadOnly ReleaseExe As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel:=OptimizationLevel.Release) @@ -31,28 +29,4 @@ Friend Module TestOptionExtensions Public Function WithStrictFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions Return options.WithFeatures(options.Features.Concat(New KeyValuePair(Of String, String)() {New KeyValuePair(Of String, String)("Strict", "true")})) End Function - - - Friend Function WithExperimental(options As VisualBasicParseOptions, ParamArray features As Feature()) As VisualBasicParseOptions - If features.Length = 0 Then - Throw New InvalidOperationException("Need at least one feature to enable") - End If - - Dim list As New List(Of KeyValuePair(Of String, String)) - For Each feature In features - Dim flagName = feature.GetFeatureFlag() - If flagName Is Nothing Then - Throw New InvalidOperationException($"{feature} is not an experimental feature") - End If - - list.Add(New KeyValuePair(Of String, String)(flagName, "True")) - Next - - Return options.WithFeatures(options.Features.Concat(list)) - End Function - - - Public Function WithIOperationFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions - Return options.WithFeatures(options.Features.Concat(New KeyValuePair(Of String, String)() {New KeyValuePair(Of String, String)("IOperation", "true")})) - End Function End Module diff --git a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb index 7a6a84386f5d1..6eb7ffcf34667 100644 --- a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb +++ b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb @@ -2712,18 +2712,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return New SymbolSearcher(Me).GetSymbolsWithName(predicate, filter, cancellationToken) End Function - Friend Overrides Function IsIOperationFeatureEnabled() As Boolean - Dim tree = Me.SyntaxTrees.FirstOrDefault() - If tree Is Nothing Then - Return False - End If - - Dim options = DirectCast(tree.Options, VisualBasicParseOptions) - Dim IOperationFeatureFlag = InternalSyntax.FeatureExtensions.GetFeatureFlag(InternalSyntax.Feature.IOperation) - - Return If(IOperationFeatureFlag Is Nothing, False, options.Features.ContainsKey(IOperationFeatureFlag)) - End Function - Friend Overrides Function IsUnreferencedAssemblyIdentityDiagnosticCode(code As Integer) As Boolean Select Case code Case ERRID.ERR_UnreferencedAssemblyEvent3, diff --git a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb index f47a85207a5f3..6a3cc78076937 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb @@ -2012,7 +2012,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic FEATURE_DigitSeparators FEATURE_BinaryLiterals FEATURE_Tuples - FEATURE_IOperation FEATURE_LeadingDigitSeparator FEATURE_PrivateProtected End Enum diff --git a/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb b/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb index c9be702ce7783..17ef76190dcd7 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb @@ -32,7 +32,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax DigitSeparators BinaryLiterals Tuples - IOperation InferredTupleNames LeadingDigitSeparator NonTrailingNamedArguments @@ -40,16 +39,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax End Enum Friend Module FeatureExtensions - - Friend Function GetFeatureFlag(feature As Feature) As String - Select Case feature - Case Feature.IOperation - Return "IOperation" - - Case Else - Return Nothing - End Select - End Function Friend Function GetLanguageVersion(feature As Feature) As LanguageVersion @@ -159,8 +148,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Return ERRID.FEATURE_BinaryLiterals Case Feature.Tuples Return ERRID.FEATURE_Tuples - Case Feature.IOperation - Return ERRID.FEATURE_IOperation Case Feature.LeadingDigitSeparator Return ERRID.FEATURE_LeadingDigitSeparator Case Feature.PrivateProtected diff --git a/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb b/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb index d02ac85b7dbb9..b16579c2d33ac 100644 --- a/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb +++ b/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb @@ -2677,11 +2677,6 @@ baddate: End Function Private Shared Function CheckFeatureAvailability(parseOptions As VisualBasicParseOptions, feature As Feature) As Boolean - Dim featureFlag = feature.GetFeatureFlag() - If featureFlag IsNot Nothing Then - Return parseOptions.Features.ContainsKey(featureFlag) - End If - Dim required = feature.GetLanguageVersion() Dim actual = parseOptions.LanguageVersion Return CInt(required) <= CInt(actual) diff --git a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb index 253074200985e..0ce3725f345f1 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb @@ -40,7 +40,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New EmptyArrayAnalyzer}, Nothing, Nothing, False, Diagnostic(EmptyArrayAnalyzer.UseArrayEmptyDescriptor.Id, "New Integer(-1) { }").WithLocation(3, 33), @@ -91,7 +91,7 @@ End Structure - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BoxingOperationAnalyzer}, Nothing, Nothing, False, Diagnostic(BoxingOperationAnalyzer.BoxingDescriptor.Id, "3").WithLocation(6, 32), @@ -122,7 +122,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyAnalyzerDiagnostics({New BadStuffTestAnalyzer}, Nothing, Nothing, False, Diagnostic(BadStuffTestAnalyzer.InvalidExpressionDescriptor.Id, "Framitz()").WithLocation(3, 9), Diagnostic(BadStuffTestAnalyzer.IsInvalidDescriptor.Id, "Framitz()").WithLocation(3, 9), @@ -227,7 +227,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(60, 17), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(68, 1), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(74, 22)) @@ -280,7 +280,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New InvocationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(InvocationTestAnalyzer.UseDefaultArgumentDescriptor.Id, "M3(Nothing,)").WithArguments("b").WithLocation(25, 9), @@ -354,7 +354,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New FieldCouldBeReadOnlyAnalyzer}, Nothing, Nothing, False, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(6, 12), @@ -420,7 +420,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New FieldCouldBeReadOnlyAnalyzer}, Nothing, Nothing, False, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(6, 19), @@ -474,7 +474,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LocalCouldBeConstAnalyzer}, Nothing, Nothing, False, Diagnostic(LocalCouldBeConstAnalyzer.LocalCouldBeConstDescriptor.Id, "e").WithLocation(10, 13), @@ -639,7 +639,7 @@ End Interface - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New SymbolCouldHaveMoreSpecificTypeAnalyzer}, Nothing, Nothing, False, Diagnostic(SymbolCouldHaveMoreSpecificTypeAnalyzer.LocalCouldHaveMoreSpecificTypeDescriptor.Id, "a").WithArguments("a", "Middle").WithLocation(3, 13), @@ -717,7 +717,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New SeventeenTestAnalyzer}, Nothing, Nothing, False, Diagnostic(SeventeenTestAnalyzer.SeventeenDescriptor.Id, "17").WithLocation(2, 71), @@ -761,7 +761,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NullArgumentTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NullArgumentTestAnalyzer.NullArgumentsDescriptor.Id, "Nothing").WithLocation(13, 12), @@ -802,7 +802,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedQualifiedNameInInit, "").WithLocation(20, 32)) comp.VerifyAnalyzerDiagnostics({New MemberInitializerTestAnalyzer}, Nothing, Nothing, False, Diagnostic(MemberInitializerTestAnalyzer.DoNotUseFieldInitializerDescriptor.Id, "Field").WithLocation(14, 35), @@ -851,7 +851,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New AssignmentTestAnalyzer}, Nothing, Nothing, False, Diagnostic(AssignmentTestAnalyzer.DoNotUseMemberAssignmentDescriptor.Id, ".Prop2 = New Bar() With {.Field = True}").WithLocation(21, 32), @@ -902,7 +902,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ArrayInitializerTestAnalyzer()}, Nothing, Nothing, False, Diagnostic(ArrayInitializerTestAnalyzer.DoNotUseLargeListOfArrayInitializersDescriptor.Id, "{1, 2, 3, 4, 5, 6}").WithLocation(11, 34), @@ -947,7 +947,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_ExpectedIdentifier, "").WithLocation(11, 21), Diagnostic(ERRID.ERR_UndefinedType1, "UndefType").WithArguments("UndefType").WithLocation(12, 35), @@ -1066,7 +1066,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(60, 17), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(68, 1), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(74, 22)) @@ -1113,7 +1113,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ExplicitVsImplicitInstanceAnalyzer}, Nothing, Nothing, False, Diagnostic(ExplicitVsImplicitInstanceAnalyzer.ExplicitInstanceDescriptor.Id, "Me").WithLocation(3, 9), @@ -1153,7 +1153,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New MemberReferenceAnalyzer}, Nothing, Nothing, False, ' Bug: we are missing diagnostics of "MethodBindingDescriptor" here. https://github.com/dotnet/roslyn/issues/20095 Diagnostic(MemberReferenceAnalyzer.HandlerAddedDescriptor.Id, "AddHandler Mumble, New MumbleEventHandler(AddressOf Mumbler)").WithLocation(7, 9), @@ -1206,7 +1206,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ParamsArrayTestAnalyzer}, Nothing, Nothing, False, Diagnostic(ParamsArrayTestAnalyzer.LongParamsDescriptor.Id, "M0(1, 2, 3, 4, 5)").WithLocation(9, 9), @@ -1239,7 +1239,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New EqualsValueTestAnalyzer}, Nothing, Nothing, False, Diagnostic(EqualsValueTestAnalyzer.EqualsValueDescriptor.Id, "= 44").WithLocation(2, 26), @@ -1271,7 +1271,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New OwningSymbolTestAnalyzer}, Nothing, Nothing, False, Diagnostic(OwningSymbolTestAnalyzer.ExpressionDescriptor.Id, "0").WithLocation(8, 28), @@ -1317,7 +1317,7 @@ End Class ' We have 2 OperationKind.None operations in the operation tree: ' (1) BoundUnstructedExceptionHandlingStatement for the method block with Resume statement ' (2) BoundResumeStatement for Resume statement - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NoneOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NoneOperationTestAnalyzer.NoneOperationDescriptor.Id, - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LambdaTestAnalyzer}, Nothing, Nothing, False, Diagnostic(LambdaTestAnalyzer.LambdaExpressionDescriptor.Id, "Sub() @@ -1445,7 +1445,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New StaticMemberTestAnalyzer}, Nothing, Nothing, False, Diagnostic(StaticMemberTestAnalyzer.StaticMemberDescriptor.Id, "AddHandler C.E, AddressOf D.Method").WithLocation(19, 9), @@ -1476,7 +1476,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LabelOperationsTestAnalyzer}, Nothing, Nothing, False, Diagnostic(LabelOperationsTestAnalyzer.LabelDescriptor.Id, "Wilma:").WithLocation(3, 9), @@ -1532,7 +1532,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New UnaryAndBinaryOperationsTestAnalyzer}, Nothing, Nothing, False, Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.BooleanNotDescriptor.Id, "Not b").WithLocation(33, 13), @@ -1680,7 +1680,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BinaryOperatorVBTestAnalyzer}, Nothing, Nothing, False, Diagnostic("BinaryUserDefinedOperator", "x + y").WithArguments("Add").WithLocation(109, 13), @@ -1741,7 +1741,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_DuplicateProcDef1, "-", New Object() {"Public Shared Operator -(x As B2) As B2"}).WithLocation(8, 28), Diagnostic(ERRID.ERR_TypeMismatch2, "10", New Object() {"Integer", "B2"}).WithLocation(23, 17), Diagnostic(ERRID.ERR_NoMostSpecificOverload2, "-x", New Object() {"-", vbCrLf & " 'Public Shared Operator -(x As B2) As B2': Not most specific." & vbCrLf & " 'Public Shared Operator -(x As B2) As B2': Not most specific."}).WithLocation(25, 13)) @@ -1774,7 +1774,7 @@ End Class ' TODO: array should not be treated as ParamArray argument ' https://github.com/dotnet/roslyn/issues/8570 - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NullOperationSyntaxTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "M0()").WithLocation(6, 9), @@ -1801,7 +1801,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_EndFunctionExpected, "Public Function M1(a As Double, b as C) as Double").WithLocation(2, 5), Diagnostic(ERRID.ERR_InvalidEndSub, "End Sub").WithLocation(4, 5), @@ -1832,7 +1832,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.AssertTheseDiagnostics( - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() ' https://github.com/dotnet/roslyn/issues/21294 comp.VerifyAnalyzerDiagnostics({New ConditionalAccessOperationTestAnalyzer}, Nothing, Nothing, False, @@ -1954,7 +1954,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_LoopControlMustNotBeProperty, "Moo").WithLocation(38, 13), Diagnostic(ERRID.ERR_LoopControlMustNotBeProperty, "Boo").WithLocation(41, 13), @@ -2018,7 +2018,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_ExpectedComma, "").WithLocation(6, 39), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(6, 39), @@ -2095,81 +2095,13 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New TrueFalseUnaryOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x").WithLocation(27, 12), Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x AndAlso y").WithLocation(33, 12)) End Sub - - - Public Sub IOperationFeatureFlagVisualBasic() - Dim source = - - - - - - ' with IOperation disabled (by default), public methods - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextAnalyzer}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.AnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextAnalyzer}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.CompilationStartAnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New SemanticModelAnalyzer}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.SemanticModelAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - ' with IOperation disabled (by default), internal methods - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New SemanticModelInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(3, 17)) - - ' with IOperation enabled, public methods - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextAnalyzer}, Nothing, Nothing, False, - Diagnostic(AnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextAnalyzer}, Nothing, Nothing, False, - Diagnostic(CompilationStartAnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New SemanticModelAnalyzer}, Nothing, Nothing, False, - Diagnostic(SemanticModelAnalyzer.GetOperationDescriptor.Id, "1").WithLocation(3, 17)) - - ' with IOperation enabled, internal methods - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New SemanticModelInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(3, 17)) - End Sub - Public Sub TestOperationBlockAnalyzer_EmptyMethodBody() Dim source = @@ -2189,7 +2121,7 @@ End Class - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New OperationBlockAnalyzer}, Nothing, Nothing, False, Diagnostic("ID", "M").WithArguments("M", "Block").WithLocation(2, 16), diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index 1c9e00336bf3f..403f6d5d0a375 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -46,7 +46,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) Dim nodes = tree.GetRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray() @@ -171,7 +171,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) Dim nodes = tree.GetRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray() @@ -346,7 +346,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() comp.AssertTheseDiagnostics( diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb index 1dd73494ad5d5..3f4433be2a2b3 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb @@ -33,7 +33,7 @@ End Class Dim semanticModel = compilation.GetSemanticModel(tree) For Each node In nodes - Assert.Null(semanticModel.GetOperationInternal(node)) + Assert.Null(semanticModel.GetOperation(node)) Next End Sub diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb index 15da03b954327..c235dba59d47e 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb @@ -33,12 +33,12 @@ End Module - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) CompilationUtils.AssertNoDiagnostics(comp) Dim tree = comp.SyntaxTrees.Single() Dim node = tree.GetRoot().DescendantNodes().OfType(Of UsingBlockSyntax).Single() - Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperationInternal(node), IUsingOperation) + Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperation(node), IUsingOperation) Assert.NotNull(op.Resources.Syntax) Assert.Same(node.UsingStatement, op.Resources.Syntax) @@ -68,7 +68,7 @@ End Module - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) CompilationUtils.AssertTheseDiagnostics(comp, BC30201: Expression expected. @@ -78,7 +78,7 @@ BC30201: Expression expected. Dim tree = comp.SyntaxTrees.Single() Dim node = tree.GetRoot().DescendantNodes().OfType(Of UsingBlockSyntax).Single() - Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperationInternal(node), IUsingOperation) + Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperation(node), IUsingOperation) Assert.Equal(OperationKind.Invalid, op.Resources.Kind) End Sub @@ -875,7 +875,7 @@ End Module]]> - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) CompilationUtils.AssertNoDiagnostics(comp) Dim tree = comp.SyntaxTrees.Single() diff --git a/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs b/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs index c7e8e69bfe427..858473d55936e 100644 --- a/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs @@ -104,7 +104,7 @@ private bool ContainsNullCoalesceCheck( var syntax = statement.Syntax; foreach (var coalesceNode in syntax.DescendantNodes().OfType()) { - var operation = GetOperation(semanticModel, coalesceNode, cancellationToken); + var operation = semanticModel.GetOperation(coalesceNode, cancellationToken); if (operation is ICoalesceOperation coalesceExpression) { if (IsParameterReference(coalesceExpression.Value, parameter) && diff --git a/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs b/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs index 5ff3d2ada37db..097d228016ba6 100644 --- a/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs @@ -27,9 +27,6 @@ internal abstract partial class AbstractInitializeParameterCodeRefactoringProvid where TExpressionSyntax : SyntaxNode where TBinaryExpressionSyntax : TExpressionSyntax { - private static MethodInfo s_getOperationInfo = - typeof(SemanticModel).GetTypeInfo().GetDeclaredMethod("GetOperationInternal"); - protected abstract SyntaxNode GetBody(TMemberDeclarationSyntax containingMember); protected abstract bool IsImplicitConversion(Compilation compilation, ITypeSymbol source, ITypeSymbol destination); protected abstract SyntaxNode GetTypeBlock(SyntaxNode node); @@ -109,7 +106,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte var blockStatementOpt = default(IBlockOperation); if (bodyOpt != null) { - blockStatementOpt = GetOperation(semanticModel, bodyOpt, cancellationToken) as IBlockOperation; + blockStatementOpt = semanticModel.GetOperation(bodyOpt, cancellationToken) as IBlockOperation; if (blockStatementOpt == null) { return; @@ -157,7 +154,7 @@ protected static bool ContainsParameterReference( { foreach (var child in condition.Syntax.DescendantNodes().OfType()) { - var childOperation = GetOperation(semanticModel, child, cancellationToken); + var childOperation = semanticModel.GetOperation(child, cancellationToken); if (IsParameterReference(childOperation, parameter)) { return true; @@ -206,15 +203,6 @@ protected static bool IsFieldOrPropertyReference( return false; } - protected static IOperation GetOperation( - SemanticModel semanticModel, - SyntaxNode node, - CancellationToken cancellationToken) - { - return (IOperation)s_getOperationInfo.Invoke( - semanticModel, new object[] { node, cancellationToken }); - } - protected class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument) diff --git a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs index f73a3b6fb8400..106ae73233925 100644 --- a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs +++ b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs @@ -124,8 +124,7 @@ private void FixOneDiagnostic( var switchLocation = diagnostic.AdditionalLocations[0]; var switchNode = switchLocation.FindNode(cancellationToken); - var internalMethod = typeof(SemanticModel).GetTypeInfo().GetDeclaredMethod("GetOperationInternal"); - var switchStatement = (ISwitchOperation)internalMethod.Invoke(model, new object[] { switchNode, cancellationToken }); + var switchStatement = (ISwitchOperation)model.GetOperation(switchNode, cancellationToken); var enumType = switchStatement.Value.Type; var generator = editor.Generator; diff --git a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs index 652b2046832ea..c2e1a389ea98b 100644 --- a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs @@ -28,14 +28,8 @@ public PopulateSwitchDiagnosticAnalyzer() public override bool OpenFileOnly(Workspace workspace) => false; - private static MethodInfo s_registerMethod = typeof(AnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - protected override void InitializeWorker(AnalysisContext context) - => s_registerMethod.Invoke(context, new object[] - { - new Action(AnalyzeOperation), - ImmutableArray.Create(OperationKind.Switch) - }); + => context.RegisterOperationAction(AnalyzeOperation, OperationKind.Switch); private void AnalyzeOperation(OperationAnalysisContext context) { diff --git a/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs b/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs index 2401bcd2dcef0..df24efce20663 100644 --- a/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs @@ -47,14 +47,8 @@ public override bool OpenFileOnly(Workspace workspace) protected abstract bool IsAlreadyQualifiedMemberAccess(SyntaxNode node); - private static MethodInfo s_registerMethod = typeof(AnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - protected override void InitializeWorker(AnalysisContext context) - => s_registerMethod.Invoke(context, new object[] - { - new Action(AnalyzeOperation), - ImmutableArray.Create(OperationKind.FieldReference, OperationKind.PropertyReference, OperationKind.MethodReference) - }); + => context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference, OperationKind.PropertyReference, OperationKind.MethodReference); public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; diff --git a/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs b/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs index ca9f2f9f7d283..43470d86441dd 100644 --- a/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs @@ -16,8 +16,6 @@ internal class UseExplicitTupleNameDiagnosticAnalyzer : AbstractCodeStyleDiagnos { public const string ElementName = nameof(ElementName); - private static MethodInfo s_registerMethod = typeof(AnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - public UseExplicitTupleNameDiagnosticAnalyzer() : base(IDEDiagnosticIds.UseExplicitTupleNameDiagnosticId, new LocalizableResourceString(nameof(FeaturesResources.Use_explicitly_provided_tuple_name), FeaturesResources.ResourceManager, typeof(FeaturesResources)), @@ -29,11 +27,7 @@ public UseExplicitTupleNameDiagnosticAnalyzer() public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; protected override void InitializeWorker(AnalysisContext context) - => s_registerMethod.Invoke(context, new object[] - { - new Action(AnalyzeOperation), - ImmutableArray.Create(OperationKind.FieldReference) - }); + => context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference); private void AnalyzeOperation(OperationAnalysisContext context) { diff --git a/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs b/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs index 45ca882d056e2..4456c874b7f6d 100644 --- a/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs @@ -46,12 +46,6 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() public override bool OpenFileOnly(Workspace workspace) => false; - private static MethodInfo s_registerOperationActionInfo = - typeof(CompilationStartAnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - - private static MethodInfo s_getOperationInfo = - typeof(SemanticModel).GetTypeInfo().GetDeclaredMethod("GetOperationInternal"); - protected abstract bool IsSupported(ParseOptions options); protected override void InitializeWorker(AnalysisContext context) @@ -59,11 +53,7 @@ protected override void InitializeWorker(AnalysisContext context) context.RegisterCompilationStartAction(startContext => { var expressionTypeOpt = startContext.Compilation.GetTypeByMetadataName("System.Linq.Expressions.Expression`1"); - s_registerOperationActionInfo.Invoke(startContext, new object[] - { - new Action(operationContext => AnalyzeOperation(operationContext, expressionTypeOpt)), - ImmutableArray.Create(OperationKind.Throw) - }); + startContext.RegisterOperationAction(operationContext => AnalyzeOperation(operationContext, expressionTypeOpt), OperationKind.Throw); }); } @@ -118,8 +108,7 @@ private void AnalyzeOperation(OperationAnalysisContext context, INamedTypeSymbol return; } - var containingBlock = GetOperation( - semanticModel, ifOperation.Syntax.Parent, cancellationToken) as IBlockOperation; + var containingBlock = semanticModel.GetOperation(ifOperation.Syntax.Parent, cancellationToken) as IBlockOperation; if (containingBlock == null) { return; @@ -314,8 +303,7 @@ private IConditionalOperation GetContainingIfOperation( CancellationToken cancellationToken) { var throwStatement = throwOperation.Syntax; - var containingOperation = GetOperation( - semanticModel, throwStatement.Parent, cancellationToken); + var containingOperation = semanticModel.GetOperation(throwStatement.Parent, cancellationToken); if (containingOperation is IBlockOperation block) { @@ -328,8 +316,7 @@ private IConditionalOperation GetContainingIfOperation( // C# may have an intermediary block between the throw-statement // and the if-statement. Walk up one operation higher in that case. - containingOperation = GetOperation( - semanticModel, throwStatement.Parent.Parent, cancellationToken); + containingOperation = semanticModel.GetOperation(throwStatement.Parent.Parent, cancellationToken); } if (containingOperation is IConditionalOperation conditionalOperation) @@ -339,14 +326,5 @@ private IConditionalOperation GetContainingIfOperation( return null; } - - private static IOperation GetOperation( - SemanticModel semanticModel, - SyntaxNode node, - CancellationToken cancellationToken) - { - return (IOperation)s_getOperationInfo.Invoke( - semanticModel, new object[] { node, cancellationToken }); - } } } diff --git a/src/Test/Utilities/Portable/CommonTestBase.cs b/src/Test/Utilities/Portable/CommonTestBase.cs index 2c24728acc7a2..5ec0ac9d66f9e 100644 --- a/src/Test/Utilities/Portable/CommonTestBase.cs +++ b/src/Test/Utilities/Portable/CommonTestBase.cs @@ -583,7 +583,7 @@ private static void CollectTopOperations(SemanticModel model, SyntaxNode node, H { foreach (var child in node.ChildNodes()) { - var operation = model.GetOperationInternal(child); + var operation = model.GetOperation(child); if (operation != null) { // found top operation @@ -602,7 +602,7 @@ internal static void VerifyClone(SemanticModel model) { foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes()) { - var operation = model.GetOperationInternal(node); + var operation = model.GetOperation(node); if (operation == null) { continue; @@ -646,7 +646,7 @@ private static void VerifyOperationTreeSpine( { while (node != semanticModel.Root) { - var operation = semanticModel.GetOperationInternal(node); + var operation = semanticModel.GetOperation(node); if (operation != null) { Assert.True(set.Contains(operation)); diff --git a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs index 6024b872452bc..3e2cf86c7439d 100644 --- a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs +++ b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs @@ -223,7 +223,7 @@ internal static void VerifyOperationTree(this Compilation compilation, string sy private static void AppendOperationTree(SemanticModel model, SyntaxNode node, StringBuilder actualTextBuilder, int initialIndent = 0) { - IOperation operation = model.GetOperationInternal(node); + IOperation operation = model.GetOperation(node); if (operation != null) { string operationTree = OperationTreeVerifier.GetOperationTree(model.Compilation, operation, initialIndent); diff --git a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs index 25798e11c13c1..9b1dd4fc40236 100644 --- a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs +++ b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs @@ -2094,34 +2094,6 @@ public sealed override void Initialize(AnalysisContext context) } } - // This analyzer is to test internal operation action registration method in AnalysisContext - public class AnalysisContextInternalAnalyzer : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - public static readonly DiagnosticDescriptor OperationActionInternalDescriptor = new DiagnosticDescriptor( - "AnalysisContextInternal", - "An operation related action is invoked", - "An {0} action is invoked in {1} context.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(OperationActionInternalDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterOperationActionParamsArrayInternal( - (operationContext) => - { - operationContext.ReportDiagnostic( - Diagnostic.Create(OperationActionInternalDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "Analysis")); - }, - OperationKind.Literal); - } - } - // This analyzer is to test operation action registration method in CompilationStartAnalysisContext public class CompilationStartAnalysisContextAnalyzer : DiagnosticAnalyzer { @@ -2154,38 +2126,6 @@ public sealed override void Initialize(AnalysisContext context) } } - // This analyzer is to test internal operation action registration method in CompilationStartAnalysisContext - public class CompilationStartAnalysisContextInternalAnalyzer : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - public static readonly DiagnosticDescriptor OperationActionInternalDescriptor = new DiagnosticDescriptor( - "CompilationStartAnalysisContextInternal", - "An operation related action is invoked", - "An {0} action is invoked in {1} context.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(OperationActionInternalDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterCompilationStartAction( - (compilationStartContext) => - { - compilationStartContext.RegisterOperationActionParamsArrayInternal( - (operationContext) => - { - operationContext.ReportDiagnostic( - Diagnostic.Create(OperationActionInternalDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "CompilationStart within Analysis")); - }, - OperationKind.Literal); - }); - } - } - // This analyzer is to test GetOperation method in SemanticModel public class SemanticModelAnalyzer : DiagnosticAnalyzer { @@ -2229,50 +2169,4 @@ public sealed override void Initialize(AnalysisContext context) Microsoft.CodeAnalysis.VisualBasic.SyntaxKind.NumericLiteralExpression); } } - - // This analyzer is to test GetOperationInternal method in SemanticModel - public class SemanticModelInternalAnalyzer : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - - public static readonly DiagnosticDescriptor GetOperationInternalDescriptor = new DiagnosticDescriptor( - "GetOperationInternal", - "An IOperation is returned by SemanticModel", - "An IOperation is returned by SemanticModel.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(GetOperationInternalDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterSyntaxNodeAction( - (syntaxContext) => - { - var node = syntaxContext.Node; - var model = syntaxContext.SemanticModel; - if (model.GetOperationInternal(node) != null) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(GetOperationInternalDescriptor, node.GetLocation())); - } - }, - Microsoft.CodeAnalysis.CSharp.SyntaxKind.NumericLiteralExpression); - - context.RegisterSyntaxNodeAction( - (syntaxContext) => - { - var node = syntaxContext.Node; - var model = syntaxContext.SemanticModel; - if (model.GetOperationInternal(node) != null) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(GetOperationInternalDescriptor, node.GetLocation())); - } - }, - Microsoft.CodeAnalysis.VisualBasic.SyntaxKind.NumericLiteralExpression); - } - } } diff --git a/src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs b/src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs deleted file mode 100644 index a69daa2103b26..0000000000000 --- a/src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Test.Extensions -{ - public static class SemanticModelExtensions - { - public static IOperation GetOperationInternal(this SemanticModel model, SyntaxNode node) - { - // Invoke the GetOperationInternal API to by-pass the IOperation feature flag check. - return model.GetOperationInternal(node); - } - } -} From 94740eaa3c32f73b5b54f701e095aa09145e9bfb Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 28 Sep 2017 12:02:00 -0700 Subject: [PATCH 25/28] Address PR feedback and remove unused resource and comment out unused error code --- .../CSharp/Portable/CSharpResources.Designer.cs | 9 --------- src/Compilers/CSharp/Portable/CSharpResources.resx | 3 --- src/Compilers/CSharp/Portable/Errors/ErrorCode.cs | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index 016d6a04a0535..2cdbe9ae4f78a 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs +++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs @@ -4516,15 +4516,6 @@ internal static string ERR_ExternHasConstructorInitializer { } } - /// - /// Looks up a localized string similar to Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable.. - /// - internal static string ERR_FeatureIsExperimental { - get { - return ResourceManager.GetString("ERR_FeatureIsExperimental", resourceCulture); - } - } - /// /// Looks up a localized string similar to Feature '{0}' is not implemented in this compiler.. /// diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index cb8c970250a71..d2f029fdcc80b 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -4401,9 +4401,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Feature '{0}' is not available in C# 7.0. Please use language version {1} or greater. - - Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable. - Feature '{0}' is not implemented in this compiler. diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index ee8f4619ebdbf..ce21872a38569 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -1294,7 +1294,7 @@ internal enum ErrorCode ERR_EncodinglessSyntaxTree = 8055, // ERR_AccessorListAndExpressionBody = 8056, Deprecated in favor of ERR_BlockBodyAndExpressionBody ERR_BlockBodyAndExpressionBody = 8057, - ERR_FeatureIsExperimental = 8058, + //ERR_FeatureIsExperimental = 8058, No experimental feature ERR_FeatureNotAvailableInVersion6 = 8059, // available 8062-8069 ERR_SwitchFallOut = 8070, From 8ab9a1283a38b74eeb9f4d1417642f8289a11c1e Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Tue, 7 Nov 2017 14:14:41 -0800 Subject: [PATCH 26/28] More fixes for IOperation tree. (#23028) Fixes #23004. Fixes #23009. Related to #22548 and #22229. --- .../Portable/Binder/Binder.ValueChecks.cs | 11 +--- .../Portable/Binder/Binder_Expressions.cs | 10 +--- .../Portable/Binder/Binder_Operators.cs | 2 +- .../Portable/Binder/Binder_Statements.cs | 2 +- .../Portable/BoundTree/BoundExpression.cs | 28 ++++++++++ .../Portable/BoundTree/BoundNodeExtensions.cs | 6 ++ .../Operations/CSharpOperationFactory.cs | 4 +- .../Test/Semantic/Semantics/IteratorTests.cs | 15 +++++ .../Semantics/PatternMatchingTests.cs | 24 +++++++- .../Semantic/Semantics/SemanticErrorTests.cs | 56 ++++++++++++++++++- .../Portable/Compilation/SemanticModel.cs | 2 +- ...ationTests_IConditionalAccessExpression.vb | 37 +++++++++++- .../Compilation/CompilationExtensions.cs | 40 +++++++++++++ 13 files changed, 211 insertions(+), 26 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs index 73de0c01030a5..9f8eba65e9c6c 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs @@ -187,16 +187,7 @@ private BoundExpression CheckValue(BoundExpression expr, BindValueKind valueKind var indexerAccess = (BoundIndexerAccess)expr; if (valueKind == BindValueKind.Assignable && !indexerAccess.Indexer.ReturnsByRef) { - expr = indexerAccess.Update(indexerAccess.ReceiverOpt, - indexerAccess.Indexer, - indexerAccess.Arguments, - indexerAccess.ArgumentNamesOpt, - indexerAccess.ArgumentRefKindsOpt, - indexerAccess.Expanded, - indexerAccess.ArgsToParamsOpt, - indexerAccess.BinderOpt, - useSetterForDefaultArgumentGeneration: true, - type: indexerAccess.Type); + expr = indexerAccess.Update(useSetterForDefaultArgumentGeneration: true); } } break; diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index 673b7a4ea6a9b..f2040d1e09b46 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -6535,7 +6535,8 @@ private BoundExpression BindPointerElementAccess(ExpressionSyntax node, BoundExp { Error(diagnostics, ErrorCode.ERR_PtrIndexSingle, node); } - return new BoundPointerElementAccess(node, expr, BadExpression(node, BuildArgumentsForErrorRecovery(analyzedArguments)), CheckOverflowAtRuntime, pointedAtType, hasErrors: true); + return new BoundPointerElementAccess(node, expr, BadExpression(node, BuildArgumentsForErrorRecovery(analyzedArguments)).MakeCompilerGenerated(), + CheckOverflowAtRuntime, pointedAtType, hasErrors: true); } if (pointedAtType.SpecialType == SpecialType.System_Void) @@ -7192,11 +7193,6 @@ private BoundExpression GetReceiverForConditionalBinding(ExpressionSyntax bindin receiver = BindConditionalAccessReceiver(conditionalAccessNode, diagnostics); } - if (receiver.HasAnyErrors) - { - return receiver; - } - // create surrogate receiver var receiverType = receiver.Type; if (receiverType?.IsNullableType() == true) @@ -7204,7 +7200,7 @@ private BoundExpression GetReceiverForConditionalBinding(ExpressionSyntax bindin receiverType = receiverType.GetNullableUnderlyingType(); } - receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType) { WasCompilerGenerated = true }; + receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType ?? CreateErrorType(), hasErrors: receiver.HasErrors) { WasCompilerGenerated = true }; return receiver; } diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs index 3e883b653798c..8c578107273c8 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs @@ -2605,7 +2605,7 @@ private bool IsOperandErrors(CSharpSyntaxNode node, ref BoundExpression operand, if (!operand.HasAnyErrors) { Error(diagnostics, ErrorCode.ERR_LambdaInIsAs, node); - operand = BadExpression(node, operand); + operand = BadExpression(node, operand).MakeCompilerGenerated(); } return true; diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs index 1550a8d290887..325fe8f8954c8 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs @@ -198,7 +198,7 @@ private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, Diagn TypeSymbol elementType = binder.GetIteratorElementType(node, diagnostics); BoundExpression argument = (node.Expression == null) - ? BadExpression(node) + ? BadExpression(node).MakeCompilerGenerated() : binder.BindValue(node.Expression, diagnostics, BindValueKind.RValue); argument = ValidateEscape(argument, ExternalScope, isByRef: false, diagnostics: diagnostics); diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs b/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs index 0101123611edc..dc8934f5e1543 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs @@ -167,6 +167,34 @@ public override Symbol ExpressionSymbol // DevDiv 1087283 tracks deciding whether or not to refactor this into BoundNodes.xml. public ImmutableArray OriginalIndexersOpt { get; private set; } + public BoundIndexerAccess Update(bool useSetterForDefaultArgumentGeneration) + { + if (useSetterForDefaultArgumentGeneration != this.UseSetterForDefaultArgumentGeneration) + { + var result = new BoundIndexerAccess( + this.Syntax, + this.ReceiverOpt, + this.Indexer, + this.Arguments, + this.ArgumentNamesOpt, + this.ArgumentRefKindsOpt, + this.Expanded, + this.ArgsToParamsOpt, + this.BinderOpt, + useSetterForDefaultArgumentGeneration, + this.Type, + this.HasErrors) + { + WasCompilerGenerated = this.WasCompilerGenerated, + OriginalIndexersOpt = this.OriginalIndexersOpt + }; + + return result; + } + + return this; + } + public override LookupResultKind ResultKind { get diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs b/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs index 94cdaccc2c71a..1b9995089a937 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs @@ -59,5 +59,11 @@ public static bool IsConstructorInitializer(this BoundCall call) receiverOpt != null && (receiverOpt.Kind == BoundKind.ThisReference || receiverOpt.Kind == BoundKind.BaseReference); } + + public static T MakeCompilerGenerated(this T node) where T : BoundNode + { + node.WasCompilerGenerated = true; + return node; + } } } diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 36c6ad004895a..c48273846b707 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -773,7 +773,9 @@ private IOperation CreateBoundConversionOperation(BoundConversion boundConversio // Semantic model has a special case here that we match: if the underlying syntax is missing, don't create a conversion expression, // and instead directly return the operand, which will be a BoundBadExpression. When we generate a node for the BoundBadExpression, // the resulting IOperation will also have a null Type. - Debug.Assert(boundConversion.Operand.Kind == BoundKind.BadExpression); + Debug.Assert(boundConversion.Operand.Kind == BoundKind.BadExpression || + ((boundConversion.Operand as BoundLambda)?.Body.Statements.SingleOrDefault() as BoundReturnStatement)?. + ExpressionOpt?.Kind == BoundKind.BadExpression); return Create(boundConversion.Operand); } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs index 28d375cc3ba9a..fb781389a2a3c 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs @@ -7,6 +7,7 @@ using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Symbols; +using Microsoft.CodeAnalysis.Test.Utilities; using System.Linq; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics @@ -408,6 +409,7 @@ protected override IEnumerable M() comp.Compilation.VerifyDiagnostics(); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] [WorkItem(261047, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=261047&_a=edit")] public void MissingExpression() @@ -428,6 +430,19 @@ IEnumerable I() // yield return; Diagnostic(ErrorCode.ERR_EmptyYield, "return").WithLocation(7, 15) ); + + var tree = comp.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("yield return;", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: +@" +IReturnOperation (OperationKind.YieldReturn, Type: null, IsInvalid) (Syntax: 'yield return;') + ReturnedValue: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'yield return;') + Children(0) +"); } [Fact] diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs index ec362dc446a2c..ac5a04ca7ee8e 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs @@ -3598,6 +3598,7 @@ static void M(object o) ); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(13383, "https://github.com/dotnet/roslyn/issues/13383")] public void MethodGroupAsExpressionInIsPatternBrokenCode() { @@ -3613,7 +3614,7 @@ static void M(object o) } } }"; - CreateCompilationWithMscorlib45(source).VerifyDiagnostics( + var compilation = CreateCompilationWithMscorlib45(source).VerifyDiagnostics( // (7,29): error CS1525: Invalid expression term ')' // if (o.Equals is()) {} Diagnostic(ErrorCode.ERR_InvalidExprTerm, ")").WithArguments(")").WithLocation(7, 29), @@ -3627,6 +3628,27 @@ static void M(object o) // if (object.Equals is()) {} Diagnostic(ErrorCode.ERR_LambdaInIsAs, "object.Equals is()").WithLocation(8, 17) ); + + var tree = compilation.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("o.Equals is()", node.ToString()); + + compilation.VerifyOperationTree(node, expectedOperationTree: +@" +IIsPatternOperation (OperationKind.IsPattern, Type: System.Boolean, IsInvalid) (Syntax: 'o.Equals is()') + Expression: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'o.Equals is()') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'o.Equals') + Children(1): + IParameterReferenceOperation: o (OperationKind.ParameterReference, Type: System.Object, IsInvalid) (Syntax: 'o') + Pattern: + IConstantPatternOperation (OperationKind.ConstantPattern, Type: null, IsInvalid) (Syntax: '()') + Value: + IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') + Children(0) +"); } [Fact, WorkItem(13383, "https://github.com/dotnet/roslyn/issues/13383")] diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs index fe49e619a7222..4734ae91a9ed4 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs @@ -6872,6 +6872,7 @@ public static void Main() new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.ERR_PtrExpected, Line = 15, Column = 7 } }); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] public void CS0196ERR_PtrIndexSingle() { @@ -6887,10 +6888,27 @@ public static void Main () // j = i[1]; } }"; - CreateStandardCompilation(text, options: TestOptions.UnsafeReleaseDll).VerifyDiagnostics( + var compilation = CreateStandardCompilation(text, options: TestOptions.UnsafeReleaseDll).VerifyDiagnostics( // (8,11): error CS0196: A pointer must be indexed by only one value // j = i[1,2]; // CS0196 Diagnostic(ErrorCode.ERR_PtrIndexSingle, "i[1,2]")); + + + var tree = compilation.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("i[1,2]", node.ToString()); + + compilation.VerifyOperationTree(node, expectedOperationTree: +@" +IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'i[1,2]') + Children(2): + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32*, IsInvalid) (Syntax: 'i') + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'i[1,2]') + Children(2): + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsInvalid) (Syntax: '2') +"); } [Fact] @@ -12484,6 +12502,8 @@ static void M(I i) } [Fact] + [CompilerTrait(CompilerFeature.IOperation)] + [WorkItem(23004, "https://github.com/dotnet/roslyn/issues/23004")] public void CS0856ERR_IndexedPropertyRequiresParams01() { var source1 = @@ -12522,6 +12542,19 @@ static void M(I i) Diagnostic(ErrorCode.ERR_IndexedPropertyRequiresParams, "i.R").WithArguments("I.R").WithLocation(8, 9), // (9,9): error CS7036: There is no argument given that corresponds to the required formal parameter 'y' of 'I.R[int, int, int]' Diagnostic(ErrorCode.ERR_NoCorrespondingArgument, "i.R[1]").WithArguments("y", "I.R[int, int, int]").WithLocation(9, 9)); + + var tree = compilation2.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("i.R[1]", node.ToString()); + + compilation2.VerifyOperationTree(node, expectedOperationTree: +@" +IInvalidOperation (OperationKind.Invalid, Type: System.Object, IsInvalid) (Syntax: 'i.R[1]') + Children(2): + IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: I, IsInvalid) (Syntax: 'i') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') +"); } [Fact] @@ -22918,6 +22951,8 @@ static void Main(string[] args) [Fact] + [CompilerTrait(CompilerFeature.IOperation)] + [WorkItem(23009, "https://github.com/dotnet/roslyn/issues/23009")] public void ConditionalElementAccess001() { var text = @" @@ -22947,7 +22982,7 @@ static void Main(string[] args) } } "; - CreateCompilationWithMscorlib45(text).VerifyDiagnostics( + var compilation = CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (11,18): error CS0175: Use of keyword 'base' is not valid in this context // var x6 = base?.ToString(); Diagnostic(ErrorCode.ERR_BaseIllegal, "base").WithLocation(11, 18), @@ -22970,8 +23005,23 @@ static void Main(string[] args) // var x5 = null?.ToString(); Diagnostic(ErrorCode.ERR_BadUnaryOp, "?").WithArguments("?", "").WithLocation(24, 22) ); - } + var tree = compilation.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("base?.ToString()", node.ToString()); + + compilation.VerifyOperationTree(node, expectedOperationTree: +@" +IConditionalAccessOperation (OperationKind.ConditionalAccess, Type: ?, IsInvalid) (Syntax: 'base?.ToString()') + Operation: + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: System.Object, IsInvalid) (Syntax: 'base') + WhenNotNull: + IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: '.ToString()') + Instance Receiver: + IConditionalAccessInstanceOperation (OperationKind.ConditionalAccessInstance, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'base') + Arguments(0) +"); + } [Fact] [WorkItem(976765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/976765")] diff --git a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs index f556338ee40b1..d79cabfa2fd42 100644 --- a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs +++ b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs @@ -88,7 +88,7 @@ public SyntaxTree SyntaxTree catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) { // Log a Non-fatal-watson and then ignore the crash in the attempt of getting operation - Debug.Assert(false); + Debug.Assert(false, e.ToString()); } return null; diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb index 0a1f8354816a8..a610b7e42d61c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb @@ -1,7 +1,8 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic.Syntax +Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics @@ -67,5 +68,39 @@ IConditionalAccessOperation (OperationKind.ConditionalAccess, Type: System.Nulla VerifyOperationTreeAndDiagnosticsForTest(Of ConditionalAccessExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + + Public Sub IConditionalAccessExpression_ErrorReceiver() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ConditionalAccessExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + End Class End Namespace diff --git a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs index 6024b872452bc..06a607953bf9d 100644 --- a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs +++ b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs @@ -12,6 +12,8 @@ using System.Threading; using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.Operations; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Test.Extensions; using Roslyn.Test.Utilities; using Roslyn.Utilities; @@ -255,6 +257,7 @@ public static void ValidateIOperations(Func createCompilation) { #if TEST_IOPERATION_INTERFACE var compilation = createCompilation(); + var roots = ArrayBuilder.GetInstance(); foreach (var tree in compilation.SyntaxTrees) { @@ -270,9 +273,46 @@ public static void ValidateIOperations(Func createCompilation) Assert.True(node == operation.Syntax, $"Expected : {node} - Actual : {operation.Syntax}"); Assert.True(operation.Type == null || !operation.MustHaveNullType(), $"Unexpected non-null type: {operation.Type}"); + + if (operation.Parent == null) + { + roots.Add(operation); + } + } + } + } + + var explictNodeMap = new Dictionary(); + + foreach (var root in roots) + { + foreach (var operation in root.DescendantsAndSelf()) + { + if (!operation.IsImplicit) + { + try + { + explictNodeMap.Add(operation.Syntax, operation); + } + catch (ArgumentException) + { + Assert.False(true, $"Duplicate explicit node for syntax ({operation.Syntax.RawKind}): {operation.Syntax.ToString()}"); + } + } + + if (operation.Kind == OperationKind.Argument) + { + var argument = (IArgumentOperation)operation; + + if (argument.ArgumentKind == ArgumentKind.DefaultValue) + { + Assert.True(argument.Descendants().All(n => n.IsImplicit), $"Explicit node in default argument value ({argument.Syntax.RawKind}): {argument.Syntax.ToString()}"); + } } } } + + roots.Free(); #endif } } From 388d0ba1b77936b5f041cc13e75d6cccd35260f5 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 7 Nov 2017 15:15:06 -0800 Subject: [PATCH 27/28] Remove usage of IOperation feature flag in newly added unit tests --- .../CSharp/Test/Semantic/IOperation/IOperationTests.cs | 2 +- .../VisualBasic/Test/Semantic/IOperation/IOperationTests.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs index 233aa809fbc32..167aa9a25d6ed 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs @@ -183,7 +183,7 @@ void M(A a) } } "; - var comp = CreateStandardCompilation(text, parseOptions: TestOptions.RegularWithIOperationFeature); + var comp = CreateStandardCompilation(text); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index c2ebe81dc4861..eb0ee29b7960c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -852,7 +852,7 @@ Public Class Test End Class ]]>.Value - Dim comp = CreateVisualBasicCompilation(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateVisualBasicCompilation(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) From 1cf4c5b634f0c82162d76195e1b52a1285bd3015 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Tue, 7 Nov 2017 17:54:48 -0800 Subject: [PATCH 28/28] Fix the operation verifier code now that getoperationinternal no longer exists. --- .../Utilities/Portable/Compilation/CompilationExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs index 6035267c914e2..7b083fb7d73a3 100644 --- a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs +++ b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs @@ -266,7 +266,7 @@ public static void ValidateIOperations(Func createCompilation) foreach (var node in root.DescendantNodesAndSelf()) { - var operation = semanticModel.GetOperationInternal(node); + var operation = semanticModel.GetOperation(node); if (operation != null) { // Make sure IOperation returned by GetOperation(syntaxnode) will have same syntaxnode as the given syntaxnode(IOperation.Syntax == syntaxnode).