diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 11eae662055ca3670f0fc275c1df1cd2d3c3db6b..cc300282c2700741c781b0e05cd6898e14df09c3 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -257,6 +257,8 @@ private IOperation CreateInternal(BoundNode boundNode) return CreateBoundPatternSwitchLabelOperation((BoundPatternSwitchLabel)boundNode); case BoundKind.IsPatternExpression: return CreateBoundIsPatternExpressionOperation((BoundIsPatternExpression)boundNode); + case BoundKind.QueryClause: + return CreateBoundQueryClauseOperation((BoundQueryClause)boundNode); default: var constantValue = ConvertToOptional((boundNode as BoundExpression)?.ConstantValue); bool isImplicit = boundNode.WasCompilerGenerated; @@ -1584,5 +1586,21 @@ private IIsPatternExpression CreateBoundIsPatternExpressionOperation(BoundIsPatt bool isImplicit = boundIsPatternExpression.WasCompilerGenerated; return new LazyIsPatternExpression(expression, pattern, _semanticModel, syntax, type, constantValue, isImplicit); } + + private IOperation CreateBoundQueryClauseOperation(BoundQueryClause boundQueryClause) + { + if (boundQueryClause.Syntax.Kind() != SyntaxKind.QueryExpression) + { + // Currently we have no IOperation APIs for different query clauses or continuation. + return Create(boundQueryClause.Value); + } + + Lazy expression = new Lazy(() => Create(boundQueryClause.Value)); + SyntaxNode syntax = boundQueryClause.Syntax; + ITypeSymbol type = boundQueryClause.Type; + Optional constantValue = ConvertToOptional(boundQueryClause.ConstantValue); + bool isImplicit = boundQueryClause.WasCompilerGenerated; + return new LazyTranslatedQueryExpression(expression, _semanticModel, syntax, type, constantValue, isImplicit); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index c299fa5d7a3bfdddbd8fa67e2dbfbd043d25fb4e..e327649c8fd15c407b792b5c79134f9ea281597e 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1371,80 +1371,67 @@ static void Main(string[] args) IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclarationStatement) (Syntax: 'str = from ... select w') IVariableDeclaration (1 variables) (OperationKind.VariableDeclaration) (Syntax: 'str = from ... select w') Variables: Local_1: System.Collections.Generic.IEnumerable str - Initializer: IOperation: (OperationKind.None) (Syntax: 'from x in "" ... select w') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'into w ... select w') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'select w') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'select w') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select w') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'select z') - IOperation: (OperationKind.None) (Syntax: 'select z') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select z') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') - IOperation: (OperationKind.None) (Syntax: 'let z = x.ToString()') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'let z = x.ToString()') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from x in ""123""') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in ""123""') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) - Operand: IOperation: (OperationKind.None) (Syntax: 'from x in ""123""') - Children(1): - ILiteralExpression (OperationKind.LiteralExpression, 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) - IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x.ToString()') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'x.ToString()') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x.ToString()') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x.ToString()') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x.ToString()') - ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'let z = x.ToString()') - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') - IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Char) (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) - IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: 'x.ToString()') - IInvocationExpression (virtual System.String System.Char.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'x.ToString()') - Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'x') - Arguments(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) - Initializer: 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) - InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'z') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.String>) (Syntax: 'z') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'z') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'z') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'z') - ReturnedValue: IOperation: (OperationKind.None) (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) - InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'w') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'w') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'w') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'w') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'w') - ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'w') - InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in "" ... select w') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select w') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'select z') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select z') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') + IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'let z = x.ToString()') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from x in ""123""') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in ""123""') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x.ToString()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'x.ToString()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x.ToString()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x.ToString()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x.ToString()') + ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'let z = x.ToString()') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Char) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: 'x.ToString()') + IInvocationExpression (virtual System.String System.Char.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'x.ToString()') + Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'x') + Arguments(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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'z') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.String>) (Syntax: 'z') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'z') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'z') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'z') + ReturnedValue: IOperation: (OperationKind.None) (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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'w') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'w') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'w') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'w') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'w') + ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'w') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) AtLoopBottom(0) Body: IBlockStatement (2 statements) (OperationKind.BlockStatement) (Syntax: '{ ... }') IForEachLoopStatement (LoopKind.ForEach) (OperationKind.LoopStatement) (Syntax: 'foreach (va ... }') @@ -1514,80 +1501,67 @@ private static IEnumerable fun() AtLoopBottom(0) Body: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '{ ... }') IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'return from ... select w;') - ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'from x in "" ... select w') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'into w ... select w') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'select w') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'select w') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select w') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'select z') - IOperation: (OperationKind.None) (Syntax: 'select z') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select z') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') - IOperation: (OperationKind.None) (Syntax: 'let z = x.ToString()') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'let z = x.ToString()') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from x in ""123""') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in ""123""') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) - Operand: IOperation: (OperationKind.None) (Syntax: 'from x in ""123""') - Children(1): - ILiteralExpression (OperationKind.LiteralExpression, 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) - IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x.ToString()') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'x.ToString()') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x.ToString()') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x.ToString()') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x.ToString()') - ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'let z = x.ToString()') - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') - IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Char) (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) - IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: 'x.ToString()') - IInvocationExpression (virtual System.String System.Char.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'x.ToString()') - Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'x') - Arguments(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) - Initializer: 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) - InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'z') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.String>) (Syntax: 'z') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'z') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'z') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'z') - ReturnedValue: IOperation: (OperationKind.None) (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) - InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'w') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'w') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'w') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'w') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'w') - ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'w') - InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ReturnedValue: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in "" ... select w') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select w') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'select z') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select z') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') + IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'let z = x.ToString()') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from x in ""123""') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in ""123""') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x.ToString()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'x.ToString()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x.ToString()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x.ToString()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x.ToString()') + ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'let z = x.ToString()') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'let z = x.ToString()') + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Char) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: 'x.ToString()') + IInvocationExpression (virtual System.String System.Char.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'x.ToString()') + Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'x') + Arguments(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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'z') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.String>) (Syntax: 'z') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'z') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'z') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'z') + ReturnedValue: IOperation: (OperationKind.None) (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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'w') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'w') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'w') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'w') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'w') + ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'w') + InConversion: CommonConversion (Exists: True, 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/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index e74395ca8949d2963441dca1f5a56f0c77f37ddf..9a4e2b056dcedf14c85dfa6dfb72ad49d7f42e45 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -143,31 +143,26 @@ public void M(List customers) } "; string expectedOperationTree = @" -IOperation: (OperationKind.None) (Syntax: 'from cust i ... t cust.Name') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'select cust.Name') - Children(1): - IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select cust.Name') - Instance Receiver: null - Arguments(2): - IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from cust in customers') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from cust in customers') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) - Operand: IOperation: (OperationKind.None) (Syntax: 'from cust in customers') - Children(1): - IParameterReferenceExpression: customers (OperationKind.ParameterReferenceExpression, 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) - IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'cust.Name') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'cust.Name') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'cust.Name') - IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'cust.Name') - IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'cust.Name') - ReturnedValue: IPropertyReferenceExpression: System.String Customer.Name { get; set; } (OperationKind.PropertyReferenceExpression, Type: System.String) (Syntax: 'cust.Name') - Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'cust') - InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from cust i ... t cust.Name') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select cust.Name') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from cust in customers') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from cust in customers') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IParameterReferenceExpression: customers (OperationKind.ParameterReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'cust.Name') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'cust.Name') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'cust.Name') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'cust.Name') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'cust.Name') + ReturnedValue: IPropertyReferenceExpression: System.String Customer.Name { get; set; } (OperationKind.PropertyReferenceExpression, Type: System.String) (Syntax: 'cust.Name') + Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'cust') + InConversion: CommonConversion (Exists: True, 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; diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs index 00e0ac2cba78921d9940618a4452752a716d6c6e..5832ce30bbfef2ed87967a9c7f9fced8c48c755a 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.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.IO; @@ -6,6 +6,7 @@ using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; +using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; @@ -32,6 +33,49 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[1, 2, 3, 4, 5, 6, 7]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void FromClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from i in c select i/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c select i') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select i') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from i in c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'i') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void QueryContinuation() @@ -51,6 +95,64 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[1, 2, 3, 4, 5, 6, 7]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void QueryContinuation_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from i in c select i into q select q/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c ... q select q') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select q') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'select i') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select i') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from i in c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'i') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i') + ReturnedValue: IOperation: (OperationKind.None) (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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'q') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'q') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'q') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'q') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'q') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void Select() @@ -68,6 +170,51 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[2, 3, 4, 5, 6, 7, 8]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void SelectClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from i in c select i+1/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c select i+1') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select i+1') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from i in c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'i+1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i+1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i+1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i+1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i+1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i+1') + Left: IOperation: (OperationKind.None) (Syntax: 'i') + Right: 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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void GroupBy01() @@ -85,6 +232,51 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[1:[1, 3, 5, 7], 0:[2, 4, 6]]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void GroupByClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from i in c group i by i % 2/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable>) (Syntax: 'from i in c ... i by i % 2') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable> System.Linq.Enumerable.GroupBy(this System.Collections.Generic.IEnumerable source, System.Func keySelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable>) (Syntax: 'group i by i % 2') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from i in c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 'i % 2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i % 2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i % 2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i % 2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i % 2') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i % 2') + Left: IOperation: (OperationKind.None) (Syntax: 'i') + Right: 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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void GroupBy02() @@ -118,6 +310,55 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[1, 2, 3, 4, 5, 6, 7]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void CastInFromClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from int i in c select i/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int i in c select i') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select i') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int i in c') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int i in c') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'i') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [Fact] public void Where() { @@ -134,6 +375,57 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[1, 2, 3, 4]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void WhereClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from int i in c where i < 5 select i/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int i ... 5 select i') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Where(this System.Collections.Generic.IEnumerable source, System.Func predicate)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'where i < 5') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int i in c') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int i in c') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: predicate) (OperationKind.Argument) (Syntax: 'i < 5') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i < 5') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i < 5') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i < 5') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i < 5') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i < 5') + Left: IOperation: (OperationKind.None) (Syntax: 'i') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5') + InConversion: CommonConversion (Exists: True, 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); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void FromJoinSelect() @@ -154,6 +446,82 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[11, 33, 44, 55, 77]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void FromJoinSelect_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c1 = new List() {1, 2, 3, 4, 5, 6, 7}; + List c2 = new List() {10, 30, 40, 50, 60, 70}; + var r = /**/from x1 in c1 + join x2 in c2 on x1 equals x2/10 + select x1+x2/**/; + } +} +"; + // BoundRangeVariable still doesn't have an IOperation API: https://github.com/dotnet/roslyn/issues/21238 + + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x1 in ... elect x1+x2') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Join(this System.Collections.Generic.IEnumerable outer, System.Collections.Generic.IEnumerable inner, System.Func outerKeySelector, System.Func innerKeySelector, System.Func resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'join x2 in ... quals x2/10') + Instance Receiver: null + Arguments(5): + IArgument (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument) (Syntax: 'from x1 in c1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x1 in c1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c1 (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c2 (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 'x1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'x1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x1') + ReturnedValue: IOperation: (OperationKind.None) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 'x2/10') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'x2/10') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x2/10') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x2/10') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x2/10') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x2/10') + Left: IOperation: (OperationKind.None) (Syntax: 'x2') + Right: ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'x1+x2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'x1+x2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x1+x2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x1+x2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x1+x2') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x1+x2') + Left: IOperation: (OperationKind.None) (Syntax: 'x1') + Right: IOperation: (OperationKind.None) (Syntax: 'x2') + InConversion: CommonConversion (Exists: True, 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); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void OrderBy() @@ -174,6 +542,70 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[84, 72, 64, 51, 55, 46, 39, 27, 27, 27, 28]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void OrderByClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() {1, 2, 3, 4, 5, 6, 7}; + var r = /**/from i in c + orderby i/10 descending, i%10 + select i/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Linq.IOrderedEnumerable) (Syntax: 'from i in c ... select i') + Expression: IInvocationExpression (System.Linq.IOrderedEnumerable System.Linq.Enumerable.ThenBy(this System.Linq.IOrderedEnumerable source, System.Func keySelector)) (OperationKind.InvocationExpression, Type: System.Linq.IOrderedEnumerable) (Syntax: 'i%10') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'i/10 descending') + IInvocationExpression (System.Linq.IOrderedEnumerable System.Linq.Enumerable.OrderByDescending(this System.Collections.Generic.IEnumerable source, System.Func keySelector)) (OperationKind.InvocationExpression, Type: System.Linq.IOrderedEnumerable) (Syntax: 'i/10 descending') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from i in c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 'i/10') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i/10') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i/10') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i/10') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i/10') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i/10') + Left: IOperation: (OperationKind.None) (Syntax: 'i') + Right: ILiteralExpression (OperationKind.LiteralExpression, 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) + InConversion: CommonConversion (Exists: True, 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: keySelector) (OperationKind.Argument) (Syntax: 'i%10') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i%10') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i%10') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i%10') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i%10') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Remainder) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i%10') + Left: IOperation: (OperationKind.None) (Syntax: 'i') + Right: ILiteralExpression (OperationKind.LiteralExpression, 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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void GroupJoin() @@ -195,6 +627,89 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[1:[12], 2:[], 3:[34], 4:[42], 5:[51, 52], 7:[75]]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void GroupJoinClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c1 = new List{1, 2, 3, 4, 5, 7}; + List c2 = new List{12, 34, 42, 51, 52, 66, 75}; + var r = + /**/from x1 in c1 + join x2 in c2 on x1 equals x2 / 10 into g + select x1 + "":"" + g.ToString()/**/; + } +} +"; + // BoundRangeVariable still doesn't have an IOperation API: https://github.com/dotnet/roslyn/issues/21238 + + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x1 in ... .ToString()') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.GroupJoin(this System.Collections.Generic.IEnumerable outer, System.Collections.Generic.IEnumerable inner, System.Func outerKeySelector, System.Func innerKeySelector, System.Func, System.String> resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'join x2 in ... / 10 into g') + Instance Receiver: null + Arguments(5): + IArgument (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument) (Syntax: 'from x1 in c1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x1 in c1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c1 (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c2 (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 'x1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'x1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x1') + ReturnedValue: IOperation: (OperationKind.None) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 'x2 / 10') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'x2 / 10') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x2 / 10') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x2 / 10') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x2 / 10') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Divide) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x2 / 10') + Left: IOperation: (OperationKind.None) (Syntax: 'x2') + Right: ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'x1 + "":"" + g.ToString()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func, System.String>) (Syntax: 'x1 + "":"" + g.ToString()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x1 + "":"" + g.ToString()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x1 + "":"" + g.ToString()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x1 + "":"" + g.ToString()') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: 'x1 + "":"" + g.ToString()') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: 'x1 + "":""') + Left: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Object) (Syntax: 'x1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IOperation: (OperationKind.None) (Syntax: 'x1') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: "":"") (Syntax: '"":""') + Right: IInvocationExpression (virtual System.String System.Object.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'g.ToString()') + Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'g') + Arguments(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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void SelectMany01() @@ -213,6 +728,63 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[11, 21, 31, 12, 22, 32, 13, 23, 33]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void SelectMany_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c1 = new List{1, 2, 3, 4, 5, 7}; + List c2 = new List{12, 34, 42, 51, 52, 66, 75}; + var r = /**/from x in c1 from y in c2 select x + y/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in c ... elect x + y') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.SelectMany(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from y in c2') + Instance Receiver: null + Arguments(3): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from x in c1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from x in c1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c1 (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'c2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'c2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'c2') + ReturnedValue: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c2 (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'x + y') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'x + y') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + y') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + y') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + y') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void SelectMany02() @@ -252,6 +824,116 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[111, 222, 333]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void LetClause_IOperation() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c1 = new List{1, 2, 3, 4, 5, 7}; + var r = /**/from int x in c1 + let g = x * 10 + let z = g + x*100 + select x + z/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int x ... elect x + z') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32>(this System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> source, System.Func< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select x + z') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let z = g + x*100') + IInvocationExpression (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.InvocationExpression, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>) (Syntax: 'let z = g + x*100') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let g = x * 10') + IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'let g = x * 10') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int x in c1') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int x in c1') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c1 (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'x * 10') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'x * 10') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x * 10') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x * 10') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x * 10') + ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Int32 x, System.Int32 g)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'let g = x * 10') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'let g = x * 10') + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument) (Syntax: 'x * 10') + IBinaryOperatorExpression (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x * 10') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: ILiteralExpression (OperationKind.LiteralExpression, 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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'g + x*100') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, <>h__TransparentIdentifier0, System.Int32 z>>) (Syntax: 'g + x*100') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'g + x*100') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'g + x*100') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'g + x*100') + ReturnedValue: IObjectCreationExpression (Constructor: <>h__TransparentIdentifier0, System.Int32 z>..ctor( <>h__TransparentIdentifier0, System.Int32 z)) (OperationKind.ObjectCreationExpression, Type: <>h__TransparentIdentifier0, System.Int32 z>) (Syntax: 'let z = g + x*100') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument) (Syntax: 'let z = g + x*100') + IParameterReferenceExpression: <>h__TransparentIdentifier0 (OperationKind.ParameterReferenceExpression, Type: ) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: 'g + x*100') + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'g + x*100') + Left: IOperation: (OperationKind.None) (Syntax: 'g') + Right: IBinaryOperatorExpression (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x*100') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 100) (Syntax: '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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'x + z') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32>) (Syntax: 'x + z') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + z') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + z') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + z') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + z') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void TransparentIdentifiers_FromLet() @@ -278,6 +960,202 @@ public static void Main(string[] args) CompileAndVerify(csSource, expectedOutput: "[111, 211, 311, 121, 221, 131, 112, 212, 122, 113]"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void TransparentIdentifiers_FromLet_IOperation() + { + string source = @" +using C = System.Collections.Generic.List; +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + C c1 = new C{1, 2, 3}; + C c2 = new C{10, 20, 30}; + C c3 = new C{100, 200, 300}; + var r1 = + /**/from int x in c1 + from int y in c2 + from int z in c3 + let g = x + y + z + where (x + y / 10 + z / 100) < 6 + select g/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int x ... select g') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Int32>(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.Int32> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select g') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'where (x + ... / 100) < 6') + IInvocationExpression (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.InvocationExpression, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>) (Syntax: 'where (x + ... / 100) < 6') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'let g = x + y + z') + IInvocationExpression (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.InvocationExpression, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>) (Syntax: 'let g = x + y + z') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int z in c3') + IInvocationExpression (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.InvocationExpression, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>) (Syntax: 'from int z in c3') + Instance Receiver: null + Arguments(3): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int y in c2') + IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.SelectMany>(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func> resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'from int y in c2') + Instance Receiver: null + Arguments(3): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int x in c1') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int x in c1') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c1 (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: collectionSelector) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'c2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'c2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'c2') + ReturnedValue: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c2') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c2 (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: resultSelector) (OperationKind.Argument) (Syntax: 'from int y in c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'from int y in c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'from int y in c2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'from int y in c2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'from int y in c2') + ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'from int y in c2') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'from int y in c2') + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: 'from int y in c2') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: collectionSelector) (OperationKind.Argument) (Syntax: 'c3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.Collections.Generic.IEnumerable>) (Syntax: 'c3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'c3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'c3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'c3') + ReturnedValue: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c3') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c3 (OperationKind.LocalReferenceExpression, Type: System.Collections.Generic.List) (Syntax: '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) + InConversion: CommonConversion (Exists: True, 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: resultSelector) (OperationKind.Argument) (Syntax: 'from int z in c3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>) (Syntax: 'from int z in c3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'from int z in c3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'from int z in c3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'from int z in c3') + ReturnedValue: IObjectCreationExpression (Constructor: <>h__TransparentIdentifier0, System.Int32 z>..ctor( <>h__TransparentIdentifier0, System.Int32 z)) (OperationKind.ObjectCreationExpression, Type: <>h__TransparentIdentifier0, System.Int32 z>) (Syntax: 'from int z in c3') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument) (Syntax: 'from int z in c3') + IParameterReferenceExpression: <>h__TransparentIdentifier0 (OperationKind.ParameterReferenceExpression, Type: ) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument) (Syntax: 'from int z in c3') + IParameterReferenceExpression: z (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: selector) (OperationKind.Argument) (Syntax: 'x + y + z') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>) (Syntax: 'x + y + z') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + y + z') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + y + z') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + y + z') + ReturnedValue: IObjectCreationExpression (Constructor: <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>..ctor( <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g)) (OperationKind.ObjectCreationExpression, Type: <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>) (Syntax: 'let g = x + y + z') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier1) (OperationKind.Argument) (Syntax: 'let g = x + y + z') + IParameterReferenceExpression: <>h__TransparentIdentifier1 (OperationKind.ParameterReferenceExpression, Type: <>h__TransparentIdentifier0, System.Int32 z>) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument) (Syntax: 'x + y + z') + IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y + z') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: IOperation: (OperationKind.None) (Syntax: 'y') + Right: IOperation: (OperationKind.None) (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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: predicate) (OperationKind.Argument) (Syntax: '(x + y / 10 ... / 100) < 6') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean>) (Syntax: '(x + y / 10 ... / 100) < 6') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '(x + y / 10 ... / 100) < 6') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '(x + y / 10 ... / 100) < 6') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: '(x + y / 10 ... / 100) < 6') + 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') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: 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: 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) + 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'g') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Int32>) (Syntax: 'g') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'g') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'g') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'g') + ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'g') + InConversion: CommonConversion (Exists: True, 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); + } + [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] public void TransparentIdentifiers_Join01() @@ -419,6 +1297,125 @@ public static void Main(string[] args) Assert.Equal(z, model.GetSemanticInfoSummary(xPyPz.Right).Symbol); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void RangeVariables_IOperation() + { + string source = @" +using C = System.Collections.Generic.List; +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + C c1 = new C{1, 2, 3}; + C c2 = new C{10, 20, 30}; + C c3 = new C{100, 200, 300}; + var r1 = + /**/from int x in c1 + from int y in c2 + from int z in c3 + select x + y + z/**/; + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int x ... t x + y + z') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.SelectMany<, System.Int32, System.Int32>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.Collections.Generic.IEnumerable> collectionSelector, System.Func<, System.Int32, System.Int32> resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int z in c3') + Instance Receiver: null + Arguments(3): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int y in c2') + IInvocationExpression (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.SelectMany>(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func> resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable<>) (Syntax: 'from int y in c2') + Instance Receiver: null + Arguments(3): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from int x in c1') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int x in c1') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c1 (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: collectionSelector) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'c2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'c2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'c2') + ReturnedValue: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c2') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c2 (OperationKind.LocalReferenceExpression, 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) + InConversion: CommonConversion (Exists: True, 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: resultSelector) (OperationKind.Argument) (Syntax: 'from int y in c2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'from int y in c2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'from int y in c2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'from int y in c2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'from int y in c2') + ReturnedValue: IObjectCreationExpression (Constructor: ..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreationExpression, Type: ) (Syntax: 'from int y in c2') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'from int y in c2') + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: 'from int y in c2') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + Initializer: 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) + InConversion: CommonConversion (Exists: True, 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: collectionSelector) (OperationKind.Argument) (Syntax: 'c3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.Collections.Generic.IEnumerable>) (Syntax: 'c3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'c3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'c3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'c3') + ReturnedValue: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'c3') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'c3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c3 (OperationKind.LocalReferenceExpression, Type: System.Collections.Generic.List) (Syntax: '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) + InConversion: CommonConversion (Exists: True, 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: resultSelector) (OperationKind.Argument) (Syntax: 'x + y + z') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func<, System.Int32, System.Int32>) (Syntax: 'x + y + z') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + y + z') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + y + z') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + y + z') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y + z') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: IOperation: (OperationKind.None) (Syntax: 'y') + Right: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [Fact] public void RangeVariables02() { @@ -566,51 +1563,147 @@ public static void Main(string[] args) Assert.Equal("ThenBy", oinfo1.Symbol.Name); } + [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(541774, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541774")] [Fact] public void MultipleFromClauseIdentifierInExprNotInContext() { - var csSource = @" + string source = @" +using System.Linq; + class Program { static void Main(string[] args) { - var q2 = from n1 in nums + var q2 = /**/from n1 in nums from n2 in nums - select n1; + select n1/**/; } -}"; - CreateCompilationWithMscorlibAndSystemCore(csSource).VerifyDiagnostics( - // (6,29): error CS0103: The name 'nums' does not exist in the current context - Diagnostic(ErrorCode.ERR_NameNotInContext, "nums").WithArguments("nums") - ); +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'from n1 in ... select n1') + Expression: IInvocationExpression (? Program.SelectMany()) (OperationKind.InvocationExpression, Type: ?, IsInvalid) (Syntax: 'from n2 in nums') + Instance Receiver: null + Arguments(3): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'nums') + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'nums') + Children(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) + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'nums') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'nums') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'nums') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'nums') + ReturnedValue: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'nums') + Children(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) + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument) (Syntax: 'n1') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'n1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'n1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'n1') + ReturnedValue: IOperation: (OperationKind.None) (Syntax: 'n1') + InConversion: CommonConversion (Exists: True, 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 = new DiagnosticDescription[] { + // CS0103: The name 'nums' does not exist in the current context + // var q2 = /**/from n1 in nums + Diagnostic(ErrorCode.ERR_NameNotInContext, "nums").WithArguments("nums").WithLocation(8, 39), + // CS0103: The name 'nums' does not exist in the current context + // from n2 in nums + Diagnostic(ErrorCode.ERR_NameNotInContext, "nums").WithArguments("nums").WithLocation(9, 29) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(541906, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541906")] [Fact] public void NullLiteralFollowingJoinInQuery() { - var csSource = @" + string source = @" using System.Linq; class Program { static void Main(string[] args) { - var query = from int i in new int[]{ 1 } join null on true equals true select i; //CS1031 + var query = /**/from int i in new int[] { 1 } join null on true equals true select i/**/; //CS1031 } -}"; - CreateCompilationWithMscorlibAndSystemCore(csSource).VerifyDiagnostics( - // (8,55): error CS1031: Type expected - // var query = from int i in new int[]{ 1 } join null on true equals true select i; //CS1031 - Diagnostic(ErrorCode.ERR_TypeExpected, "null"), - // (8,55): error CS1001: Identifier expected - // var query = from int i in new int[]{ 1 } join null on true equals true select i; //CS1031 - Diagnostic(ErrorCode.ERR_IdentifierExpected, "null"), - // (8,55): error CS1003: Syntax error, 'in' expected - // var query = from int i in new int[]{ 1 } join null on true equals true select i; //CS1031 - Diagnostic(ErrorCode.ERR_SyntaxError, "null").WithArguments("in", "null") - ); +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'from int i ... ue select i') + Expression: IInvocationExpression (? Program.Join()) (OperationKind.InvocationExpression, Type: ?, IsInvalid) (Syntax: 'join null o ... equals true') + Instance Receiver: null + Arguments(5): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument) (Syntax: 'from int i ... int[] { 1 }') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from int i ... int[] { 1 }') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'new int[] { 1 }') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'new int[] { 1 }') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: 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: 'new int[] { 1 }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 1 }') + Element Values(1): + 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) + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument, IsInvalid) (Syntax: 'join null o ... equals true') + IInvocationExpression (? Program.Cast()) (OperationKind.InvocationExpression, Type: ?, IsInvalid) (Syntax: 'join null o ... equals true') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'null') + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'null') + Children(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: null, Constant: null, IsInvalid) (Syntax: '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) + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument) (Syntax: 'true') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'true') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'true') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'true') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'true') + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument) (Syntax: 'true') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'true') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'true') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'true') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'true') + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument) (Syntax: 'i') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS1031: Type expected + // var query = /**/from int i in new int[] { 1 } join null on true equals true select i/**/; //CS1031 + Diagnostic(ErrorCode.ERR_TypeExpected, "null").WithLocation(8, 66), + // CS1001: Identifier expected + // var query = /**/from int i in new int[] { 1 } join null on true equals true select i/**/; //CS1031 + Diagnostic(ErrorCode.ERR_IdentifierExpected, "null").WithLocation(8, 66), + // CS1003: Syntax error, 'in' expected + // var query = /**/from int i in new int[] { 1 } join null on true equals true select i/**/; //CS1031 + Diagnostic(ErrorCode.ERR_SyntaxError, "null").WithArguments("in", "null").WithLocation(8, 66) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(541779, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541779")] @@ -700,6 +1793,100 @@ static void Main() CompileAndVerify(csSource, additionalRefs: new[] { LinqAssemblyRef }, expectedOutput: "1 2 3"); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void JoinClause_IOperation() + { + string source = @" +using System; +using System.Linq; + +class Program +{ + static void Main() + { + var q2 = + /**/from a in Enumerable.Range(1, 13) + join b in Enumerable.Range(1, 13) on 4 * a equals b + select a/**/; + + string serializer = String.Empty; + foreach (var q in q2) + { + serializer = serializer + q + "" ""; + } + System.Console.Write(serializer.Trim()); + } +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from a in E ... select a') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Join(this System.Collections.Generic.IEnumerable outer, System.Collections.Generic.IEnumerable inner, System.Func outerKeySelector, System.Func innerKeySelector, System.Func resultSelector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'join b in E ... a equals b') + Instance Receiver: null + Arguments(5): + IArgument (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument) (Syntax: 'Enumerable.Range(1, 13)') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Range(System.Int32 start, System.Int32 count)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'Enumerable.Range(1, 13)') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument) (Syntax: '1') + 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument) (Syntax: '13') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 'Enumerable.Range(1, 13)') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Range(System.Int32 start, System.Int32 count)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'Enumerable.Range(1, 13)') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument) (Syntax: '1') + 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument) (Syntax: '13') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: '4 * a') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: '4 * a') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '4 * a') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '4 * a') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: '4 * a') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '4 * a') + Left: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + Right: IOperation: (OperationKind.None) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 'b') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'b') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'b') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'b') + ReturnedValue: IOperation: (OperationKind.None) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'a') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'a') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'a') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'a') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'a') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + [WorkItem(541789, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541789")] [WorkItem(9229, "DevDiv_Projects/Roslyn")] [Fact] @@ -1353,11 +2540,12 @@ class P Assert.Null(symbolInfo.Symbol); } + [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(542559, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542559")] [Fact] public void StaticTypeInFromClause() { - string sourceCode = @" + string source = @" using System; using System.Linq; @@ -1366,42 +2554,95 @@ class C static void Main() { var q2 = string.Empty.Cast().Select(x => x); - var q1 = from GC x in string.Empty select x; + var q1 = /**/from GC x in string.Empty select x/**/; } -}"; - var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode); - compilation.VerifyDiagnostics( - // (9,18): error CS0718: 'GC': static types cannot be used as type arguments +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'from GC x i ... ty select x') + Expression: IInvocationExpression (? C.Select()) (OperationKind.InvocationExpression, Type: ?) (Syntax: 'select x') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'from GC x i ... tring.Empty') + IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable, IsInvalid) (Syntax: 'from GC x i ... tring.Empty') + Instance Receiver: null + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'string.Empty') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable, IsInvalid) (Syntax: 'string.Empty') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IFieldReferenceExpression: System.String System.String.Empty (Static) (OperationKind.FieldReferenceExpression, Type: System.String, IsInvalid) (Syntax: 'string.Empty') + Instance Receiver: 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) + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument) (Syntax: 'x') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0718: 'GC': static types cannot be used as type arguments // var q2 = string.Empty.Cast().Select(x => x); Diagnostic(ErrorCode.ERR_GenericArgIsStaticClass, "string.Empty.Cast").WithArguments("System.GC").WithLocation(9, 18), - // (10,18): error CS0718: 'GC': static types cannot be used as type arguments - // var q1 = from GC x in string.Empty select x; - Diagnostic(ErrorCode.ERR_GenericArgIsStaticClass, "from GC x in string.Empty").WithArguments("System.GC").WithLocation(10, 18) - ); + // CS0718: 'GC': static types cannot be used as type arguments + // var q1 = /**/from GC x in string.Empty select x/**/; + Diagnostic(ErrorCode.ERR_GenericArgIsStaticClass, "from GC x in string.Empty").WithArguments("System.GC").WithLocation(10, 28) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(542560, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542560")] [Fact] public void MethodGroupInFromClause() { - string sourceCode = @" + string source = @" +using System; +using System.Linq; + class Program { static void Main() { - var q1 = from y in Main select y; + var q1 = /**/from y in Main select y/**/; var q2 = Main.Select(y => y); } -}"; - var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode); - compilation.VerifyDiagnostics( - // (6,28): error CS0119: 'Program.Main()' is a method, which is not valid in the given context - // var q1 = from y in Main select y; - Diagnostic(ErrorCode.ERR_BadSKunknown, "Main").WithArguments("Program.Main()", "method").WithLocation(6, 28), - // (7,18): error CS0119: 'Program.Main()' is a method, which is not valid in the given context +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'from y in Main select y') + Expression: IInvocationExpression (? Program.Select()) (OperationKind.InvocationExpression, Type: ?) (Syntax: 'select y') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'from y in Main') + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'from y in Main') + Children(1): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'Main') + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument) (Syntax: 'y') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'y') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'y') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'y') + ReturnedValue: IOperation: (OperationKind.None) (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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0119: 'Program.Main()' is a method, which is not valid in the given context + // var q1 = /**/from y in Main select y/**/; + Diagnostic(ErrorCode.ERR_BadSKunknown, "Main").WithArguments("Program.Main()", "method").WithLocation(9, 38), + // CS0119: 'Program.Main()' is a method, which is not valid in the given context // var q2 = Main.Select(y => y); - Diagnostic(ErrorCode.ERR_BadSKunknown, "Main").WithArguments("Program.Main()", "method").WithLocation(7, 18) - ); + Diagnostic(ErrorCode.ERR_BadSKunknown, "Main").WithArguments("Program.Main()", "method").WithLocation(10, 18) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(542558, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542558")] @@ -1545,11 +2786,12 @@ static int Main() compilation.VerifyDiagnostics(); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] public void RangeTypeAlreadySpecified() { - string sourceCode = -@"using System.Linq; + string source = @" +using System.Linq; using System.Collections; static class Test @@ -1557,21 +2799,44 @@ static class Test public static void Main2() { var list = new CastableToArrayList(); - var q = from int x in list - select x + 1; + var q = /**/from int x in list + select x + 1/**/; } } class CastableToArrayList { public ArrayList Cast() { return null; } -}"; - var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode); - compilation.VerifyDiagnostics( - // (9,31): error CS1936: Could not find an implementation of the query pattern for source type 'System.Collections.ArrayList'. 'Select' not found. - // var q = from int x in list - Diagnostic(ErrorCode.ERR_QueryNoProvider, "list").WithArguments("System.Collections.ArrayList", "Select") - ); +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'from int x ... elect x + 1') + Expression: IInvocationExpression (? Test.Select()) (OperationKind.InvocationExpression, Type: ?) (Syntax: 'select x + 1') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'from int x in list') + IInvocationExpression ( System.Collections.ArrayList CastableToArrayList.Cast()) (OperationKind.InvocationExpression, Type: System.Collections.ArrayList, IsInvalid) (Syntax: 'from int x in list') + Instance Receiver: ILocalReferenceExpression: list (OperationKind.LocalReferenceExpression, Type: CastableToArrayList, IsInvalid) (Syntax: 'list') + Arguments(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) + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument) (Syntax: 'x + 1') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: ?) (Syntax: 'x + 1') + Left: IOperation: (OperationKind.None) (Syntax: 'x') + Right: 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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS1936: Could not find an implementation of the query pattern for source type 'ArrayList'. 'Select' not found. + // var q = /**/from int x in list + Diagnostic(ErrorCode.ERR_QueryNoProvider, "list").WithArguments("System.Collections.ArrayList", "Select").WithLocation(10, 41) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(11414, "DevDiv_Projects/Roslyn")] @@ -1648,16 +2913,18 @@ public static void Main () Assert.NotNull(queryInfo); } + [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(545797, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545797")] [Fact] public void QueryOnNull() { - string source = @"using System; + string source = @" +using System; static class C { static void Main() { - var q = from x in null select x; + var q = /**/from x in null select x/**/; } static object Select(this object x, Func y) @@ -1666,24 +2933,46 @@ static object Select(this object x, Func y) } } "; - var compilation = CreateCompilationWithMscorlibAndSystemCore(source); - compilation.VerifyDiagnostics( - // (6,32): error CS0186: Use of null is not valid in this context - // var q = from x in null select x; - Diagnostic(ErrorCode.ERR_NullNotValid, "select x") - ); + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Object, IsInvalid) (Syntax: 'from x in null select x') + Expression: IInvocationExpression (System.Object C.Select(this System.Object x, System.Func y)) (OperationKind.InvocationExpression, Type: System.Object, IsInvalid) (Syntax: 'select x') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument) (Syntax: 'from x in null') + IInvalidExpression (OperationKind.InvalidExpression, Type: ?) (Syntax: 'from x in null') + Children(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: null, Constant: null) (Syntax: '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) + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'x') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'x') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'x') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'x') + ReturnedValue: IOperation: (OperationKind.None, IsInvalid) (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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0186: Use of null is not valid in this context + // var q = /**/from x in null select x/**/; + Diagnostic(ErrorCode.ERR_NullNotValid, "select x").WithLocation(7, 42) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(545797, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545797")] [Fact] public void QueryOnLambda() { - string source = @"using System; + string source = @" +using System; static class C { static void Main() { - var q = from x in y=>y select x; + var q = /**/from x in y => y select x/**/; } static object Select(this object x, Func y) @@ -1692,12 +2981,35 @@ static object Select(this object x, Func y) } } "; - var compilation = CreateCompilationWithMscorlibAndSystemCore(source); - compilation.VerifyDiagnostics( - // (6,32): error CS1936: Could not find an implementation of the query pattern for source type 'anonymous method'. 'Select' not found. - // var q = from x in y=>y select x; - Diagnostic(ErrorCode.ERR_QueryNoProvider, "select x").WithArguments("anonymous method", "Select") - ); + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Object, IsInvalid) (Syntax: 'from x in y ... y select x') + Expression: IInvocationExpression (System.Object C.Select(this System.Object x, System.Func y)) (OperationKind.InvocationExpression, Type: System.Object, IsInvalid) (Syntax: 'select x') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument) (Syntax: 'from x in y => y') + IInvalidExpression (OperationKind.InvalidExpression, Type: ?) (Syntax: 'from x in y => y') + Children(1): + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'y => y') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'y') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'y') + ReturnedValue: IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: ?) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'x') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'x') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'x') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'x') + ReturnedValue: IOperation: (OperationKind.None, IsInvalid) (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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS1936: Could not find an implementation of the query pattern for source type 'anonymous method'. 'Select' not found. + // var q = /**/from x in y => y select x/**/; + Diagnostic(ErrorCode.ERR_QueryNoProvider, "select x").WithArguments("anonymous method", "Select").WithLocation(7, 44) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(545444, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545444")] @@ -2056,11 +3368,12 @@ x descending Assert.Equal(3, count); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] public void BrokenQueryPattern() { - string sourceCode = -@"using System; + string source = @" +using System; class Q { @@ -2082,17 +3395,82 @@ static void Main(string[] args) { Q q = null; var r = - from x in q + /**/from x in q from y in q where x.ToString() == y.ToString() - select x.ToString(); + select x.ToString()/**/; } -}"; - CreateCompilationWithMscorlibAndSystemCore(sourceCode).VerifyDiagnostics( - // (26,20): error CS8016: Transparent identifier member access failed for field 'x' of 'int'. Does the data being queried implement the query pattern? - // select x.ToString(); - Diagnostic(ErrorCode.ERR_UnsupportedTransparentIdentifierAccess, "x").WithArguments("x", "int") - ); +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: X, IsInvalid) (Syntax: 'from x in q ... .ToString()') + Expression: IInvocationExpression ( X X.Select(System.Func f1)) (OperationKind.InvocationExpression, Type: X, IsInvalid) (Syntax: 'select x.ToString()') + Instance Receiver: IInvocationExpression ( X Q< y>>.Where(System.Func< y>, System.Boolean> f1)) (OperationKind.InvocationExpression, Type: X) (Syntax: 'where x.ToS ... .ToString()') + Instance Receiver: IInvocationExpression ( Q< y>> Q.SelectMany, y>>(System.Func> f1, System.Func, y>> f2)) (OperationKind.InvocationExpression, Type: Q< y>>) (Syntax: 'from y in q') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: Q) (Syntax: 'q') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument) (Syntax: 'q') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>) (Syntax: 'q') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'q') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'q') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'q') + ReturnedValue: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: f2) (OperationKind.Argument) (Syntax: 'from y in q') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func, y>>) (Syntax: 'from y in q') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'from y in q') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'from y in q') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'from y in q') + ReturnedValue: IObjectCreationExpression (Constructor: y>..ctor(System.Int32 x, Q y)) (OperationKind.ObjectCreationExpression, Type: y>) (Syntax: 'from y in q') + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'from y in q') + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + IArgument (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument) (Syntax: 'from y in q') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: Q) (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) + Initializer: 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) + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument) (Syntax: 'x.ToString( ... .ToString()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func< y>, System.Boolean>) (Syntax: 'x.ToString( ... .ToString()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x.ToString( ... .ToString()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x.ToString( ... .ToString()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x.ToString( ... .ToString()') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Equals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'x.ToString( ... .ToString()') + Left: IInvocationExpression (virtual System.String System.Int32.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'x.ToString()') + Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'x') + Arguments(0) + Right: IInvocationExpression (virtual System.String System.Object.ToString()) (OperationKind.InvocationExpression, Type: System.String) (Syntax: 'y.ToString()') + Instance Receiver: IOperation: (OperationKind.None) (Syntax: 'y') + Arguments(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) + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'x.ToString()') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'x.ToString()') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'x.ToString()') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'x.ToString()') + ReturnedValue: IInvocationExpression ( ? Program.()) (OperationKind.InvocationExpression, Type: ?, IsInvalid) (Syntax: 'x.ToString()') + Instance Receiver: IOperation: (OperationKind.None, IsInvalid) (Syntax: 'x.ToString') + Arguments(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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS8016: Transparent identifier member access failed for field 'x' of 'int'. Does the data being queried implement the query pattern? + // select x.ToString()/**/; + Diagnostic(ErrorCode.ERR_UnsupportedTransparentIdentifierAccess, "x").WithArguments("x", "int").WithLocation(27, 20) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } [Fact] @@ -2466,10 +3844,11 @@ public ValueTuple(T1 item1, T2 item2) ); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(14689, "https://github.com/dotnet/roslyn/issues/14689")] public void SelectFromNamespaceShouldGiveAnError() { - var code = @" + string source = @" using System.Linq; using NSAlias = ParentNamespace.ConsoleApp; @@ -2483,28 +3862,51 @@ static void Main() { var x = from c in ConsoleApp select 3; var y = from c in ParentNamespace.ConsoleApp select 3; - var z = from c in NSAlias select 3; + var z = /**/from c in NSAlias select 3/**/; } } } -}"; - - CreateCompilationWithMscorlibAndSystemCore(code).VerifyDiagnostics( - // (13,35): error CS0119: 'ConsoleApp' is a namespace, which is not valid in the given context +} +"; + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'from c in N ... as select 3') + Expression: IInvocationExpression (? ParentNamespace.ConsoleApp.Program.Select()) (OperationKind.InvocationExpression, Type: ?) (Syntax: 'select 3') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: null) (OperationKind.Argument, IsInvalid) (Syntax: 'from c in NSAlias') + IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'from c in NSAlias') + Children(1): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'NSAlias') + InConversion: CommonConversion (Exists: True, 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: null) (OperationKind.Argument) (Syntax: '3') + IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: '3') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, 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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0119: 'ConsoleApp' is a namespace, which is not valid in the given context // var x = from c in ConsoleApp select 3; Diagnostic(ErrorCode.ERR_BadSKunknown, "ConsoleApp").WithArguments("ConsoleApp", "namespace").WithLocation(13, 35), - // (14,35): error CS0119: 'ParentNamespace.ConsoleApp' is a namespace, which is not valid in the given context + // CS0119: 'ParentNamespace.ConsoleApp' is a namespace, which is not valid in the given context // var y = from c in ParentNamespace.ConsoleApp select 3; Diagnostic(ErrorCode.ERR_BadSKunknown, "ParentNamespace.ConsoleApp").WithArguments("ParentNamespace.ConsoleApp", "namespace").WithLocation(14, 35), - // (15,35): error CS0119: 'NSAlias' is a namespace, which is not valid in the given context - // var z = from c in NSAlias select 3; - Diagnostic(ErrorCode.ERR_BadSKunknown, "NSAlias").WithArguments("NSAlias", "namespace").WithLocation(15, 35)); + // CS0119: 'NSAlias' is a namespace, which is not valid in the given context + // var z = /**/from c in NSAlias select 3/**/; + Diagnostic(ErrorCode.ERR_BadSKunknown, "NSAlias").WithArguments("NSAlias", "namespace").WithLocation(15, 45) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(12052, "https://github.com/dotnet/roslyn/issues/12052")] public void LambdaParameterConflictsWithRangeVariable() { - var code = @" + string source = @" using System; using System.Linq; @@ -2512,16 +3914,143 @@ class Program { static void Main() { - var res = from a in new[] { 1 } - select (Func)(a => 1); + var res = /**/from a in new[] { 1 } + select (Func)(a => 1)/**/; } } "; - CreateCompilationWithMscorlibAndSystemCore(code).VerifyDiagnostics( - // (10,43): error CS0136: A local or parameter named 'a' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter - // select (Func)(a => 1); + string expectedOperationTree = @" +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable>, IsInvalid) (Syntax: 'from a in n ... t>)(a => 1)') + Expression: IInvocationExpression (System.Collections.Generic.IEnumerable> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable>, IsInvalid) (Syntax: 'select (Fun ... t>)(a => 1)') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from a in new[] { 1 }') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from a in new[] { 1 }') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32[]) (Syntax: 'new[] { 1 }') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'new[] { 1 }') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{ 1 }') + Element Values(1): + 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, IsInvalid) (Syntax: '(Func)(a => 1)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func>, IsInvalid) (Syntax: '(Func)(a => 1)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: '(Func)(a => 1)') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: '(Func)(a => 1)') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: '(Func)(a => 1)') + ReturnedValue: IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func, IsInvalid) (Syntax: '(Func)(a => 1)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'a => 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '1') + IReturnStatement (OperationKind.ReturnStatement) (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) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0136: A local or parameter named 'a' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // select (Func)(a => 1)/**/; Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "a").WithArguments("a").WithLocation(10, 43) - ); + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void IOperationForQueryClause() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() { 1, 2, 3, 4, 5, 6, 7 }; + var r = from i in c /**/select i + 1/**/; + } +} +"; + string expectedOperationTree = @" +IInvocationExpression (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'select i + 1') + Instance Receiver: null + Arguments(2): + IArgument (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument) (Syntax: 'from i in c') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from i in c') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, 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) + IArgument (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'i + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func) (Syntax: 'i + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: lambda expression) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'i + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'i + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'i + 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i + 1') + Left: IOperation: (OperationKind.None) (Syntax: 'i') + Right: 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) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void IOperationForRangeVariableDefinition() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() { 1, 2, 3, 4, 5, 6, 7 }; + var r = /**/from i in c/**/ select i + 1; + } +} +"; + string expectedOperationTree = @" +ILocalReferenceExpression: c (OperationKind.LocalReferenceExpression, Type: System.Collections.Generic.List) (Syntax: 'c') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17838, "https://github.com/dotnet/roslyn/issues/17838")] + public void IOperationForRangeVariableReference() + { + string source = @" +using System.Collections.Generic; +using System.Linq; + +class Query +{ + public static void Main(string[] args) + { + List c = new List() { 1, 2, 3, 4, 5, 6, 7 }; + var r = from i in c select /**/i/**/ + 1; + } +} +"; + string expectedOperationTree = @" +IOperation: (OperationKind.None) (Syntax: 'i') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + 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 e43320e92c2376e328fb2b86c6ce89f2b626165a..8821ca2b9fd724f3241b243243c884be14ca9ce0 100644 --- a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs +++ b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs @@ -5866,4 +5866,78 @@ internal sealed partial class LazyCollectionElementInitializerExpression : BaseC protected override ImmutableArray ArgumentsImpl => _lazyArguments.Value; } + + /// + /// Represents an unrolled/lowered query expression in C# and VB. + /// For example, for the query expression "from x in set where x.Name != null select x.Name", the Operation tree has the following shape: + /// ITranslatedQueryExpression + /// IInvocationExpression ('Select' invocation for "select x.Name") + /// IInvocationExpression ('Where' invocation for "where x.Name != null") + /// IInvocationExpression ('From' invocation for "from x in set") + /// + internal abstract partial class BaseTranslatedQueryExpression : Operation, ITranslatedQueryExpression + { + protected BaseTranslatedQueryExpression(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(OperationKind.TranslatedQueryExpression, semanticModel, syntax, type, constantValue, isImplicit) + { + } + protected abstract IOperation ExpressionImpl { get; } + /// + /// Underlying unrolled expression. + /// + public IOperation Expression => Operation.SetParentOperation(ExpressionImpl, this); + public override IEnumerable Children + { + get + { + yield return Expression; + } + } + public override void Accept(OperationVisitor visitor) + { + visitor.VisitTranslatedQueryExpression(this); + } + public override TResult Accept(OperationVisitor visitor, TArgument argument) + { + return visitor.VisitTranslatedQueryExpression(this, argument); + } + } + + /// + /// Represents an unrolled/lowered query expression in C# and VB. + /// For example, for the query expression "from x in set where x.Name != null select x.Name", the Operation tree has the following shape: + /// ITranslatedQueryExpression + /// IInvocationExpression ('Select' invocation for "select x.Name") + /// IInvocationExpression ('Where' invocation for "where x.Name != null") + /// IInvocationExpression ('From' invocation for "from x in set") + /// + internal sealed partial class TranslatedQueryExpression : BaseTranslatedQueryExpression, ITranslatedQueryExpression + { + public TranslatedQueryExpression(IOperation expression, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(semanticModel, syntax, type, constantValue, isImplicit) + { + ExpressionImpl = expression; + } + protected override IOperation ExpressionImpl { get; } + } + + /// + /// Represents an unrolled/lowered query expression in C# and VB. + /// For example, for the query expression "from x in set where x.Name != null select x.Name", the Operation tree has the following shape: + /// ITranslatedQueryExpression + /// IInvocationExpression ('Select' invocation for "select x.Name") + /// IInvocationExpression ('Where' invocation for "where x.Name != null") + /// IInvocationExpression ('From' invocation for "from x in set") + /// + internal sealed partial class LazyTranslatedQueryExpression : BaseTranslatedQueryExpression, ITranslatedQueryExpression + { + private readonly Lazy _lazyExpression; + + public LazyTranslatedQueryExpression(Lazy expression, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(semanticModel, syntax, type, constantValue, isImplicit) + { + _lazyExpression = expression ?? throw new System.ArgumentNullException(nameof(expression)); + } + protected override IOperation ExpressionImpl => _lazyExpression.Value; + } } diff --git a/src/Compilers/Core/Portable/Operations/ITranslatedQueryExpression.cs b/src/Compilers/Core/Portable/Operations/ITranslatedQueryExpression.cs new file mode 100644 index 0000000000000000000000000000000000000000..99312f666e2c9a172a0f4d1277c2276c41d29e5f --- /dev/null +++ b/src/Compilers/Core/Portable/Operations/ITranslatedQueryExpression.cs @@ -0,0 +1,24 @@ +// 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.Semantics +{ + /// + /// Represents an unrolled/lowered query expression in C# and VB. + /// For example, for the query expression "from x in set where x.Name != null select x.Name", the Operation tree has the following shape: + /// ITranslatedQueryExpression + /// IInvocationExpression ('Select' invocation for "select x.Name") + /// IInvocationExpression ('Where' invocation for "where x.Name != null") + /// IInvocationExpression ('From' invocation for "from x in set") + /// + /// + /// This interface is reserved for implementation by its associated APIs. We reserve the right to + /// change it in the future. + /// + public interface ITranslatedQueryExpression : IOperation + { + /// + /// Underlying unrolled expression. + /// + IOperation Expression { get; } + } +} diff --git a/src/Compilers/Core/Portable/Operations/OperationCloner.cs b/src/Compilers/Core/Portable/Operations/OperationCloner.cs index 119b0d5bac7abf04dc9d7ecb30958912bd202978..5daab226cf807a8a92c58c05e38332412fb8a399 100644 --- a/src/Compilers/Core/Portable/Operations/OperationCloner.cs +++ b/src/Compilers/Core/Portable/Operations/OperationCloner.cs @@ -475,5 +475,10 @@ public override IOperation VisitTupleExpression(ITupleExpression operation, obje { return new TupleExpression(VisitArray(operation.Elements), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } + + public override IOperation VisitTranslatedQueryExpression(ITranslatedQueryExpression operation, object argument) + { + return new TranslatedQueryExpression(Visit(operation.Expression), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + } } } diff --git a/src/Compilers/Core/Portable/Operations/OperationKind.cs b/src/Compilers/Core/Portable/Operations/OperationKind.cs index 598c26c3dd30087a937ca275382b360eb1b2a2c6..c81d3d33680e2cdc2656772273736fa6aaf715d8 100644 --- a/src/Compilers/Core/Portable/Operations/OperationKind.cs +++ b/src/Compilers/Core/Portable/Operations/OperationKind.cs @@ -151,6 +151,8 @@ public enum OperationKind DynamicInvocationExpression = 0x127, /// Indicates an . DynamicIndexerAccessExpression = 0x128, + /// Indicates an . + TranslatedQueryExpression = 0x129, // Expressions that occur only in C#. @@ -179,7 +181,9 @@ public enum OperationKind /// Indicates an . OmittedArgumentExpression = 0x300, + // 0x301 was removed, and is available for use. + // https://github.com/dotnet/roslyn/issues/21294 // /// Indicates an . // PlaceholderExpression = 0x302, diff --git a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs index 2e22269ffa41fa4198e347e715a9deb19b11fbe1..c3c141202dff067192b653fc12e64487de663b07 100644 --- a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs +++ b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs @@ -485,6 +485,11 @@ public virtual void VisitTupleExpression(ITupleExpression operation) { DefaultVisit(operation); } + + public virtual void VisitTranslatedQueryExpression(ITranslatedQueryExpression operation) + { + DefaultVisit(operation); + } } /// @@ -976,5 +981,10 @@ public virtual TResult VisitTupleExpression(ITupleExpression operation, TArgumen { return DefaultVisit(operation, argument); } + + public virtual TResult VisitTranslatedQueryExpression(ITranslatedQueryExpression 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 4913a784695a685cf6418e3938b718cb75d93965..f956f863710519000f6ebc664b664344f2832795 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -114,6 +114,7 @@ Microsoft.CodeAnalysis.OperationKind.SizeOfExpression = 514 -> Microsoft.CodeAna Microsoft.CodeAnalysis.OperationKind.SwitchCase = 1033 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.SwitchStatement = 4 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.ThrowExpression = 519 -> Microsoft.CodeAnalysis.OperationKind +Microsoft.CodeAnalysis.OperationKind.TranslatedQueryExpression = 297 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.TupleExpression = 292 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.TypeOfExpression = 513 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.TypeParameterObjectCreationExpression = 275 -> Microsoft.CodeAnalysis.OperationKind @@ -405,6 +406,8 @@ Microsoft.CodeAnalysis.Semantics.ISymbolInitializer Microsoft.CodeAnalysis.Semantics.ISymbolInitializer.Value.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Semantics.IThrowExpression Microsoft.CodeAnalysis.Semantics.IThrowExpression.Expression.get -> Microsoft.CodeAnalysis.IOperation +Microsoft.CodeAnalysis.Semantics.ITranslatedQueryExpression +Microsoft.CodeAnalysis.Semantics.ITranslatedQueryExpression.Expression.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Semantics.ITupleExpression Microsoft.CodeAnalysis.Semantics.ITupleExpression.Elements.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Semantics.ITypeOfExpression @@ -556,6 +559,7 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSizeOfExpression( virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSwitchCase(Microsoft.CodeAnalysis.Semantics.ISwitchCase operation) -> void virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSwitchStatement(Microsoft.CodeAnalysis.Semantics.ISwitchStatement operation) -> void virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitThrowExpression(Microsoft.CodeAnalysis.Semantics.IThrowExpression operation) -> void +virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTranslatedQueryExpression(Microsoft.CodeAnalysis.Semantics.ITranslatedQueryExpression operation) -> void virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTupleExpression(Microsoft.CodeAnalysis.Semantics.ITupleExpression operation) -> void virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTypeOfExpression(Microsoft.CodeAnalysis.Semantics.ITypeOfExpression operation) -> void virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTypeParameterObjectCreationExpression(Microsoft.CodeAnalysis.Semantics.ITypeParameterObjectCreationExpression operation) -> void @@ -638,6 +642,7 @@ virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.Vi virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSwitchCase(Microsoft.CodeAnalysis.Semantics.ISwitchCase operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitSwitchStatement(Microsoft.CodeAnalysis.Semantics.ISwitchStatement operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitThrowExpression(Microsoft.CodeAnalysis.Semantics.IThrowExpression operation, TArgument argument) -> TResult +virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTranslatedQueryExpression(Microsoft.CodeAnalysis.Semantics.ITranslatedQueryExpression operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTupleExpression(Microsoft.CodeAnalysis.Semantics.ITupleExpression operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTypeOfExpression(Microsoft.CodeAnalysis.Semantics.ITypeOfExpression operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Semantics.OperationVisitor.VisitTypeParameterObjectCreationExpression(Microsoft.CodeAnalysis.Semantics.ITypeParameterObjectCreationExpression operation, TArgument argument) -> TResult diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Query.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Query.vb index b9128aa178370914e2bdaa8eae564da9b6cfe86e..cfddaed53c9624e262af3da0285588fc85ca06cf 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Query.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Query.vb @@ -40,11 +40,47 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim originalMethodOrLambda = Me._currentMethodOrLambda Me._currentMethodOrLambda = node.LambdaSymbol + PopulateRangeVariableMapForQueryLambdaRewrite(node, _rangeVariableMap, _inExpressionLambda) + + Dim save_createSequencePointsForTopLevelNonCompilerGeneratedExpressions = _instrumentTopLevelNonCompilerGeneratedExpressionsInQuery + Dim synthesizedKind As SynthesizedLambdaKind = node.LambdaSymbol.SynthesizedKind + Dim instrumentQueryLambdaBody As Boolean = synthesizedKind = SynthesizedLambdaKind.AggregateQueryLambda OrElse + synthesizedKind = SynthesizedLambdaKind.LetVariableQueryLambda + + _instrumentTopLevelNonCompilerGeneratedExpressionsInQuery = Not instrumentQueryLambdaBody + + Dim rewrittenBody As BoundExpression = VisitExpressionNode(node.Expression) + Dim returnstmt = CreateReturnStatementForQueryLambdaBody(rewrittenBody, node) + + If instrumentQueryLambdaBody AndAlso Instrument Then + returnstmt = _instrumenterOpt.InstrumentQueryLambdaBody(node, returnstmt) + End If + + RemoveRangeVariables(node, _rangeVariableMap) + + _instrumentTopLevelNonCompilerGeneratedExpressionsInQuery = save_createSequencePointsForTopLevelNonCompilerGeneratedExpressions + + Me._hasLambdas = True + + Dim result As BoundLambda = RewriteQueryLambda(returnstmt, node) + + ' Done with lambda body rewrite, restore current lambda. + ' END LAMBDA REWRITE + Me._currentMethodOrLambda = originalMethodOrLambda + + Return result + End Function + + Friend Shared Sub PopulateRangeVariableMapForQueryLambdaRewrite( + node As BoundQueryLambda, + ByRef rangeVariableMap As Dictionary(Of RangeVariableSymbol, BoundExpression), + inExpressionLambda As Boolean) + Dim nodeRangeVariables As ImmutableArray(Of RangeVariableSymbol) = node.RangeVariables If nodeRangeVariables.Length > 0 Then - If _rangeVariableMap Is Nothing Then - _rangeVariableMap = New Dictionary(Of RangeVariableSymbol, BoundExpression)() + If rangeVariableMap Is Nothing Then + rangeVariableMap = New Dictionary(Of RangeVariableSymbol, BoundExpression)() End If Dim firstUnmappedRangeVariable As Integer = 0 @@ -64,78 +100,40 @@ Namespace Microsoft.CodeAnalysis.VisualBasic parameter.Type) If isReservedName AndAlso Not String.Equals(parameterName, StringConstants.Group, StringComparison.Ordinal) Then - ' Compound variable. - ' Each range variable is an Anonymous Type property. - Debug.Assert(parameterName.Equals(StringConstants.It) OrElse parameterName.Equals(StringConstants.It1) OrElse parameterName.Equals(StringConstants.It2)) - PopulateRangeVariableMapForAnonymousType(node.Syntax, paramRef, nodeRangeVariables, firstUnmappedRangeVariable) + If parameter.Type.IsErrorType() Then + ' Skip adding variables to the range variable map and bail out for error case. + Return + Else + ' Compound variable. + ' Each range variable is an Anonymous Type property. + Debug.Assert(parameterName.Equals(StringConstants.It) OrElse parameterName.Equals(StringConstants.It1) OrElse parameterName.Equals(StringConstants.It2)) + PopulateRangeVariableMapForAnonymousType(node.Syntax, paramRef, nodeRangeVariables, firstUnmappedRangeVariable, rangeVariableMap, inExpressionLambda) + End If Else ' Simple case, range variable is a lambda parameter. Debug.Assert(IdentifierComparison.Equals(parameterName, nodeRangeVariables(firstUnmappedRangeVariable).Name)) - _rangeVariableMap.Add(nodeRangeVariables(firstUnmappedRangeVariable), paramRef) + rangeVariableMap.Add(nodeRangeVariables(firstUnmappedRangeVariable), paramRef) firstUnmappedRangeVariable += 1 End If Next Debug.Assert(firstUnmappedRangeVariable = nodeRangeVariables.Length) End If + End Sub - Dim save_createSequencePointsForTopLevelNonCompilerGeneratedExpressions = _instrumentTopLevelNonCompilerGeneratedExpressionsInQuery - Dim synthesizedKind As SynthesizedLambdaKind = node.LambdaSymbol.SynthesizedKind - Dim instrumentQueryLambdaBody As Boolean = synthesizedKind = SynthesizedLambdaKind.AggregateQueryLambda OrElse - synthesizedKind = SynthesizedLambdaKind.LetVariableQueryLambda - - _instrumentTopLevelNonCompilerGeneratedExpressionsInQuery = Not instrumentQueryLambdaBody - - Dim returnstmt As BoundStatement = New BoundReturnStatement(node.Syntax, - VisitExpressionNode(node.Expression), - Nothing, - Nothing) - - If instrumentQueryLambdaBody AndAlso Instrument Then - returnstmt = _instrumenterOpt.InstrumentQueryLambdaBody(node, returnstmt) - End If - - _instrumentTopLevelNonCompilerGeneratedExpressionsInQuery = save_createSequencePointsForTopLevelNonCompilerGeneratedExpressions - - For Each rangeVar As RangeVariableSymbol In nodeRangeVariables - _rangeVariableMap.Remove(rangeVar) - Next - - Dim lambdaBody = New BoundBlock(node.Syntax, - Nothing, - ImmutableArray(Of LocalSymbol).Empty, - ImmutableArray.Create(returnstmt)) - - Me._hasLambdas = True - - Dim result As BoundLambda = New BoundLambda(node.Syntax, - node.LambdaSymbol, - lambdaBody, - ImmutableArray(Of Diagnostic).Empty, - Nothing, - ConversionKind.DelegateRelaxationLevelNone, - MethodConversionKind.Identity) - - result.MakeCompilerGenerated() - - ' Done with lambda body rewrite, restore current lambda. - ' END LAMBDA REWRITE - Me._currentMethodOrLambda = originalMethodOrLambda - - Return result - End Function - - Private Sub PopulateRangeVariableMapForAnonymousType( + Private Shared Sub PopulateRangeVariableMapForAnonymousType( syntax As SyntaxNode, anonymousTypeInstance As BoundExpression, rangeVariables As ImmutableArray(Of RangeVariableSymbol), - ByRef firstUnmappedRangeVariable As Integer - ) + ByRef firstUnmappedRangeVariable As Integer, + rangeVariableMap As Dictionary(Of RangeVariableSymbol, BoundExpression), + inExpressionLambda As Boolean) + Dim anonymousType = DirectCast(anonymousTypeInstance.Type, AnonymousTypeManager.AnonymousTypePublicSymbol) For Each propertyDef As PropertySymbol In anonymousType.Properties Dim getCallOrPropertyAccess As BoundExpression = Nothing - If _inExpressionLambda Then + If inExpressionLambda Then ' NOTE: If we are in context of a lambda to be converted to an expression tree we need to use PropertyAccess. getCallOrPropertyAccess = New BoundPropertyAccess(syntax, propertyDef, @@ -162,16 +160,50 @@ Namespace Microsoft.CodeAnalysis.VisualBasic If propertyDefName.StartsWith("$"c, StringComparison.Ordinal) AndAlso Not String.Equals(propertyDefName, StringConstants.Group, StringComparison.Ordinal) Then ' Nested compound variable. Debug.Assert(propertyDefName.Equals(StringConstants.It) OrElse propertyDefName.Equals(StringConstants.It1) OrElse propertyDefName.Equals(StringConstants.It2)) - PopulateRangeVariableMapForAnonymousType(syntax, getCallOrPropertyAccess, rangeVariables, firstUnmappedRangeVariable) - + PopulateRangeVariableMapForAnonymousType(syntax, getCallOrPropertyAccess, rangeVariables, firstUnmappedRangeVariable, rangeVariableMap, inExpressionLambda) Else Debug.Assert(IdentifierComparison.Equals(propertyDefName, rangeVariables(firstUnmappedRangeVariable).Name)) - _rangeVariableMap.Add(rangeVariables(firstUnmappedRangeVariable), getCallOrPropertyAccess) + rangeVariableMap.Add(rangeVariables(firstUnmappedRangeVariable), getCallOrPropertyAccess) firstUnmappedRangeVariable += 1 End If Next End Sub + Friend Shared Function CreateReturnStatementForQueryLambdaBody( + rewrittenBody As BoundExpression, + originalNode As BoundQueryLambda) As BoundStatement + + Return New BoundReturnStatement(originalNode.Syntax, + rewrittenBody, + Nothing, + Nothing) + End Function + + Friend Shared Sub RemoveRangeVariables(originalNode As BoundQueryLambda, rangeVariableMap As Dictionary(Of RangeVariableSymbol, BoundExpression)) + For Each rangeVar As RangeVariableSymbol In originalNode.RangeVariables + rangeVariableMap.Remove(rangeVar) + Next + End Sub + + Friend Shared Function RewriteQueryLambda(rewrittenBody As BoundStatement, originalNode As BoundQueryLambda) As BoundLambda + Dim lambdaBody = New BoundBlock(originalNode.Syntax, + Nothing, + ImmutableArray(Of LocalSymbol).Empty, + ImmutableArray.Create(rewrittenBody)) + + Dim result As BoundLambda = New BoundLambda(originalNode.Syntax, + originalNode.LambdaSymbol, + lambdaBody, + ImmutableArray(Of Diagnostic).Empty, + Nothing, + ConversionKind.DelegateRelaxationLevelNone, + MethodConversionKind.Identity) + + result.MakeCompilerGenerated() + + Return result + End Function + Public Overrides Function VisitRangeVariable(node As BoundRangeVariable) As BoundNode Return _rangeVariableMap(node.RangeVariable) End Function diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 1e74b3efdea2a6c282df762c0c2cd8aa8f8f4b03..e16aeb485cafac26dbc8f6289f32f7dc9e10bf77 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -26,11 +26,12 @@ Namespace Microsoft.CodeAnalysis.Semantics ' this should be removed once this issue is fixed ' https://github.com/dotnet/roslyn/issues/21186 - If TypeOf boundNode Is BoundValuePlaceholderBase Then - ' since same place holder bound node appears in multiple places in the tree + ' https://github.com/dotnet/roslyn/issues/21554 + If TypeOf boundNode Is BoundValuePlaceholderBase OrElse + (TypeOf boundNode Is BoundParameter AndAlso boundNode.WasCompilerGenerated) Then + ' since same bound node appears in multiple places in the tree ' we can't use bound node to operation map. - ' for now, we will just create new operation and return clone but we need to figure out - ' what we want to do with place holder node such as just returning nothing + ' for now, we will just create new operation and return cloned Return _semanticModel.CloneOperation(CreateInternal(boundNode)) End If @@ -238,6 +239,36 @@ Namespace Microsoft.CodeAnalysis.Semantics Return Create(DirectCast(boundNode, BoundAnonymousTypeFieldInitializer).Value) Case BoundKind.AnonymousTypePropertyAccess Return CreateBoundAnonymousTypePropertyAccessOperation(DirectCast(boundNode, BoundAnonymousTypePropertyAccess)) + Case BoundKind.QueryExpression + Return CreateBoundQueryExpressionOperation(DirectCast(boundNode, BoundQueryExpression)) + Case BoundKind.QueryClause + ' Query clause has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundQueryClause).UnderlyingExpression) + Case BoundKind.QueryableSource + ' Queryable source has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundQueryableSource).Source) + Case BoundKind.AggregateClause + ' Aggregate clause has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundAggregateClause).UnderlyingExpression) + Case BoundKind.Ordering + ' Ordering clause has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundOrdering).UnderlyingExpression) + Case BoundKind.GroupAggregation + ' Group aggregation has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundGroupAggregation).Group) + Case BoundKind.QuerySource + ' Query source has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundQuerySource).Expression) + Case BoundKind.ToQueryableCollectionConversion + ' Queryable collection conversion has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundToQueryableCollectionConversion).ConversionCall) + Case BoundKind.QueryLambda + ' Query lambda must be lowered to the regular lambda form for the operation tree. + Dim rewrittenLambda As BoundNode = RewriteQueryLambda(DirectCast(boundNode, BoundQueryLambda)) + Return Create(rewrittenLambda) + Case BoundKind.RangeVariableAssignment + ' Range variable assignment has no special representation in the IOperation tree + Return Create(DirectCast(boundNode, BoundRangeVariableAssignment).Value) Case Else Dim constantValue = ConvertToOptional(TryCast(boundNode, BoundExpression)?.ConstantValueOpt) Dim isImplicit As Boolean = boundNode.WasCompilerGenerated @@ -1351,6 +1382,15 @@ Namespace Microsoft.CodeAnalysis.Semantics Dim isImplicit As Boolean = boundAnonymousTypePropertyAccess.WasCompilerGenerated Return New LazyPropertyReferenceExpression([property], instance, [property], argumentsInEvaluationOrder, _semanticModel, syntax, type, constantValue, isImplicit) End Function + + Private Function CreateBoundQueryExpressionOperation(boundQueryExpression As BoundQueryExpression) As IOperation + Dim expression As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundQueryExpression.LastOperator)) + Dim syntax As SyntaxNode = boundQueryExpression.Syntax + Dim type As ITypeSymbol = boundQueryExpression.Type + Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundQueryExpression.ConstantValueOpt) + Dim isImplicit As Boolean = boundQueryExpression.WasCompilerGenerated + Return New LazyTranslatedQueryExpression(expression, _semanticModel, syntax, type, constantValue, isImplicit) + End Function End Class End Namespace diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_QueryLambdaRewriter.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_QueryLambdaRewriter.vb new file mode 100644 index 0000000000000000000000000000000000000000..64a57c6035d86059f5dc2cd00b273958da080281 --- /dev/null +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_QueryLambdaRewriter.vb @@ -0,0 +1,80 @@ +' 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.VisualBasic +Imports Microsoft.CodeAnalysis.VisualBasic.BoundTreeVisitor +Imports Microsoft.CodeAnalysis.VisualBasic.Symbols + +Namespace Microsoft.CodeAnalysis.Semantics + Partial Friend NotInheritable Class VisualBasicOperationFactory + Private Shared Function RewriteQueryLambda(node As BoundQueryLambda) As BoundNode + ' We rewrite query lambda into regular lambda with 2 passes. + ' Pass 1 uses helper methods from LocalRewriter to do the lowering. This introduces large number of DAGs. + ' Pass 2 walks over the lowered tree and replaces duplicate bound nodes in the tree with their clones - this is a requirement for the Operation tree. + ' Note that the rewriter also rewrites all the query lambdas inside the body of this query lambda. + + Try + Dim pass1Rewriter As New QueryLambdaRewriterPass1 + Dim rewrittenLambda As BoundLambda = DirectCast(pass1Rewriter.VisitQueryLambda(node), BoundLambda) + + Dim pass2Rewriter As New QueryLambdaRewriterPass2 + Return pass2Rewriter.VisitLambda(rewrittenLambda) + Catch ex As CancelledByStackGuardException + Return node + End Try + End Function + + Private NotInheritable Class QueryLambdaRewriterPass1 + Inherits BoundTreeRewriterWithStackGuard + Private _rangeVariableMap As Dictionary(Of RangeVariableSymbol, BoundExpression) + + Public Sub New() + _rangeVariableMap = Nothing + End Sub + + Public Overrides Function VisitQueryLambda(node As BoundQueryLambda) As BoundNode + LocalRewriter.PopulateRangeVariableMapForQueryLambdaRewrite(node, _rangeVariableMap, inExpressionLambda:=True) + Dim rewrittenBody As BoundExpression = VisitExpressionWithStackGuard(node.Expression) + Dim rewrittenStatement As BoundStatement = LocalRewriter.CreateReturnStatementForQueryLambdaBody(rewrittenBody, node) + LocalRewriter.RemoveRangeVariables(node, _rangeVariableMap) + Return LocalRewriter.RewriteQueryLambda(rewrittenStatement, node) + End Function + + Public Overrides Function VisitRangeVariable(node As BoundRangeVariable) As BoundNode + Dim expression As BoundExpression = Nothing + If Not _rangeVariableMap.TryGetValue(node.RangeVariable, expression) Then + ' _rangeVariableMap might not contain an entry for the range variable for error cases. + Return node + End If + +#If DEBUG Then + ' Range variable reference should be rewritten to a parameter reference or a property access. + ' We clone these bound nodes in QueryLambdaRewriterPass2 to avoid dag in the generated bound tree. + ' If the LocalRewriter is changed to generate more kind of bound nodes for range variables, we should handle these in QueryLambdaRewriterPass2. + ' Below assert helps us to stay in sync with the LocalRewriter. + Select Case expression.Kind + Case BoundKind.Parameter + Case BoundKind.PropertyAccess + Exit Select + Case Else + Debug.Fail($"Unexpected bound kind '{expression.Kind}' generated for range variable rewrite by method '{NameOf(LocalRewriter.PopulateRangeVariableMapForQueryLambdaRewrite)}'") + End Select +#End If + + Return expression + End Function + End Class + + Private NotInheritable Class QueryLambdaRewriterPass2 + Inherits BoundTreeRewriterWithStackGuard + Private ReadOnly _uniqueNodes As New HashSet(Of BoundParameter) + + Public Overrides Function VisitParameter(node As BoundParameter) As BoundNode + If node.ParameterSymbol?.ContainingSymbol.IsQueryLambdaMethod AndAlso Not _uniqueNodes.Add(node) Then + node = New BoundParameter(node.Syntax, node.ParameterSymbol, node.IsLValue, node.SuppressVirtualCalls, node.Type, node.HasErrors) + End If + + Return node + End Function + End Class + End Class +End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index 9ead5c7ad5757ed15c4fc4de2afb10bd5b416b02..d5da014006503adbbc2d9f67c1a6764f7e695f95 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -476,7 +476,7 @@ BC30518: Overload resolution failed because no accessible 'P1' can be called wit End Sub - + Public Sub TestClone() Dim sourceCode = TestResource.AllInOneVisualBasicCode @@ -491,7 +491,7 @@ BC30518: Overload resolution failed because no accessible 'P1' can be called wit End Sub - + Public Sub TestParentOperations() Dim sourceCode = TestResource.AllInOneVisualBasicCode diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb index 6a298310e9fbd4bd45ffcd1a0abcc1bd4f667d5e..a7fc2f05768c33d4912a075398d58c16b3c6f114 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb @@ -89,30 +89,22 @@ End Class ]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -139,28 +131,17 @@ Class C End Class]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -189,30 +170,22 @@ End Class]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -239,52 +212,41 @@ Class C End Class]]>.Value Dim expectedOperationTree = , )(keySelector As System.Func(Of System.String, ), resultSelector As System.Func(Of , System.Collections.Generic.IEnumerable(Of System.String), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group By w ... nto Count()') - Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.String)) (Syntax: 'y In x') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) - Operand: IOperation: (OperationKind.None) (Syntax: 'y In x') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'x') - Children(1): - IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.String()) (Syntax: 'x') - Arguments(2): - IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 'x') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.String, )) (Syntax: 'x') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IOperation: (OperationKind.None) (Syntax: 'x') - Children(1): - IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By w ... nto Count()') - Initializers(2): - IOperation: (OperationKind.None) (Syntax: 'w = x') - Children(1): - IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.String()) (Syntax: 'x') - IOperation: (OperationKind.None) (Syntax: 'z = y') - Children(1): - IOperation: (OperationKind.None) (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) - IArgument (ArgumentKind.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group By w ... nto Count()') - IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Collections.Generic.IEnumerable(Of System.String), )) (Syntax: 'Group By w ... nto Count()') - Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - Operand: IOperation: (OperationKind.None) (Syntax: 'Group By w ... nto Count()') - Children(1): - IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By w ... nto Count()') - Initializers(3): - IOperation: (OperationKind.None) (Syntax: 'w') - IOperation: (OperationKind.None) (Syntax: 'z') - IOperation: (OperationKind.None) (Syntax: 'Count()') - Children(1): - IOperation: (OperationKind.None) (Syntax: 'Count()') - Children(1): - IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.String).Count() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Count()') - Instance Receiver: IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.String)) (Syntax: 'Group By w ... nto Count()') - Arguments(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) +ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'From y In x ... nto Count()') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.String).GroupBy(Of , )(keySelector As System.Func(Of System.String, ), resultSelector As System.Func(Of , System.Collections.Generic.IEnumerable(Of System.String), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group By w ... nto Count()') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.String)) (Syntax: 'y In x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.String()) (Syntax: 'x') + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 'x') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.String, )) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (y As System.String) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By w ... nto Count()') + Initializers(2): + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.String()) (Syntax: 'x') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.String) (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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group By w ... nto Count()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Collections.Generic.IEnumerable(Of System.String), )) (Syntax: 'Group By w ... nto Count()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.String)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group By w ... nto Count()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group By w ... nto Count()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group By w ... nto Count()') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By w ... nto Count()') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .w As System.String() (OperationKind.PropertyReferenceExpression, Type: System.String()) (Syntax: 'Group By w ... nto Count()') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Group By w ... nto Count()') + IPropertyReferenceExpression: ReadOnly Property .z As System.String (OperationKind.PropertyReferenceExpression, Type: System.String) (Syntax: 'Group By w ... nto Count()') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Group By w ... nto Count()') + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.String).Count() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Count()') + Instance Receiver: IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.String)) (Syntax: 'Group By w ... nto Count()') + Arguments(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) ]]>.Value Dim expectedDiagnostics = String.Empty diff --git a/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb b/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb index 0030a317f1468d705932e7ad98616cab8e6c7767..c828b8865802c39e8dad8143543e6a6d6b0bf43a 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb @@ -1,6 +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. +Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic +Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics @@ -40,6 +42,51 @@ Select ]]>) End Sub + + + Public Sub ImplicitSelectClause_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Test2() Dim compilationDef = @@ -84,6 +131,72 @@ Where End Sub + + + Public Sub WhereClause_IOperation() + Dim source = 0 Where 10 > s'BIND:"From s In q Where s > 0 Where 10 > s" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = s') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble) (Syntax: 'From s In q ... here 10 > s') + Expression: IInvocationExpression ( Function QueryAble.Where(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Where 10 > s') + Instance Receiver: IInvocationExpression ( Function QueryAble.Where(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Where s > 0') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: '10 > s') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: '10 > s') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '10 > s') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '10 > s') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: '10 > s') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '10 > s') + Left: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + Right: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: '10 > 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Test3() Dim compilationDef = @@ -123,11 +236,10 @@ Where System.Func`2[System.Int32,System.Boolean] End Sub + Public Sub Test4() - Dim compilationDef = - - + Dim source = 0 - End Sub -End Module - - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble, IsInvalid) (Syntax: 'From s In q Where s > 0') + Expression: IInvalidExpression (OperationKind.InvalidExpression, Type: QueryAble, IsInvalid) (Syntax: 'Where s > 0') + Children(2): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'Where s > 0') + Children(1): + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') +]]>.Value + + Dim expectedDiagnostics = 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ BC36594: Definition of method 'Where' is not accessible in this context. - Dim q1 As Object = From s In q Where s > 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ -) +]]>.Value + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + Public Sub Test5() - Dim compilationDef = - - + Dim source = 0 - End Sub -End Module - - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble, IsInvalid) (Syntax: 'From s In q Where s > 0') + Expression: IInvalidExpression (OperationKind.InvalidExpression, Type: QueryAble, IsInvalid) (Syntax: 'Where s > 0') + Children(2): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'Where s > 0') + Children(1): + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') +]]>.Value + + Dim expectedDiagnostics = 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ BC32050: Type parameter 'U' for 'Public Function Where(Of T, U)(x As Func(Of Integer, Boolean)) As QueryAble' cannot be inferred. - Dim q1 As Object = From s In q Where s > 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ BC36594: Definition of method 'Where' is not accessible in this context. - Dim q1 As Object = From s In q Where s > 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ -) +]]>.Value + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + Public Sub Test6() - Dim compilationDef = - - + Dim source = 0 - End Sub -End Module - - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble, IsInvalid) (Syntax: 'From s In q Where s > 0') + Expression: IInvalidExpression (OperationKind.InvalidExpression, Type: QueryAble, IsInvalid) (Syntax: 'Where s > 0') + Children(2): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'Where s > 0') + Children(1): + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0') +]]>.Value + + Dim expectedDiagnostics = 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ BC36648: Data type(s) of the type parameter(s) in method 'Public Function Where(Of T, U)(x As Func(Of T, Action(Of U))) As QueryAble' cannot be inferred from these arguments. - Dim q1 As Object = From s In q Where s > 0 + Dim q1 As Object = From s In q Where s > 0'BIND:"From s In q Where s > 0" ~~~~~ -) +]]>.Value + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -333,6 +482,111 @@ AsQueryable End Sub + + + Public Sub MultipleSelectClauses_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Test8() Dim compilationDef = @@ -1782,6 +2036,193 @@ True End Sub + + + Public Sub Select1_IOperation() + Dim source = 0 + Select Num1() + Where Num1 = -10 + Select Module1.Num2() + Where Num2 = -10 + Num1() + Select ind!Two + Where Two > 0 + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble) (Syntax: 'From s In q ... ere Two > 0') + Expression: IInvocationExpression ( Function QueryAble.Where(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Where Two > 0') + Instance Receiver: IInvocationExpression ( Function QueryAble.Select(x As System.Func(Of System.Int32, System.Int32)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Select ind!Two') + Instance Receiver: IInvocationExpression ( Function QueryAble.Where(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Where Num2 ... 10 + Num1()') + Instance Receiver: IInvocationExpression ( Function QueryAble.Select(x As System.Func(Of System.Int32, System.Int32)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Select Module1.Num2()') + Instance Receiver: IInvocationExpression ( Function QueryAble.Where(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Where Num1 = -10') + Instance Receiver: IInvocationExpression ( Function QueryAble.Select(x As System.Func(Of System.Int32, System.Int32)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Select Num1()') + Instance Receiver: IInvocationExpression ( Function QueryAble.Where(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Where s > 0') + Instance Receiver: IInvocationExpression ( Function QueryAble.Select(x As System.Func(Of System.Int32, System.Int32)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Select s') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's') + ReturnedValue: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'Num1()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 'Num1()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Num1()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Num1()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Num1()') + ReturnedValue: IInvocationExpression (Function Module1.Num1() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Num1()') + Instance Receiver: null + Arguments(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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'Num1 = -10') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 'Num1 = -10') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (Num1 As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Num1 = -10') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Num1 = -10') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Num1 = -10') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'Num1 = -10') + Left: IParameterReferenceExpression: Num1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Num1 = -10') + Right: IUnaryOperatorExpression (UnaryOperatorKind.Minus, Checked) (OperationKind.UnaryOperatorExpression, Type: System.Int32, Constant: -10) (Syntax: '-10') + Operand: ILiteralExpression (OperationKind.LiteralExpression, 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'Module1.Num2()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 'Module1.Num2()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (Num1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Module1.Num2()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Module1.Num2()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Module1.Num2()') + ReturnedValue: IInvocationExpression (Function Module1.Num2() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Module1.Num2()') + Instance Receiver: null + Arguments(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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'Num2 = -10 + Num1()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 'Num2 = -10 + Num1()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (Num2 As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Num2 = -10 + Num1()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Num2 = -10 + Num1()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Num2 = -10 + Num1()') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'Num2 = -10 + Num1()') + Left: IParameterReferenceExpression: Num2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Num2 = -10 + Num1()') + Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '-10 + Num1()') + Left: IUnaryOperatorExpression (UnaryOperatorKind.Minus, Checked) (OperationKind.UnaryOperatorExpression, Type: System.Int32, Constant: -10) (Syntax: '-10') + Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + Right: IInvocationExpression (Function Module1.Num1() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Num1()') + Instance Receiver: null + Arguments(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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'ind!Two') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 'ind!Two') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (Num2 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'ind!Two') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'ind!Two') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'ind!Two') + ReturnedValue: IPropertyReferenceExpression: Property Module1.Index.Item(x As System.String) As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'ind!Two') + Instance Receiver: ILocalReferenceExpression: ind (OperationKind.LocalReferenceExpression, Type: Module1.Index) (Syntax: 'ind') + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'Two') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: "Two") (Syntax: 'Two') + InConversion: CommonConversion (Exists: True, 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 'Two > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 'Two > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (Two As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Two > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Two > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Two > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'Two > 0') + Left: IParameterReferenceExpression: Two (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Two > 0') + Right: 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Select2() Dim compilationDef = @@ -2495,11 +2936,10 @@ Where ]]>) End Sub + Public Sub Where1() - Dim compilationDef = - - + Dim source = - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q1 As Object = From s In q Where s'BIND:"From s In q Where s" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = ) +]]>.Value + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -3114,11 +3565,10 @@ BC42016: Implicit conversion from 'Boolean' to 'String'. End Sub + - Public Sub While1() - Dim compilationDef = - - + Public Sub While1_TakeWhile() + Dim source = 1 - Dim q2 As Object = From s In q Skip While s > 1 - End Sub -End Module - - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q1 As Object = From s In q Take While s > 1'BIND:"From s In q Take While s > 1" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 1') + Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'From s In q ... While s > 1') + Expression: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'Take While s > 1') + Children(2): + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 1') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 1') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') +]]>.Value + + Dim expectedDiagnostics = 1 + Dim q1 As Object = From s In q Take While s > 1'BIND:"From s In q Take While s > 1" ~~~~~~~~~~ +]]>.Value + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub While1_SkipWhile() + Dim source = 1'BIND:"From s In q Skip While s > 1" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 1') + Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: ?, IsInvalid) (Syntax: 'From s In q ... While s > 1') + Expression: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'Skip While s > 1') + Children(2): + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 1') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 1') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') +]]>.Value + + Dim expectedDiagnostics = 1 + Dim q2 As Object = From s In q Skip While s > 1'BIND:"From s In q Skip While s > 1" ~~~~~~~~~~ -) +]]>.Value + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -3213,44 +3716,271 @@ Select End Sub - - Public Sub Distinct1() - Dim compilationDef = - - + + + Public Sub SkipWhile_IOperation() + Dim source = 0'BIND:"From s In q Skip While s > 0" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble) (Syntax: 'From s In q ... While s > 0') + Expression: IInvocationExpression ( Function QueryAble.SkipWhile(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Skip While s > 0') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TakeWhile_IOperation() + Dim source = 0'BIND:"From s In q Take While s > 0" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: QueryAble) (Syntax: 'From s In q ... While s > 0') + Expression: IInvocationExpression ( Function QueryAble.TakeWhile(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Take While s > 0') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TakeWhileAndSkipWhile_IOperation() + Dim source = 0 Take While 10 > s Skip While s > 0 Select s'BIND:"From s In q Skip While s > 0 Take While 10 > s Skip While s > 0 Select s" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Instance Receiver: IInvocationExpression ( Function QueryAble.TakeWhile(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Take While 10 > s') + Instance Receiver: IInvocationExpression ( Function QueryAble.SkipWhile(x As System.Func(Of System.Int32, System.Boolean)) As QueryAble) (OperationKind.InvocationExpression, Type: QueryAble) (Syntax: 'Skip While s > 0') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: '10 > s') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: '10 > s') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '10 > s') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '10 > s') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: '10 > s') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: '10 > s') + Left: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10) (Syntax: '10') + Right: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: '10 > 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's') + ReturnedValue: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub Distinct1() + Dim source = 1 Distinct End Sub -End Module - - +End Module]]>.Value - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) + Dim expectedOperationTree = .Value - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim expectedDiagnostics = 1 Distinct ~~~~~~~~~~ -) +]]>.Value + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -3297,6 +4027,103 @@ Distinct End Sub + + + Public Sub Distinct2_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub MultipleDistinct_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub SkipTake1() Dim compilationDef = @@ -3401,6 +4228,118 @@ Skip 2 ]]>) End Sub + + + Public Sub Skip_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub Take_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub SkipTake3() Dim compilationDef = @@ -3777,6 +4716,322 @@ OrderBy 0 ]]>) End Sub + + + Public Sub OrderByAscending_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub OrderByDescending_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub OrderByAscendingDescending_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub OrderBy5() Dim compilationDef = @@ -4210,6 +5465,268 @@ End Module ]]>) End Sub + + + Public Sub Let_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... s2 = s1 + 1') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Select(Of )(selector As System.Func(Of System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 's2 = s1 + 1') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1 + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, )) (Syntax: 's1 + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + 1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 's2 = s1 + 1') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + Right: 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub LetMultipleVariables_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... 3 = s2 + s1') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Select(Of )(selector As System.Func(Of , )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 's3 = s2 + s1') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Select(Of )(selector As System.Func(Of System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 's2 = s1 + 1') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1 + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, )) (Syntax: 's1 + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + 1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 's2 = s1 + 1') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's2 + s1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , )) (Syntax: 's2 + s1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2 + s1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2 + s1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2 + s1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 's3 = s2 + s1') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2 + s1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2 + s1') + IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2 + s1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2 + s1') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's2 + s1') + Left: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2 + s1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2 + s1') + Right: IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2 + s1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2 + s1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub LetMultipleClauses_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... 2 + s3 + s4') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key s3 As System.Int32>, Key s4 As System.Int32>).Select(Of )(selector As System.Func(Of , Key s3 As System.Int32>, Key s4 As System.Int32>, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 's5 = s1 + s2 + s3 + s4') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key s3 As System.Int32>).Select(Of , Key s3 As System.Int32>, Key s4 As System.Int32>)(selector As System.Func(Of , Key s3 As System.Int32>, , Key s3 As System.Int32>, Key s4 As System.Int32>)) As System.Collections.Generic.IEnumerable(Of , Key s3 As System.Int32>, Key s4 As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key s3 As System.Int32>, Key s4 As System.Int32>)) (Syntax: 's4 = s1 + s2 + s3') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Select(Of , Key s3 As System.Int32>)(selector As System.Func(Of , , Key s3 As System.Int32>)) As System.Collections.Generic.IEnumerable(Of , Key s3 As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key s3 As System.Int32>)) (Syntax: 's3 = s2 + s1') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Select(Of )(selector As System.Func(Of System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 's2 = s1 + 1') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New Integer() {3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {3}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{3}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1 + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, )) (Syntax: 's1 + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + 1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 's2 = s1 + 1') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's2 + s1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , , Key s3 As System.Int32>)) (Syntax: 's2 + s1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As , Key s3 As System.Int32>) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2 + s1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2 + s1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2 + s1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: , Key s3 As System.Int32>) (Syntax: 's3 = s2 + s1') + Initializers(2): + IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's3 = s2 + s1') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's2 + s1') + Left: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2 + s1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2 + s1') + Right: IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2 + s1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2 + s1') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1 + s2 + s3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key s3 As System.Int32>, , Key s3 As System.Int32>, Key s4 As System.Int32>)) (Syntax: 's1 + s2 + s3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key s3 As System.Int32>) As , Key s3 As System.Int32>, Key s4 As System.Int32>) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + s2 + s3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + s2 + s3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + s2 + s3') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's4 = s1 + s2 + s3') + Initializers(2): + IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's4 = s1 + s2 + s3') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + s2') + Left: IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.$VB$It As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 's1 + s2 + s3') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3') + Right: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.$VB$It As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 's1 + s2 + s3') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3') + Right: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.s3 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1 + s2 + s3 + s4') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key s3 As System.Int32>, Key s4 As System.Int32>, )) (Syntax: 's1 + s2 + s3 + s4') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key s3 As System.Int32>, Key s4 As System.Int32>) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + s2 + s3 + s4') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + s2 + s3 + s4') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + s2 + s3 + s4') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 's5 = s1 + s2 + s3 + s4') + Initializers(5): + IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.$VB$It As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.$VB$It As , Key s3 As System.Int32> (OperationKind.PropertyReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.$VB$It As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.$VB$It As , Key s3 As System.Int32> (OperationKind.PropertyReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.s3 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.$VB$It As , Key s3 As System.Int32> (OperationKind.PropertyReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.s4 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + s2') + Left: IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.$VB$It As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.$VB$It As , Key s3 As System.Int32> (OperationKind.PropertyReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Right: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.$VB$It As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.$VB$It As , Key s3 As System.Int32> (OperationKind.PropertyReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Right: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>.s3 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.$VB$It As , Key s3 As System.Int32> (OperationKind.PropertyReferenceExpression, Type: , Key s3 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + Right: IPropertyReferenceExpression: ReadOnly Property , Key s3 As System.Int32>, Key s4 As System.Int32>.s4 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1 + s2 + s3 + s4') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key s3 As System.Int32>, Key s4 As System.Int32>) (Syntax: 's1 + s2 + s3 + s4') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Let2() Dim compilationDef = @@ -5647,6 +7164,222 @@ End Module ]]>) End Sub + + + Public Sub Join_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... 1 Equals s2') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Join(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of System.Int32, System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Join s2 In ... 1 Equals s2') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... er() {1, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {1, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's2 In New I ... er() {2, 3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's2 In New I ... er() {2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {2, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{2, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s2 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Join s2 In ... 1 Equals s2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32, )) (Syntax: 'Join s2 In ... 1 Equals s2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, s2 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Join s2 In ... 1 Equals s2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Join s2 In ... 1 Equals s2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Join s2 In ... 1 Equals s2') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Join s2 In ... 1 Equals s2') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Join s2 In ... 1 Equals s2') + IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Join s2 In ... 1 Equals s2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub JoinMultiple_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... uals s2 * 2') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Join(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of , System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of , System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Join s3 In ... uals s2 * 2') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Join(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of System.Int32, System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Join s2 In ... 1 Equals s2') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's2 In New I ... er() {2, 3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's2 In New I ... er() {2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {2, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{2, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's1 + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1 + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + Right: 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s2 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Join s2 In ... 1 Equals s2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32, )) (Syntax: 'Join s2 In ... 1 Equals s2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, s2 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Join s2 In ... 1 Equals s2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Join s2 In ... 1 Equals s2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Join s2 In ... 1 Equals s2') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Join s2 In ... 1 Equals s2') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's3 In New I ... er() {4, 5}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's3 In New I ... er() {4, 5}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {4, 5}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {4, 5}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{4, 5}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 's3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's3') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Multiply, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's2 * 2') + Left: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's3') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's3') + Right: 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's2 * 2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's2 * 2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s3 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2 * 2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2 * 2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2 * 2') + ReturnedValue: IParameterReferenceExpression: s3 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2 * 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Join s3 In ... uals s2 * 2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32, )) (Syntax: 'Join s3 In ... uals s2 * 2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It1 As , s3 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Join s3 In ... uals s2 * 2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Join s3 In ... uals s2 * 2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Join s3 In ... uals s2 * 2') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Join s3 In ... uals s2 * 2') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Join s3 In ... uals s2 * 2') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Join s3 In ... uals s2 * 2') + IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Join s3 In ... uals s2 * 2') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Join s3 In ... uals s2 * 2') + IParameterReferenceExpression: s3 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Join s3 In ... uals s2 * 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Join2() Dim compilationDef = @@ -6529,11 +8262,10 @@ Select System.Func`2[VB$AnonymousType_11`2[VB$AnonymousType_7`2[VB$AnonymousType ]]>) End Sub + Public Sub Join4() - Dim compilationDef = - - + Dim source = - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q0 As Object = From s1 In q Join t1 In q On s1 Equals t1'BIND:"From s1 In q Join t1 In q On s1 Equals t1" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = ) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'Join t1 In ... 1 Equals t1') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'Join t1 In ... 1 Equals t1') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'Join t1 In ... 1 Equals t1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: , IsInvalid) (Syntax: 'Join t1 In ... 1 Equals t1') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'Join t1 In ... 1 Equals t1') + IParameterReferenceExpression: t1 (OperationKind.ParameterReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'Join t1 In ... 1 Equals t1') +]]>.Value + + Dim expectedDiagnostics = ) +]]>.Value + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -6710,6 +8464,450 @@ End Module ]]>) End Sub + + + Public Sub GroupBy_GroupAggregation_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... Into Group') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupBy(Of System.Int32, )(keySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group By s1 Into Group') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... 3, 4, 2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Initializer: IArrayInitializer (6 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 2, 3, 4, 2, 3}') + Element Values(6): + 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') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group By s1 Into Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group By s1 Into Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group By s1 Into Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group By s1 Into Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group By s1 Into Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By s1 Into Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group By s1 Into Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group By s1 Into Group') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub GroupBy_FunctionAggregation_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... nto Count()') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupBy(Of System.Int32, )(keySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group By s1 Into Count()') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... 3, 4, 2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Initializer: IArrayInitializer (6 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 2, 3, 4, 2, 3}') + Element Values(6): + 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') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group By s1 Into Count()') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group By s1 Into Count()') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group By s1 Into Count()') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group By s1 Into Count()') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group By s1 Into Count()') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By s1 Into Count()') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group By s1 Into Count()') + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Count() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Count()') + Instance Receiver: IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group By s1 Into Count()') + Arguments(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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub GroupBy_WithOptionalGroupClause_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... Into Group') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupBy(Of System.Int32, System.Int32, )(keySelector As System.Func(Of System.Int32, System.Int32), elementSelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group s1 By ... Into Group') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... 3, 4, 2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Initializer: IArrayInitializer (6 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 2, 3, 4, 2, 3}') + Element Values(6): + 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') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(3): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: elementSelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group s1 By ... Into Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group s1 By ... Into Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group s1 By ... Into Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group s1 By ... Into Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group s1 By ... Into Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group s1 By ... Into Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group s1 By ... Into Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group s1 By ... Into Group') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub GroupBy_MultipleAggregations_IOperation() + Dim source = .Value + + Dim expectedOperationTree = ), Key c As System.Int32, Key Max As System.Int32>)) (Syntax: 'From s1 In ... (), Max(s1)') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupBy(Of , , ), Key c As System.Int32, Key Max As System.Int32>)(keySelector As System.Func(Of System.Int32, ), elementSelector As System.Func(Of System.Int32, ), resultSelector As System.Func(Of , System.Collections.Generic.IEnumerable(Of ), ), Key c As System.Int32, Key Max As System.Int32>)) As System.Collections.Generic.IEnumerable(Of ), Key c As System.Int32, Key Max As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of ), Key c As System.Int32, Key Max As System.Int32>)) (Syntax: 'Group s1, s ... (), Max(s1)') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... 3, 4, 2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 6) (Syntax: 'New Integer ... 3, 4, 2, 3}') + Initializer: IArrayInitializer (6 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 2, 3, 4, 2, 3}') + Element Values(6): + 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') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(3): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 's1 Mod 2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, )) (Syntax: 's1 Mod 2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 Mod 2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 Mod 2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 Mod 2') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group s1, s ... (), Max(s1)') + Initializers(2): + IBinaryOperatorExpression (BinaryOperatorKind.Remainder, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 Mod 2') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 Mod 2') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + IBinaryOperatorExpression (BinaryOperatorKind.Remainder, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 Mod 3') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 Mod 2') + Right: ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: elementSelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, )) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group s1, s ... (), Max(s1)') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + IConversionExpression (Explicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.String) (Syntax: 'CStr(s1)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group s1, s ... (), Max(s1)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Collections.Generic.IEnumerable(Of ), ), Key c As System.Int32, Key Max As System.Int32>)) (Syntax: 'Group s1, s ... (), Max(s1)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of )) As ), Key c As System.Int32, Key Max As System.Int32>) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group s1, s ... (), Max(s1)') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group s1, s ... (), Max(s1)') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group s1, s ... (), Max(s1)') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ), Key c As System.Int32, Key Max As System.Int32>) (Syntax: 'Group s1, s ... (), Max(s1)') + Initializers(5): + IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Group s1, s ... (), Max(s1)') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Group s1, s ... (), Max(s1)') + IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Group s1, s ... (), Max(s1)') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Group s1, s ... (), Max(s1)') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group s1, s ... (), Max(s1)') + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Count() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Count()') + Instance Receiver: IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group s1, s ... (), Max(s1)') + Arguments(0) + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Max(selector As System.Func(Of , System.Int32)) As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Max(s1)') + Instance Receiver: IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group s1, s ... (), Max(s1)') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's1') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub GroupBy_WithJoin_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... y Equals s1') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Join(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of , System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of , System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Join s1 In ... y Equals s1') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupBy(Of System.Int32, )(keySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group By ke ... Into Group') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Select(Of System.Int32)(selector As System.Func(Of System.Int32, System.Int32)) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Select s1 + 1') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... er() {1, 2}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1, 2}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {1, 2}') + Initializer: 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') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 's1 + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1 + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + Right: 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) + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: '1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: '1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$ItAnonymous As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '1') + IReturnStatement (OperationKind.ReturnStatement) (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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group By ke ... Into Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group By ke ... Into Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (key As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group By ke ... Into Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group By ke ... Into Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group By ke ... Into Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group By ke ... Into Group') + Initializers(2): + IParameterReferenceExpression: key (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group By ke ... Into Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group By ke ... Into Group') + InConversion: CommonConversion (Exists: True, 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(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's1 In New I ... er() {1, 2}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... er() {1, 2}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1, 2}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {1, 2}') + Initializer: 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') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 'key') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 'key') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'key') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'key') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'key') + ReturnedValue: IPropertyReferenceExpression: ReadOnly Property .key As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'key') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'key') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Join s1 In ... y Equals s1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32, )) (Syntax: 'Join s1 In ... y Equals s1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It1 As , s1 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Join s1 In ... y Equals s1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Join s1 In ... y Equals s1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Join s1 In ... y Equals s1') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Join s1 In ... y Equals s1') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .key As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Join s1 In ... y Equals s1') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Join s1 In ... y Equals s1') + IPropertyReferenceExpression: ReadOnly Property .Group As System.Collections.Generic.IEnumerable(Of System.Int32) (OperationKind.PropertyReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Join s1 In ... y Equals s1') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Join s1 In ... y Equals s1') + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Join s1 In ... y Equals s1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub GroupBy2() Dim compilationDef = @@ -6875,11 +9073,10 @@ BC36600: Range variable 's1' is already declared. ) End Sub + Public Sub GroupBy3() - Dim compilationDef = - - + Dim source = - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q0 As Object = From s1 In q Group By s1 Into Group'BIND:"From s1 In q Group By s1 Into Group" + + Dim q1 As Object = From s1 In q Group s2 = s1 By s1 Into Group + End Sub +End Module]]>.Value + + Dim expectedOperationTree = ) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'Group By s1 Into Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'Group By s1 Into Group') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'Group By s1 Into Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: , IsInvalid) (Syntax: 'Group By s1 Into Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'Group By s1 Into Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: ?, IsInvalid) (Syntax: 'Group By s1 Into Group') +]]>.Value + + Dim expectedDiagnostics = ) +]]>.Value + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -7172,70 +9386,495 @@ Module Module1 Next Next - System.Console.WriteLine("------") - For Each v In From x In New Integer() {1, 2} Group Join y In New Integer() {0, 3, 4} On x + 1 Equals y Into Count(y + x), Group + System.Console.WriteLine("------") + For Each v In From x In New Integer() {1, 2} Group Join y In New Integer() {0, 3, 4} On x + 1 Equals y Into Count(y + x), Group + System.Console.WriteLine(v) + For Each gv In v.Group + System.Console.WriteLine(" {0}", gv) + Next + Next + + End Sub +End Module + + + + CompileAndVerify(compilationDef, additionalRefs:={LinqAssemblyRef}, + expectedOutput:= + ) + End Sub + + + + Public Sub GroupJoin_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... Into Group') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupJoin(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of System.Int32, System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group Join ... Into Group') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New I ... er() {1, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {1, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 3) (Syntax: '3') + Arguments(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's2 In New I ... er() {2, 3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's2 In New I ... er() {2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {2, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{2, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s2 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group Join ... Into Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group Join ... Into Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group Join ... Into Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group Join ... Into Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group Join ... Into Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group Join ... Into Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group Join ... Into Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group Join ... Into Group') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub GroupJoin_Nested_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'From s1 In ... gr2 = Group') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).GroupJoin(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of , System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of , System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group Join ... gr2 = Group') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupJoin(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of System.Int32, System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group Join ... gr1 = Group') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's2 In New I ... er() {2, 3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's2 In New I ... er() {2, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {2, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {2, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{2, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's1 + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1 + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1 + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1 + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1 + 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1 + 1') + Right: 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s2 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group Join ... gr1 = Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group Join ... gr1 = Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group Join ... gr1 = Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group Join ... gr1 = Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group Join ... gr1 = Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group Join ... gr1 = Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group Join ... gr1 = Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group Join ... gr1 = Group') + InConversion: CommonConversion (Exists: True, 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(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's3 In New I ... er() {4, 5}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's3 In New I ... er() {4, 5}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {4, 5}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {4, 5}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{4, 5}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 4) (Syntax: '4') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 's3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's3') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Multiply, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '(s1 + 1) * 2') + Left: IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Int32) (Syntax: '(s1 + 1)') + Operand: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 's1 + 1') + Left: IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's3') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's3') + Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Right: 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: '(s1 + 1) * 2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: '(s1 + 1) * 2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s3 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: '(s1 + 1) * 2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: '(s1 + 1) * 2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: '(s1 + 1) * 2') + ReturnedValue: IParameterReferenceExpression: s3 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: '(s1 + 1) * 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group Join ... gr2 = Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Collections.Generic.IEnumerable(Of System.Int32), )) (Syntax: 'Group Join ... gr2 = Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of System.Int32)) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group Join ... gr2 = Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group Join ... gr2 = Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group Join ... gr2 = Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Group Join ... gr2 = Group') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .s1 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Group Join ... gr2 = Group') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Group Join ... gr2 = Group') + IPropertyReferenceExpression: ReadOnly Property .gr1 As System.Collections.Generic.IEnumerable(Of System.Int32) (OperationKind.PropertyReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group Join ... gr2 = Group') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Group Join ... gr2 = Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Group Join ... gr2 = Group') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub GroupJoin_NestedJoin_IOperation() + Dim source = - - - CompileAndVerify(compilationDef, additionalRefs:={LinqAssemblyRef}, - expectedOutput:= - ) +End Module]]>.Value + + Dim expectedOperationTree = )>)) (Syntax: 'From s1 In ... s3 = Group') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of )>).Select(Of )>)(selector As System.Func(Of )>, )>)) As System.Collections.Generic.IEnumerable(Of )>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )>)) (Syntax: 'From s1 In ... s3 = Group') + Instance Receiver: ITranslatedQueryExpression (OperationKind.TranslatedQueryExpression, Type: System.Collections.Generic.IEnumerable(Of )>)) (Syntax: 'From s1 In ... s3 = Group') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).GroupJoin(Of , System.Int32, )>)(inner As System.Collections.Generic.IEnumerable(Of ), outerKeySelector As System.Func(Of System.Int32, System.Int32), innerKeySelector As System.Func(Of , System.Int32), resultSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of ), )>)) As System.Collections.Generic.IEnumerable(Of )>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )>)) (Syntax: 'Group Join ... s3 = Group') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's1 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 'Join ... 2 Equals s4') + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Join(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of , System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of , System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Join ... 2 Equals s4') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Join(Of System.Int32, System.Int32, )(inner As System.Collections.Generic.IEnumerable(Of System.Int32), outerKeySelector As System.Func(Of System.Int32, System.Int32), innerKeySelector As System.Func(Of System.Int32, System.Int32), resultSelector As System.Func(Of System.Int32, System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Join ... 2 Equals s3') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's2 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's3 In New Integer() {1}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's3 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s2 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s3 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's3') + ReturnedValue: IParameterReferenceExpression: s3 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's3') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Join ... 2 Equals s3') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32, )) (Syntax: 'Join ... 2 Equals s3') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s2 As System.Int32, s3 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Join ... 2 Equals s3') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Join ... 2 Equals s3') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Join ... 2 Equals s3') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Join ... 2 Equals s3') + Initializers(2): + IParameterReferenceExpression: s2 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's2') + IParameterReferenceExpression: s3 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's3') + InConversion: CommonConversion (Exists: True, 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(4): + IArgument (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument) (Syntax: 's4 In New Integer() {1}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 's4 In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's4') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's4') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s4 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's4') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's4') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's4') + ReturnedValue: IParameterReferenceExpression: s4 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's4') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Join ... 2 Equals s4') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32, )) (Syntax: 'Join ... 2 Equals s4') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It1 As , s4 As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Join ... 2 Equals s4') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Join ... 2 Equals s4') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Join ... 2 Equals s4') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Join ... 2 Equals s4') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Join ... 2 Equals s4') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Join ... 2 Equals s4') + IPropertyReferenceExpression: ReadOnly Property .s3 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Join ... 2 Equals s4') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Join ... 2 Equals s4') + IParameterReferenceExpression: s4 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Join ... 2 Equals s4') + InConversion: CommonConversion (Exists: True, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: outerKeySelector) (OperationKind.Argument) (Syntax: 's1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 's1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: innerKeySelector) (OperationKind.Argument) (Syntax: 's2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 's2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's2') + ReturnedValue: IPropertyReferenceExpression: ReadOnly Property .s2 As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 's2') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 's2') + InConversion: CommonConversion (Exists: True, 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Group Join ... s3 = Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of ), )>)) (Syntax: 'Group Join ... s3 = Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As System.Collections.Generic.IEnumerable(Of )) As )>) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Group Join ... s3 = Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Group Join ... s3 = Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Group Join ... s3 = Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: )>) (Syntax: 'Group Join ... s3 = Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Group Join ... s3 = Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Group Join ... s3 = Group') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'From s1 In ... s3 = Group') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of )>, )>)) (Syntax: 'From s1 In ... s3 = Group') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s1 As )>) As )>) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'From s1 In ... s3 = Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'From s1 In ... s3 = Group') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'From s1 In ... s3 = Group') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: )>) (Syntax: 's1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -8089,11 +10728,10 @@ BC36631: 'Join' expected. ) End Sub + Public Sub GroupJoin5() - Dim compilationDef = - - + Dim source = - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q0 As Object = From s1 In q Group Join t1 In q On s1 Equals t1 Into Group'BIND:"From s1 In q Group Join t1 In q On s1 Equals t1 Into Group" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = ), IsInvalid) (Syntax: 'From s1 In ... Into Group') + Expression: IInvalidExpression (OperationKind.InvalidExpression, Type: QueryAble(Of ), IsInvalid) (Syntax: 'Group Join ... Into Group') + Children(5): + IOperation: (OperationKind.None, IsInvalid) (Syntax: 'Group Join ... Into Group') + Children(1): + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble(Of System.Int32)) (Syntax: 'q') + ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble(Of System.Int32)) (Syntax: 'q') + IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's1') + ReturnedValue: IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's1') + IAnonymousFunctionExpression (Symbol: Function (t1 As System.Int32) As ?) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 't1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 't1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 't1') + ReturnedValue: IParameterReferenceExpression: t1 (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 't1') + IAnonymousFunctionExpression (Symbol: Function (s1 As System.Int32, $VB$ItAnonymous As ?) As ) (OperationKind.AnonymousFunctionExpression, Type: null, IsInvalid) (Syntax: 'Group Join ... Into Group') + IBlockStatement (1 statements) (OperationKind.BlockStatement, IsInvalid) (Syntax: 'Group Join ... Into Group') + IReturnStatement (OperationKind.ReturnStatement, IsInvalid) (Syntax: 'Group Join ... Into Group') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: , IsInvalid) (Syntax: 'Group Join ... Into Group') + Initializers(2): + IParameterReferenceExpression: s1 (OperationKind.ParameterReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'Group Join ... Into Group') + IParameterReferenceExpression: $VB$ItAnonymous (OperationKind.ParameterReferenceExpression, Type: ?, IsInvalid) (Syntax: 'Group Join ... Into Group') +]]>.Value + + Dim expectedDiagnostics = ) +]]>.Value + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -8256,6 +10918,559 @@ End Module ]]>) End Sub + + + Public Sub AggregateClause_IOperation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub AggregateClause_MultipleAggregations_IOperation() + Dim source = .Value + + Dim expectedOperationTree = ) (Syntax: 'Aggregate y ... Sum(y \ 2)') + Expression: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Aggregate y ... Sum(y \ 2)') + Initializers(2): + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Count() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Count()') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Aggregate y ... Sum(y \ 2)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IPlaceholderExpression (OperationKind.None) (Syntax: 'Aggregate y ... Sum(y \ 2)') + Arguments(0) + IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Sum(selector As System.Func(Of System.Int32, System.Int32)) As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Sum(y \ 2)') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Aggregate y ... Sum(y \ 2)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IPlaceholderExpression (OperationKind.None) (Syntax: 'Aggregate y ... Sum(y \ 2)') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'y \ 2') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 'y \ 2') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (y As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'y \ 2') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'y \ 2') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'y \ 2') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.IntegerDivide, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'y \ 2') + Left: IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'y \ 2') + Right: 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub AggregateClause_WithWhereFilter_IOperation() + Dim source = y Into Sum(x + y))'BIND:"Aggregate x In New Integer() {3, 4}, y In New Integer() {1, 3} Where x > y Into Sum(x + y)" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = ).Sum(selector As System.Func(Of , System.Int32)) As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'Sum(x + y)') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Where(predicate As System.Func(Of , System.Boolean)) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Where x > y') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).SelectMany(Of System.Int32, )(collectionSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32)), resultSelector As System.Func(Of System.Int32, System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'y In New In ... er() {1, 3}') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'x In New In ... er() {3, 4}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {3, 4}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {3, 4}') + Initializer: 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') + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: collectionSelector) (OperationKind.Argument) (Syntax: 'New Integer() {1, 3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32))) (Syntax: 'New Integer() {1, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'New Integer() {1, 3}') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'New Integer() {1, 3}') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'New Integer() {1, 3}') + ReturnedValue: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'y In New In ... er() {1, 3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1, 3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {1, 3}') + Initializer: IArrayInitializer (2 elements) (OperationKind.ArrayInitializer) (Syntax: '{1, 3}') + Element Values(2): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Aggregate x ... Sum(x + y)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32, )) (Syntax: 'Aggregate x ... Sum(x + y)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32, y As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Aggregate x ... Sum(x + y)') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Aggregate x ... Sum(x + y)') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Aggregate x ... Sum(x + y)') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'y In New In ... er() {1, 3}') + Initializers(2): + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Aggregate x ... Sum(x + y)') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Aggregate x ... Sum(x + 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: predicate) (OperationKind.Argument) (Syntax: 'x > y') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Boolean)) (Syntax: 'x > y') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x > y') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x > y') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x > y') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'x > y') + Left: IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x > y') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x > y') + Right: IPropertyReferenceExpression: ReadOnly Property .y As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x > y') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x > 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x + y') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32)) (Syntax: 'x + y') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + y') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + y') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + y') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y') + Left: IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + y') + Right: IPropertyReferenceExpression: ReadOnly Property .y As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub AggregateClause_MultipleRangeVariableDeclarations_IOperation() + Dim source = .Value + + Dim expectedOperationTree = )) (Syntax: 'Aggregate x ... Where(True)') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Where(predicate As System.Func(Of , System.Boolean)) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Where(True)') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).SelectMany(Of System.Int32, )(collectionSelector As System.Func(Of , System.Collections.Generic.IEnumerable(Of System.Int32)), resultSelector As System.Func(Of , System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'z In New Integer() {3}') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).SelectMany(Of System.Int32, )(collectionSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32)), resultSelector As System.Func(Of System.Int32, System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'y In New Integer() {2}') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'x In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: collectionSelector) (OperationKind.Argument) (Syntax: 'New Integer() {2}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32))) (Syntax: 'New Integer() {2}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'New Integer() {2}') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'New Integer() {2}') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'New Integer() {2}') + ReturnedValue: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'y In New Integer() {2}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {2}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {2}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{2}') + Element Values(1): + 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Aggregate x ... Where(True)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32, )) (Syntax: 'Aggregate x ... Where(True)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32, y As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Aggregate x ... Where(True)') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Aggregate x ... Where(True)') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Aggregate x ... Where(True)') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'y In New Integer() {2}') + Initializers(2): + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, 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) + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: collectionSelector) (OperationKind.Argument) (Syntax: 'New Integer() {3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Collections.Generic.IEnumerable(Of System.Int32))) (Syntax: 'New Integer() {3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'New Integer() {3}') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'New Integer() {3}') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'New Integer() {3}') + ReturnedValue: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'z In New Integer() {3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {3}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{3}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Aggregate x ... Where(True)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32, )) (Syntax: 'Aggregate x ... Where(True)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It1 As , z As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Aggregate x ... Where(True)') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Aggregate x ... Where(True)') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Aggregate x ... Where(True)') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'z In New Integer() {3}') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Aggregate x ... Where(True)') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Aggregate x ... Where(True)') + IPropertyReferenceExpression: ReadOnly Property .y As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'Aggregate x ... Where(True)') + Instance Receiver: IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'Aggregate x ... Where(True)') + IParameterReferenceExpression: z (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'Aggregate x ... Where(True)') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: predicate) (OperationKind.Argument) (Syntax: 'True') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Boolean)) (Syntax: 'True') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'True') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'True') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'True') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'True') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub AggregateClause_WithDifferentClauses_IOperation() + Dim source = .Value + + Dim expectedOperationTree = ))) (Syntax: 'From x In N ... Where(True)') + Expression: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Select(Of System.Collections.Generic.IEnumerable(Of ))(selector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of ))) As System.Collections.Generic.IEnumerable(Of System.Collections.Generic.IEnumerable(Of ))) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of System.Collections.Generic.IEnumerable(Of ))) (Syntax: 'Aggregate x ... Where(True)') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).Select(Of System.Int32)(selector As System.Func(Of System.Int32, System.Int32)) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'Select x + 1') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'x In New In ... er() {3, 4}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {3, 4}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: 'New Integer() {3, 4}') + Initializer: 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') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x + 1') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32)) (Syntax: 'x + 1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + 1') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + 1') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + 1') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + 1') + Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x + 1') + Right: 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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'New Integer() {1}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of ))) (Syntax: 'New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$ItAnonymous As System.Int32) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'New Integer() {1}') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'New Integer() {1}') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'New Integer() {1}') + ReturnedValue: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Where(predicate As System.Func(Of , System.Boolean)) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Where(True)') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).Select(Of )(selector As System.Func(Of , )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'w = x + y + z') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).Select(Of )(selector As System.Func(Of , Key z As System.Int32>, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'Select x, y, z') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).Take(count As System.Int32) As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Take 100') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).Skip(count As System.Int32) As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Skip 0') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).SkipWhile(predicate As System.Func(Of , Key z As System.Int32>, System.Boolean)) As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Skip While False') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).TakeWhile(predicate As System.Func(Of , Key z As System.Int32>, System.Boolean)) As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Take While True') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).Distinct() As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Distinct') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Order By x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).OrderBy(Of System.Int32)(keySelector As System.Func(Of , Key z As System.Int32>, System.Int32)) As System.Linq.IOrderedEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Linq.IOrderedEnumerable(Of , Key z As System.Int32>)) (Syntax: 'x') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>).Where(predicate As System.Func(Of , Key z As System.Int32>, System.Boolean)) As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'Where True') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of ).SelectMany(Of System.Int32, , Key z As System.Int32>)(collectionSelector As System.Func(Of , System.Collections.Generic.IEnumerable(Of System.Int32)), resultSelector As System.Func(Of , System.Int32, , Key z As System.Int32>)) As System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of , Key z As System.Int32>)) (Syntax: 'z In New Integer() {3}') + Instance Receiver: IInvocationExpression ( Function System.Collections.Generic.IEnumerable(Of System.Int32).SelectMany(Of System.Int32, )(collectionSelector As System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32)), resultSelector As System.Func(Of System.Int32, System.Int32, )) As System.Collections.Generic.IEnumerable(Of )) (OperationKind.InvocationExpression, Type: System.Collections.Generic.IEnumerable(Of )) (Syntax: 'y In New Integer() {2}') + Instance Receiver: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'x In New Integer() {1}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {1}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {1}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{1}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1') + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: collectionSelector) (OperationKind.Argument) (Syntax: 'New Integer() {2}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Collections.Generic.IEnumerable(Of System.Int32))) (Syntax: 'New Integer() {2}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'New Integer() {2}') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'New Integer() {2}') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'New Integer() {2}') + ReturnedValue: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'y In New Integer() {2}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {2}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {2}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{2}') + Element Values(1): + 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.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Aggregate x ... Where(True)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Int32, )) (Syntax: 'Aggregate x ... Where(True)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (x As System.Int32, y As System.Int32) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Aggregate x ... Where(True)') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Aggregate x ... Where(True)') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Aggregate x ... Where(True)') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'y In New Integer() {2}') + Initializers(2): + IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x') + IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, 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) + Arguments(2): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: collectionSelector) (OperationKind.Argument) (Syntax: 'New Integer() {3}') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Collections.Generic.IEnumerable(Of System.Int32))) (Syntax: 'New Integer() {3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Collections.Generic.IEnumerable(Of System.Int32)) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'New Integer() {3}') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'New Integer() {3}') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'New Integer() {3}') + ReturnedValue: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.Generic.IEnumerable(Of System.Int32)) (Syntax: 'z In New Integer() {3}') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer() {3}') + Dimension Sizes(1): + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'New Integer() {3}') + Initializer: IArrayInitializer (1 elements) (OperationKind.ArrayInitializer) (Syntax: '{3}') + Element Values(1): + ILiteralExpression (OperationKind.LiteralExpression, 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) + IArgument (ArgumentKind.DefaultValue, Matching Parameter: resultSelector) (OperationKind.Argument) (Syntax: 'Aggregate x ... Where(True)') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Int32, , Key z As System.Int32>)) (Syntax: 'Aggregate x ... Where(True)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It1 As , z As System.Int32) As , Key z As System.Int32>) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'Aggregate x ... Where(True)') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'Aggregate x ... Where(True)') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'Aggregate x ... Where(True)') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: , Key z As System.Int32>) (Syntax: 'z In New Integer() {3}') + Initializers(2): + IParameterReferenceExpression: $VB$It1 (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'z In New Integer() {3}') + IParameterReferenceExpression: z (OperationKind.ParameterReferenceExpression, Type: System.Int32) (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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: predicate) (OperationKind.Argument) (Syntax: 'True') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key z As System.Int32>, System.Boolean)) (Syntax: 'True') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key z As System.Int32>) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'True') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'True') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'True') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'True') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: keySelector) (OperationKind.Argument) (Syntax: 'x') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key z As System.Int32>, System.Int32)) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key z As System.Int32>) As System.Int32) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x') + ReturnedValue: IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key z As System.Int32>.$VB$It1 As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 'x') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key z As System.Int32>) (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) + Arguments(0) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: predicate) (OperationKind.Argument) (Syntax: 'True') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key z As System.Int32>, System.Boolean)) (Syntax: 'True') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key z As System.Int32>) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'True') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'True') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'True') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'True') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: predicate) (OperationKind.Argument) (Syntax: 'False') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key z As System.Int32>, System.Boolean)) (Syntax: 'False') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key z As System.Int32>) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'False') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'False') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'False') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: False) (Syntax: 'False') + InConversion: CommonConversion (Exists: True, 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): + IArgument (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument) (Syntax: '0') + 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) + Arguments(1): + IArgument (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument) (Syntax: '100') + ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 100) (Syntax: '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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , Key z As System.Int32>, )) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As , Key z As System.Int32>) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'Select x, y, z') + Initializers(3): + IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key z As System.Int32>.$VB$It1 As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 'x') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key z As System.Int32>) (Syntax: 'x') + IPropertyReferenceExpression: ReadOnly Property .y As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x') + Instance Receiver: IPropertyReferenceExpression: ReadOnly Property , Key z As System.Int32>.$VB$It1 As (OperationKind.PropertyReferenceExpression, Type: ) (Syntax: 'x') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key z As System.Int32>) (Syntax: 'x') + IPropertyReferenceExpression: ReadOnly Property , Key z As System.Int32>.z As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: , Key z As System.Int32>) (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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: selector) (OperationKind.Argument) (Syntax: 'x + y + z') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , )) (Syntax: 'x + y + z') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As ) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'x + y + z') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'x + y + z') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'x + y + z') + ReturnedValue: IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: ) (Syntax: 'w = x + y + z') + Initializers(4): + IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y + z') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + y + z') + IPropertyReferenceExpression: ReadOnly Property .y As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y + z') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + y + z') + IPropertyReferenceExpression: ReadOnly Property .z As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y + z') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + y + z') + IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y + z') + Left: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y') + Left: IPropertyReferenceExpression: ReadOnly Property .x As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y + z') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + y + z') + Right: IPropertyReferenceExpression: ReadOnly Property .y As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y + z') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: 'x + y + z') + Right: IPropertyReferenceExpression: ReadOnly Property .z As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'x + y + z') + Instance Receiver: IParameterReferenceExpression: $VB$It (OperationKind.ParameterReferenceExpression, Type: ) (Syntax: '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) + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: predicate) (OperationKind.Argument) (Syntax: 'True') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of , System.Boolean)) (Syntax: 'True') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function ($VB$It As ) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 'True') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'True') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'True') + ReturnedValue: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Boolean, Constant: True) (Syntax: 'True') + InConversion: CommonConversion (Exists: True, 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + Public Sub Aggregate2() Dim compilationDef = @@ -8515,11 +11730,10 @@ BC36617: Aggregate function name cannot be used with a type character. ) End Sub + Public Sub Aggregate2b() - Dim compilationDef = - - + Dim source = - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, - additionalRefs:={SystemCoreRef}) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q10m = Aggregate i In colm Into aggr10(10)'BIND:"Aggregate i In colm Into aggr10(10)" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = ) +]]>.Value + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + Public Sub Aggregate2c() - Dim compilationDef = - - + Dim source = - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, - additionalRefs:={SystemCoreRef}) - - CompilationUtils.AssertTheseDiagnostics(compilation, - + Dim q10m = Aggregate i In colm Into aggr10(10)'BIND:"Aggregate i In colm Into aggr10(10)" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = ) +]]>.Value + + VerifyOperationTreeAndDiagnosticsForTest(Of QueryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub @@ -10865,6 +14092,131 @@ BC30451: 'Whi' is not declared. It may be inaccessible due to its protection lev ) End Sub + + + Public Sub IOperationForQueryClause() + Dim source = 0'BIND:"Where s > 0" + + End Sub +End Module]]>.Value + + Dim expectedOperationTree = 0') + Instance Receiver: ILocalReferenceExpression: q (OperationKind.LocalReferenceExpression, Type: QueryAble) (Syntax: 'q') + Arguments(1): + IArgument (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument) (Syntax: 's > 0') + IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int32, System.Boolean)) (Syntax: 's > 0') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: IAnonymousFunctionExpression (Symbol: Function (s As System.Int32) As System.Boolean) (OperationKind.AnonymousFunctionExpression, Type: null) (Syntax: 's > 0') + IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 's > 0') + IReturnStatement (OperationKind.ReturnStatement) (Syntax: 's > 0') + ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's > 0') + Left: IParameterReferenceExpression: s (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 's > 0') + Right: 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) +]]>.Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of WhereClauseSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub IOperationForCollectionRangeVariable() + Dim source = 0 Where 10 > s'BIND:"s In q" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of CollectionRangeVariableSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub IOperationForRangeVariableReference() + Dim source = 0'BIND:"s" + End Sub +End Module]]>.Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of IdentifierNameSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace diff --git a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs index da244dab50e1c7705a1f5bdbce048fffffe595aa..83c8ec5b08de72a3ee7d47ba18047b1de9cff356 100644 --- a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs @@ -1432,6 +1432,14 @@ public override void VisitPatternCaseClause(IPatternCaseClause operation) Visit(operation.GuardExpression, "Guard Expression"); } + public override void VisitTranslatedQueryExpression(ITranslatedQueryExpression operation) + { + LogString(nameof(ITranslatedQueryExpression)); + LogCommonPropertiesAndNewLine(operation); + + Visit(operation.Expression, "Expression"); + } + #endregion } } diff --git a/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs b/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs index 95df7514ca61d49e847bd4beed52d366aeb0c433..4bfccdfc57393c4cb76fedf209091861ddc6140b 100644 --- a/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs +++ b/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs @@ -638,5 +638,10 @@ public override void VisitPatternCaseClause(IPatternCaseClause operation) base.VisitPatternCaseClause(operation); } + + public override void VisitTranslatedQueryExpression(ITranslatedQueryExpression operation) + { + base.VisitTranslatedQueryExpression(operation); + } } }