From 285851f696458cc7790354e51ed123ac21c47e9c Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 22 Sep 2017 07:30:39 -0700 Subject: [PATCH] Fix unit tests after merge resolution --- .../Semantic/IOperation/IOperationTests.cs | 1 + ...rationTests_ArrayCreationAndInitializer.cs | 261 +++++++++------ .../Semantic/IOperation/IOperationTests.vb | 1 + ...rationTests_ArrayCreationAndInitializer.vb | 306 +++++++++++------- 4 files changed, 347 insertions(+), 222 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs index efda7e7e1c6..f65dd79e561 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs @@ -10,6 +10,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests { + [CompilerTrait(CompilerFeature.IOperation)] public partial class IOperationTests : SemanticModelTestBase { [CompilerTrait(CompilerFeature.IOperation)] diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.cs index 5acb8fd0351..95a33ebc8bd 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.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 Microsoft.CodeAnalysis.CSharp.Syntax; using Roslyn.Test.Utilities; @@ -21,8 +21,10 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[]) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) +IArrayCreationExpression (Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[]) (Syntax: 'new string[1]') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -42,8 +44,10 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new M[1]') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -64,8 +68,10 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - ILocalReferenceExpression: dimension (OperationKind.LocalReferenceExpression, Type: System.Int32, Constant: 1) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new M[dimension]') + Dimension Sizes(1): + ILocalReferenceExpression: dimension (OperationKind.LocalReferenceExpression, Type: System.Int32, Constant: 1) (Syntax: 'dimension') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -85,8 +91,10 @@ public void F(int dimension) } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - IParameterReferenceExpression: dimension (OperationKind.ParameterReferenceExpression, Type: System.Int32) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new M[dimension]') + Dimension Sizes(1): + IParameterReferenceExpression: dimension (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'dimension') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -106,9 +114,12 @@ public void F(char dimension) } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Int32) - IParameterReferenceExpression: dimension (OperationKind.ParameterReferenceExpression, Type: System.Char) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new M[dimension]') + Dimension Sizes(1): + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32) (Syntax: 'dimension') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IParameterReferenceExpression: dimension (OperationKind.ParameterReferenceExpression, Type: System.Char) (Syntax: 'dimension') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -128,9 +139,12 @@ public void F(object dimension) } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - IConversionExpression (ConversionKind.Cast, Explicit) (OperationKind.ConversionExpression, Type: System.Int32) - IParameterReferenceExpression: dimension (OperationKind.ParameterReferenceExpression, Type: System.Object) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new M[(int)dimension]') + Dimension Sizes(1): + IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32) (Syntax: '(int)dimension') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IParameterReferenceExpression: dimension (OperationKind.ParameterReferenceExpression, Type: System.Object) (Syntax: 'dimension') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -148,10 +162,13 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - IArrayInitializer (OperationKind.ArrayInitializer) - IFieldReferenceExpression: System.String System.String.Empty (Static) (OperationKind.FieldReferenceExpression, Type: System.String) +IArrayCreationExpression (Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[]) (Syntax: 'new string[ ... ing.Empty }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new string[ ... ing.Empty }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ string.Empty }') + Element Values(1): + IFieldReferenceExpression: System.String System.String.Empty (Static) (OperationKind.FieldReferenceExpression, Type: System.String) (Syntax: 'string.Empty') + Instance Receiver: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -171,10 +188,14 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - IArrayInitializer (OperationKind.ArrayInitializer) - IObjectCreationExpression (Constructor: M..ctor()) (OperationKind.ObjectCreationExpression, Type: M) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new M[] { new M() }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new M[] { new M() }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ new M() }') + Element Values(1): + IObjectCreationExpression (Constructor: M..ctor()) (OperationKind.ObjectCreationExpression, Type: M) (Syntax: 'new M()') + Arguments(0) + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -194,10 +215,14 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - IArrayInitializer (OperationKind.ArrayInitializer) - IObjectCreationExpression (Constructor: M..ctor()) (OperationKind.ObjectCreationExpression, Type: M) +IArrayCreationExpression (Element Type: M) (OperationKind.ArrayCreationExpression, Type: M[]) (Syntax: 'new[] { new M() }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new[] { new M() }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ new M() }') + Element Values(1): + IObjectCreationExpression (Constructor: M..ctor()) (OperationKind.ObjectCreationExpression, Type: M) (Syntax: 'new M()') + Arguments(0) + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -216,13 +241,16 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) - IArrayInitializer (OperationKind.ArrayInitializer) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: hello) - ILocalReferenceExpression: a (OperationKind.LocalReferenceExpression, Type: System.String) - IConversionExpression (ConversionKind.Cast, Implicit) (OperationKind.ConversionExpression, Type: System.String, Constant: null) - ILiteralExpression (Text: null) (OperationKind.LiteralExpression, Type: null, Constant: null) +IArrayCreationExpression (Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[]) (Syntax: 'new[] { ""he ... , a, null }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: 'new[] { ""he ... , a, null }') + Initializer: IArrayInitializer (3 elements) (OperationKind.ArrayInitializer) (Syntax: '{ ""hello"", a, null }') + Element Values(3): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: ""hello"") (Syntax: '""hello""') + ILocalReferenceExpression: a (OperationKind.LocalReferenceExpression, Type: System.String) (Syntax: 'a') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.String, Constant: null) (Syntax: 'null') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: null, Constant: null) (Syntax: 'null') "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -241,10 +269,12 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 3, Element Type: System.Byte) (OperationKind.ArrayCreationExpression, Type: System.Byte[,,]) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - ILiteralExpression (Text: 3) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) +IArrayCreationExpression (Element Type: System.Byte) (OperationKind.ArrayCreationExpression, Type: System.Byte[,,]) (Syntax: 'new byte[1,2,3]') + Dimension Sizes(3): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -262,27 +292,39 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 3, Element Type: System.Byte) (OperationKind.ArrayCreationExpression, Type: System.Byte[,,]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 1) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 2) - ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 3) - ILiteralExpression (Text: 3) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 4) - ILiteralExpression (Text: 4) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 5) - ILiteralExpression (Text: 5) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) - IConversionExpression (ConversionKind.CSharp, Implicit) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 6) - ILiteralExpression (Text: 6) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) +IArrayCreationExpression (Element Type: System.Byte) (OperationKind.ArrayCreationExpression, Type: System.Byte[,,]) (Syntax: 'new byte[,, ... 5, 6 } } }') + Dimension Sizes(3): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'new byte[,, ... 5, 6 } } }') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new byte[,, ... 5, 6 } } }') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: 'new byte[,, ... 5, 6 } } }') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { { 1, 2, ... 5, 6 } } }') + Element Values(2): + IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { 1, 2, 3 } }') + Element Values(1): + IArrayInitializer (3 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 1, 2, 3 }') + Element Values(3): + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 1) (Syntax: '1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 2) (Syntax: '2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 3) (Syntax: '3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { 4, 5, 6 } }') + Element Values(1): + IArrayInitializer (3 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 4, 5, 6 }') + Element Values(3): + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 4) (Syntax: '4') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 5) (Syntax: '5') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Byte, Constant: 6) (Syntax: '6') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: '6') "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -300,17 +342,23 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.Int32[]) (OperationKind.ArrayCreationExpression, Type: System.Int32[][]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayCreationExpression (Dimension sizes: 1, Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) - IArrayInitializer (OperationKind.ArrayInitializer) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - ILiteralExpression (Text: 3) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) - IArrayCreationExpression (Dimension sizes: 1, Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[]) - ILiteralExpression (Text: 5) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) +IArrayCreationExpression (Element Type: System.Int32[]) (OperationKind.ArrayCreationExpression, Type: System.Int32[][]) (Syntax: 'new int[][] ... ew int[5] }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'new int[][] ... ew int[5] }') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{ new[] { 1 ... ew int[5] }') + Element Values(2): + IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[]) (Syntax: 'new[] { 1, 2, 3 }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: 'new[] { 1, 2, 3 }') + Initializer: IArrayInitializer (3 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 1, 2, 3 }') + Element Values(3): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[]) (Syntax: 'new int[5]') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -328,8 +376,10 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.Int32[,]) (OperationKind.ArrayCreationExpression, Type: System.Int32[][,]) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) +IArrayCreationExpression (Element Type: System.Int32[,]) (OperationKind.ArrayCreationExpression, Type: System.Int32[][,]) (Syntax: 'new int[1][,]') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Initializer: null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -347,27 +397,37 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.Int32[,,]) (OperationKind.ArrayCreationExpression, Type: System.Int32[][,,]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayCreationExpression (Dimension sizes: 3, Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[,,]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - IArrayCreationExpression (Dimension sizes: 3, Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[,,]) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - IArrayInitializer (OperationKind.ArrayInitializer) - ILiteralExpression (Text: 3) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) - ILiteralExpression (Text: 4) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) +IArrayCreationExpression (Element Type: System.Int32[,,]) (OperationKind.ArrayCreationExpression, Type: System.Int32[][,,]) (Syntax: 'new[] { new ... , 4 } } } }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'new[] { new ... , 4 } } } }') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{ new[, ,] ... , 4 } } } }') + Element Values(2): + IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[,,]) (Syntax: 'new[, ,] { ... 1, 2 } } }') + Dimension Sizes(3): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new[, ,] { ... 1, 2 } } }') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new[, ,] { ... 1, 2 } } }') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'new[, ,] { ... 1, 2 } } }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { { 1, 2 } } }') + Element Values(1): + IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { 1, 2 } }') + Element Values(1): + IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 1, 2 }') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[,,]) (Syntax: 'new[, ,] { ... 3, 4 } } }') + Dimension Sizes(3): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new[, ,] { ... 3, 4 } } }') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new[, ,] { ... 3, 4 } } }') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'new[, ,] { ... 3, 4 } } }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { { 3, 4 } } }') + Element Values(1): + IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ { 3, 4 } }') + Element Values(1): + IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 3, 4 }') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -403,13 +463,16 @@ public void F() } "; string expectedOperationTree = @" -IArrayCreationExpression (Dimension sizes: 1, Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[], IsInvalid) - ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) - IArrayInitializer (OperationKind.ArrayInitializer, IsInvalid) - IConversionExpression (ConversionKind.Invalid, Implicit) (OperationKind.ConversionExpression, Type: System.String, IsInvalid) - ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) +IArrayCreationExpression (Element Type: System.String) (OperationKind.ArrayCreationExpression, Type: System.String[], IsInvalid) (Syntax: 'new string[] { 1 }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: 'new string[] { 1 }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer, IsInvalid) (Syntax: '{ 1 }') + Element Values(1): + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.String, IsInvalid) (Syntax: '1') + Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') "; VerifyOperationTreeForTest(source, expectedOperationTree); } } -} \ No newline at end of file +} diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index b687f8f2d6b..e8b248d37a2 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -7,6 +7,7 @@ Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics + Partial Public Class IOperationTests Inherits SemanticModelTestBase diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb index af3e52f2895..cbd49355fc3 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb @@ -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. Imports Microsoft.CodeAnalysis.Semantics Imports Microsoft.CodeAnalysis.Test.Utilities @@ -43,9 +43,11 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -66,11 +68,13 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -90,11 +94,13 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -114,12 +120,15 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -139,12 +148,15 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -161,10 +173,13 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -184,10 +199,14 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -207,10 +226,14 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of CollectionInitializerSyntax)(source, expectedOperationTree) @@ -228,13 +251,16 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of CollectionInitializerSyntax)(source, expectedOperationTree) @@ -252,17 +278,19 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -279,27 +307,39 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -317,18 +357,22 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of CollectionInitializerSyntax)(source, expectedOperationTree) @@ -345,11 +389,13 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -366,22 +412,30 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of CollectionInitializerSyntax)(source, expectedOperationTree) @@ -398,14 +452,17 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) @@ -422,11 +479,14 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of ArrayCreationExpressionSyntax)(source, expectedOperationTree) -- GitLab