diff --git a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs index 73de0c01030a5..9f8eba65e9c6c 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs @@ -187,16 +187,7 @@ private BoundExpression CheckValue(BoundExpression expr, BindValueKind valueKind var indexerAccess = (BoundIndexerAccess)expr; if (valueKind == BindValueKind.Assignable && !indexerAccess.Indexer.ReturnsByRef) { - expr = indexerAccess.Update(indexerAccess.ReceiverOpt, - indexerAccess.Indexer, - indexerAccess.Arguments, - indexerAccess.ArgumentNamesOpt, - indexerAccess.ArgumentRefKindsOpt, - indexerAccess.Expanded, - indexerAccess.ArgsToParamsOpt, - indexerAccess.BinderOpt, - useSetterForDefaultArgumentGeneration: true, - type: indexerAccess.Type); + expr = indexerAccess.Update(useSetterForDefaultArgumentGeneration: true); } } break; diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index 673b7a4ea6a9b..f2040d1e09b46 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -6535,7 +6535,8 @@ private BoundExpression BindPointerElementAccess(ExpressionSyntax node, BoundExp { Error(diagnostics, ErrorCode.ERR_PtrIndexSingle, node); } - return new BoundPointerElementAccess(node, expr, BadExpression(node, BuildArgumentsForErrorRecovery(analyzedArguments)), CheckOverflowAtRuntime, pointedAtType, hasErrors: true); + return new BoundPointerElementAccess(node, expr, BadExpression(node, BuildArgumentsForErrorRecovery(analyzedArguments)).MakeCompilerGenerated(), + CheckOverflowAtRuntime, pointedAtType, hasErrors: true); } if (pointedAtType.SpecialType == SpecialType.System_Void) @@ -7192,11 +7193,6 @@ private BoundExpression GetReceiverForConditionalBinding(ExpressionSyntax bindin receiver = BindConditionalAccessReceiver(conditionalAccessNode, diagnostics); } - if (receiver.HasAnyErrors) - { - return receiver; - } - // create surrogate receiver var receiverType = receiver.Type; if (receiverType?.IsNullableType() == true) @@ -7204,7 +7200,7 @@ private BoundExpression GetReceiverForConditionalBinding(ExpressionSyntax bindin receiverType = receiverType.GetNullableUnderlyingType(); } - receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType) { WasCompilerGenerated = true }; + receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType ?? CreateErrorType(), hasErrors: receiver.HasErrors) { WasCompilerGenerated = true }; return receiver; } diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs index 3e883b653798c..8c578107273c8 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs @@ -2605,7 +2605,7 @@ private bool IsOperandErrors(CSharpSyntaxNode node, ref BoundExpression operand, if (!operand.HasAnyErrors) { Error(diagnostics, ErrorCode.ERR_LambdaInIsAs, node); - operand = BadExpression(node, operand); + operand = BadExpression(node, operand).MakeCompilerGenerated(); } return true; diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs index 1550a8d290887..325fe8f8954c8 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs @@ -198,7 +198,7 @@ private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, Diagn TypeSymbol elementType = binder.GetIteratorElementType(node, diagnostics); BoundExpression argument = (node.Expression == null) - ? BadExpression(node) + ? BadExpression(node).MakeCompilerGenerated() : binder.BindValue(node.Expression, diagnostics, BindValueKind.RValue); argument = ValidateEscape(argument, ExternalScope, isByRef: false, diagnostics: diagnostics); diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs index 865c195b0898c..da9092875fd1f 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs @@ -2113,12 +2113,6 @@ private static CSDiagnosticInfo GetFeatureAvailabilityDiagnosticInfo(SyntaxTree return null; } - string requiredFeature = feature.RequiredFeature(); - if (requiredFeature != null) - { - return new CSDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature); - } - LanguageVersion availableVersion = options.LanguageVersion; LanguageVersion requiredVersion = feature.RequiredVersion(); if (requiredVersion > availableVersion) diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs b/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs index 0101123611edc..dc8934f5e1543 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs @@ -167,6 +167,34 @@ public override Symbol ExpressionSymbol // DevDiv 1087283 tracks deciding whether or not to refactor this into BoundNodes.xml. public ImmutableArray OriginalIndexersOpt { get; private set; } + public BoundIndexerAccess Update(bool useSetterForDefaultArgumentGeneration) + { + if (useSetterForDefaultArgumentGeneration != this.UseSetterForDefaultArgumentGeneration) + { + var result = new BoundIndexerAccess( + this.Syntax, + this.ReceiverOpt, + this.Indexer, + this.Arguments, + this.ArgumentNamesOpt, + this.ArgumentRefKindsOpt, + this.Expanded, + this.ArgsToParamsOpt, + this.BinderOpt, + useSetterForDefaultArgumentGeneration, + this.Type, + this.HasErrors) + { + WasCompilerGenerated = this.WasCompilerGenerated, + OriginalIndexersOpt = this.OriginalIndexersOpt + }; + + return result; + } + + return this; + } + public override LookupResultKind ResultKind { get diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs b/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs index 94cdaccc2c71a..1b9995089a937 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundNodeExtensions.cs @@ -59,5 +59,11 @@ public static bool IsConstructorInitializer(this BoundCall call) receiverOpt != null && (receiverOpt.Kind == BoundKind.ThisReference || receiverOpt.Kind == BoundKind.BaseReference); } + + public static T MakeCompilerGenerated(this T node) where T : BoundNode + { + node.WasCompilerGenerated = true; + return node; + } } } diff --git a/src/Compilers/CSharp/Portable/CSharpParseOptions.cs b/src/Compilers/CSharp/Portable/CSharpParseOptions.cs index 66ad37bc0006e..b20b5ee767be6 100644 --- a/src/Compilers/CSharp/Portable/CSharpParseOptions.cs +++ b/src/Compilers/CSharp/Portable/CSharpParseOptions.cs @@ -202,11 +202,6 @@ internal override void ValidateOptions(ArrayBuilder builder) internal bool IsFeatureEnabled(MessageID feature) { - string featureFlag = feature.RequiredFeature(); - if (featureFlag != null) - { - return Features.ContainsKey(featureFlag); - } LanguageVersion availableVersion = LanguageVersion; LanguageVersion requiredVersion = feature.RequiredVersion(); return availableVersion >= requiredVersion; diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index 016d6a04a0535..2cdbe9ae4f78a 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs +++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs @@ -4516,15 +4516,6 @@ internal static string ERR_ExternHasConstructorInitializer { } } - /// - /// Looks up a localized string similar to Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable.. - /// - internal static string ERR_FeatureIsExperimental { - get { - return ResourceManager.GetString("ERR_FeatureIsExperimental", resourceCulture); - } - } - /// /// Looks up a localized string similar to Feature '{0}' is not implemented in this compiler.. /// diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index cb8c970250a71..d2f029fdcc80b 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -4401,9 +4401,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Feature '{0}' is not available in C# 7.0. Please use language version {1} or greater. - - Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable. - Feature '{0}' is not implemented in this compiler. diff --git a/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs b/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs index 24a1bb6495f95..281c9821afef6 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs @@ -139,7 +139,7 @@ private bool IsDebugPlus() private bool EnablePEVerifyCompat() { - return _module.Compilation.FeaturePEVerifyCompatEnabled; + return _module.Compilation.LanguageVersion < LanguageVersion.CSharp7_2 || _module.Compilation.FeaturePEVerifyCompatEnabled; } private LocalDefinition LazyReturnTemp diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs index f8005387d987e..ae3699e0e44e3 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/EmitAddress.cs @@ -24,8 +24,14 @@ private enum AddressKind // reference itself will not be written to, nor it will be used to modify fields. ReadOnly, + + // same as ReadOnly, but we are not supposed to get a reference to a clone + // regardless of compat settings. + ReadOnlyStrict, } + private static bool IsReadOnly(AddressKind addressKind) => addressKind >= AddressKind.ReadOnly; + /// /// Emits address as in & /// @@ -70,7 +76,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr case BoundKind.ThisReference: Debug.Assert(expression.Type.IsValueType, "only value types may need a ref to this"); - Debug.Assert(HasHome(expression, addressKind == AddressKind.Writeable)); + Debug.Assert(HasHome(expression, addressKind)); _builder.EmitOpCode(ILOpCode.Ldarg_0); break; @@ -101,7 +107,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr var methodRefKind = call.Method.RefKind; if (methodRefKind == RefKind.Ref || - (addressKind == AddressKind.ReadOnly && methodRefKind == RefKind.RefReadOnly)) + (IsReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly)) { EmitCallExpression(call, UseKind.UsedAsAddress); break; @@ -121,7 +127,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr case BoundKind.ConditionalOperator: var conditional = (BoundConditionalOperator)expression; - if (!HasHome(conditional, addressKind != AddressKind.ReadOnly)) + if (!HasHome(conditional, addressKind)) { goto default; } @@ -144,7 +150,7 @@ private LocalDefinition EmitAddress(BoundExpression expression, AddressKind addr return null; default: - Debug.Assert(!HasHome(expression, addressKind != AddressKind.ReadOnly)); + Debug.Assert(!HasHome(expression, addressKind)); return EmitAddressOfTempClone(expression); } @@ -218,7 +224,7 @@ private LocalDefinition EmitLocalAddress(BoundLocal localAccess, AddressKind add { var local = localAccess.LocalSymbol; - if (!HasHome(localAccess, needWriteable: addressKind != AddressKind.ReadOnly)) + if (!HasHome(localAccess, addressKind)) { return EmitAddressOfTempClone(localAccess); } @@ -249,7 +255,7 @@ private LocalDefinition EmitLocalAddress(BoundLocal localAccess, AddressKind add /// private LocalDefinition EmitDupAddress(BoundDup dup, AddressKind addressKind) { - if (!HasHome(dup, needWriteable: addressKind != AddressKind.ReadOnly)) + if (!HasHome(dup, addressKind)) { return EmitAddressOfTempClone(dup); } @@ -339,7 +345,7 @@ private LocalSymbol DigForValueLocal(BoundSequence topSequence, BoundExpression /// Checks if expression directly or indirectly represents a value with its own home. In /// such cases it is possible to get a reference without loading into a temporary. /// - private bool HasHome(BoundExpression expression, bool needWriteable) + private bool HasHome(BoundExpression expression, AddressKind addressKind) { switch (expression.Kind) { @@ -352,10 +358,11 @@ private bool HasHome(BoundExpression expression, bool needWriteable) case BoundKind.ThisReference: Debug.Assert(expression.Type.IsValueType); - if (needWriteable && expression.Type.IsReadOnly) + if (!IsReadOnly(addressKind) && expression.Type.IsReadOnly) { return _method.MethodKind == MethodKind.Constructor; } + return true; case BoundKind.ThrowExpression: @@ -363,7 +370,7 @@ private bool HasHome(BoundExpression expression, bool needWriteable) return true; case BoundKind.Parameter: - return !needWriteable || + return IsReadOnly(addressKind) || ((BoundParameter)expression).ParameterSymbol.RefKind != RefKind.In; case BoundKind.Local: @@ -371,31 +378,31 @@ private bool HasHome(BoundExpression expression, bool needWriteable) // locals in a mutating call var local = ((BoundLocal)expression).LocalSymbol; return !((IsStackLocal(local) && local.RefKind == RefKind.None) || - (needWriteable && local.RefKind == RefKind.RefReadOnly)); + (!IsReadOnly(addressKind) && local.RefKind == RefKind.RefReadOnly)); case BoundKind.Call: var methodRefKind = ((BoundCall)expression).Method.RefKind; return methodRefKind == RefKind.Ref || - (!needWriteable && methodRefKind == RefKind.RefReadOnly); + (IsReadOnly(addressKind) && methodRefKind == RefKind.RefReadOnly); case BoundKind.Dup: //NB: Dup represents locals that do not need IL slot var dupRefKind = ((BoundDup)expression).RefKind; return dupRefKind == RefKind.Ref || - (!needWriteable && dupRefKind == RefKind.RefReadOnly); + (IsReadOnly(addressKind) && dupRefKind == RefKind.RefReadOnly); case BoundKind.FieldAccess: - return HasHome((BoundFieldAccess)expression, needWriteable); + return HasHome((BoundFieldAccess)expression, addressKind); case BoundKind.Sequence: - return HasHome(((BoundSequence)expression).Value, needWriteable); + return HasHome(((BoundSequence)expression).Value, addressKind); case BoundKind.AssignmentOperator: return ((BoundAssignmentOperator)expression).RefKind != RefKind.None; case BoundKind.ComplexConditionalReceiver: - Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ValueTypeReceiver, needWriteable)); - Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ReferenceTypeReceiver, needWriteable)); + Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ValueTypeReceiver, addressKind)); + Debug.Assert(HasHome(((BoundComplexConditionalReceiver)expression).ReferenceTypeReceiver, addressKind)); goto case BoundKind.ConditionalReceiver; case BoundKind.ConditionalReceiver: @@ -415,7 +422,7 @@ private bool HasHome(BoundExpression expression, bool needWriteable) // branch that has no home will need a temporary // if both have no home, just say whole expression has no home // so we could just use one temp for the whole thing - return HasHome(ternary.Consequence, needWriteable) && HasHome(ternary.Alternative, needWriteable); + return HasHome(ternary.Consequence, addressKind) && HasHome(ternary.Alternative, addressKind); default: return false; @@ -427,7 +434,7 @@ private bool HasHome(BoundExpression expression, bool needWriteable) /// Fields have readable homes when they are not constants. /// Fields have writeable homes unless they are readonly and used outside of the constructor. /// - private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) + private bool HasHome(BoundFieldAccess fieldAccess, AddressKind addressKind) { FieldSymbol field = fieldAccess.FieldSymbol; @@ -437,7 +444,14 @@ private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) return false; } - if (!needWriteable && !EnablePEVerifyCompat()) + // in readonly situations where ref to a copy is not allowed, consider fields as addressable + if (addressKind == AddressKind.ReadOnlyStrict) + { + return true; + } + + // ReadOnly references can always be taken unless we are in peverify compat mode + if (addressKind == AddressKind.ReadOnly && !EnablePEVerifyCompat()) { return true; } @@ -456,7 +470,7 @@ private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) // we would not be able to dig for the inner field using references and the outer struct will have to be copied to a temp anyways. if (!EnablePEVerifyCompat()) { - Debug.Assert(needWriteable == true); + Debug.Assert(!IsReadOnly(addressKind)); var receiver = fieldAccess.ReceiverOpt; if (receiver?.Type.IsValueType == true) @@ -466,8 +480,8 @@ private bool HasHome(BoundFieldAccess fieldAccess, bool needWriteable) // has readable home -> return false - we need to copy the field // otherwise -> return true - the copy will be made at higher level so the leaf field can have writeable home - return HasHome(receiver, needWriteable: true) || - !HasHome(receiver, needWriteable: false); + return HasHome(receiver, addressKind) || + !HasHome(receiver, AddressKind.ReadOnly); } } @@ -534,7 +548,7 @@ private LocalDefinition EmitFieldAddress(BoundFieldAccess fieldAccess, AddressKi { FieldSymbol field = fieldAccess.FieldSymbol; - if (!HasHome(fieldAccess, addressKind != AddressKind.ReadOnly)) + if (!HasHome(fieldAccess, addressKind)) { // accessing a field that is not writable (const or readonly) return EmitAddressOfTempClone(fieldAccess); @@ -546,11 +560,7 @@ private LocalDefinition EmitFieldAddress(BoundFieldAccess fieldAccess, AddressKi } else { - //NOTE: we are not propagating AddressKind here. - // the reason is that while Constrained permits calls, it does not permit - // taking field addresses, so we have to turn Constrained into writeable. - // It is less error prone to just pass a bool "isReadonly" - return EmitInstanceFieldAddress(fieldAccess, isReadonly: addressKind == AddressKind.ReadOnly); + return EmitInstanceFieldAddress(fieldAccess, addressKind); } } @@ -564,7 +574,7 @@ private LocalDefinition EmitParameterAddress(BoundParameter parameter, AddressKi { ParameterSymbol parameterSymbol = parameter.ParameterSymbol; - if (!HasHome(parameter, needWriteable: addressKind != AddressKind.ReadOnly)) + if (!HasHome(parameter, addressKind)) { // accessing a parameter that is not writable return EmitAddressOfTempClone(parameter); @@ -634,11 +644,14 @@ private LocalDefinition EmitReceiverRef(BoundExpression receiver, AddressKind ad /// /// May introduce a temp which it will return. (otherwise returns null) /// - private LocalDefinition EmitInstanceFieldAddress(BoundFieldAccess fieldAccess, bool isReadonly) + private LocalDefinition EmitInstanceFieldAddress(BoundFieldAccess fieldAccess, AddressKind addressKind) { var field = fieldAccess.FieldSymbol; - var tempOpt = EmitReceiverRef(fieldAccess.ReceiverOpt, isReadonly? AddressKind.ReadOnly: AddressKind.Writeable); + //NOTE: we are not propagating AddressKind.Constrained here. + // the reason is that while Constrained permits calls, it does not permit + // taking field addresses, so we have to turn Constrained into writeable. + var tempOpt = EmitReceiverRef(fieldAccess.ReceiverOpt, addressKind == AddressKind.Constrained ? AddressKind.Writeable : addressKind); _builder.EmitOpCode(ILOpCode.Ldflda); EmitSymbolToken(field, fieldAccess.Syntax); diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs index 4b2d5e8081c0b..d8fb3dc7b6c08 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs @@ -426,10 +426,7 @@ private void EmitLoweredConditionalAccessExpression(BoundLoweredConditionalAcces { // this does not need to be writeable // we may call "HasValue" on this, but it is not mutating - // (however verification does not know that and considers all calls mutating) - var addressKind = EnablePEVerifyCompat()? - AddressKind.Writeable: - AddressKind.ReadOnly; + var addressKind = AddressKind.ReadOnly; receiverTemp = EmitReceiverRef(receiver, addressKind); _builder.EmitOpCode(ILOpCode.Dup); @@ -605,7 +602,9 @@ private void EmitArgument(BoundExpression argument, RefKind refKind) break; default: - var unexpectedTemp = EmitAddress(argument, AddressKind.Writeable); + // NOTE: passing "ReadOnlyStrict" here. + // we should not get an address of a copy if at all possible + var unexpectedTemp = EmitAddress(argument, refKind == RefKindExtensions.StrictIn? AddressKind.ReadOnlyStrict: AddressKind.Writeable); if (unexpectedTemp != null) { // interestingly enough "ref dynamic" sometimes is passed via a clone @@ -619,8 +618,11 @@ private void EmitArgument(BoundExpression argument, RefKind refKind) private void EmitAddressOfExpression(BoundAddressOfOperator expression, bool used) { - var temp = EmitAddress(expression.Operand, AddressKind.Writeable); + // NOTE: passing "ReadOnlyStrict" here. + // we should not get an address of a copy if at all possible + var temp = EmitAddress(expression.Operand, AddressKind.ReadOnlyStrict); Debug.Assert(temp == null, "If the operand is addressable, then a temp shouldn't be required."); + if (used) { // When computing an address to be used to initialize a fixed-statement variable, we have to be careful @@ -811,15 +813,32 @@ private void EmitSideEffects(BoundSequence sequence) } } - private void EmitArguments(ImmutableArray arguments, ImmutableArray parameters) + private void EmitArguments(ImmutableArray arguments, ImmutableArray parameters, ImmutableArray refKindsOpt) { // We might have an extra argument for the __arglist() of a varargs method. Debug.Assert(arguments.Length == parameters.Length || arguments.Length == parameters.Length + 1, "argument count must match parameter count"); for (int i = 0; i < arguments.Length; i++) { - BoundExpression argument = arguments[i]; - RefKind refKind = (i == parameters.Length) ? RefKind.None : parameters[i].RefKind; - EmitArgument(argument, refKind); + RefKind refKind; + + if (!refKindsOpt.IsDefault && i < refKindsOpt.Length) + { + // if we have an explicit refKind for the given argument, use that + refKind = refKindsOpt[i]; + } + else if (i < parameters.Length) + { + // otherwise check the parameter + refKind = parameters[i].RefKind; + } + else + { + // vararg case + Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); + refKind = RefKind.None; + } + + EmitArgument(arguments[i], refKind); } } @@ -1068,7 +1087,7 @@ private bool FieldLoadPrefersRef(BoundExpression receiver) } // can we take address at all? - if (!HasHome(receiver, needWriteable: false)) + if (!HasHome(receiver, AddressKind.ReadOnly)) { return false; } @@ -1491,13 +1510,8 @@ private void EmitCallExpression(BoundCall call, UseKind useKind) if (method.IsMetadataVirtual()) { // NB: all methods that a struct could inherit from bases are non-mutating - // we are passing here "Writeable" just to keep verifier happy - // we can pass here "ReadOnly" and avoid unnecessary copy - var addressKind = EnablePEVerifyCompat() ? - AddressKind.Writeable : - AddressKind.ReadOnly; - - tempOpt = EmitReceiverRef(receiver, addressKind); + // treat receiver as ReadOnly + tempOpt = EmitReceiverRef(receiver, AddressKind.ReadOnly); callKind = CallKind.ConstrainedCallVirt; } else @@ -1569,7 +1583,7 @@ private void EmitCallExpression(BoundCall call, UseKind useKind) } } - EmitArguments(arguments, method.Parameters); + EmitArguments(arguments, method.Parameters, call.ArgumentRefKindsOpt); int stackBehavior = GetCallStackBehavior(call); switch (callKind) { @@ -1861,7 +1875,7 @@ private void EmitObjectCreationExpression(BoundObjectCreationExpression expressi } else { - EmitArguments(expression.Arguments, constructor.Parameters); + EmitArguments(expression.Arguments, constructor.Parameters, expression.ArgumentRefKindsOpt); var stackAdjustment = GetObjCreationStackBehavior(expression); _builder.EmitOpCode(ILOpCode.Newobj, stackAdjustment); @@ -2033,7 +2047,7 @@ private bool TryEmitAssignmentInPlace(BoundAssignmentOperator assignmentOperator private bool SafeToGetWriteableReference(BoundExpression left) { - if (!HasHome(left, needWriteable: true)) + if (!HasHome(left, AddressKind.Writeable)) { return false; } @@ -2079,7 +2093,7 @@ private void InPlaceCtorCall(BoundExpression target, BoundObjectCreationExpressi Debug.Assert(temp == null, "in-place ctor target should not create temps"); var constructor = objCreation.Constructor; - EmitArguments(objCreation.Arguments, constructor.Parameters); + EmitArguments(objCreation.Arguments, constructor.Parameters, objCreation.ArgumentRefKindsOpt); // -2 to adjust for consumed target address and not produced value. var stackAdjustment = GetObjCreationStackBehavior(objCreation) - 2; _builder.EmitOpCode(ILOpCode.Call, stackAdjustment); @@ -2335,10 +2349,11 @@ private void EmitAssignmentValue(BoundAssignmentOperator assignmentOperator) else { int exprTempsBefore = _expressionTemps?.Count ?? 0; + var local = ((BoundLocal)assignmentOperator.Left).LocalSymbol; - // NOTE: passing "ReadOnly" here. Assuming we do not have compile errors, - // We should not get an address of a copy, even if the RHS is readonly - LocalDefinition temp = EmitAddress(assignmentOperator.Right, AddressKind.ReadOnly); + // NOTE: passing "ReadOnlyStrict" here. + // we should not get an address of a copy if at all possible + LocalDefinition temp = EmitAddress(assignmentOperator.Right, local.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); // Generally taking a ref for the purpose of ref assignment should not be done on homeless values // however, there are very rare cases when we need to get a ref off a temp in synthetic code. @@ -2346,7 +2361,7 @@ private void EmitAssignmentValue(BoundAssignmentOperator assignmentOperator) AddExpressionTemp(temp); // are we, by the way, ref-assigning to something that lives longer than encompassing expression? - if (((BoundLocal)assignmentOperator.Left).LocalSymbol.SynthesizedKind.IsLongLived()) + if (local.SynthesizedKind.IsLongLived()) { var exprTempsAfter = _expressionTemps?.Count ?? 0; diff --git a/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs b/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs index 8deaf3a611613..14d524131c082 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs @@ -724,7 +724,10 @@ private void EmitReturnStatement(BoundReturnStatement boundReturnStatement) } else { - this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly? AddressKind.ReadOnly: AddressKind.Writeable); + // NOTE: passing "ReadOnlyStrict" here. + // we should never return an address of a copy + var unexpectedTemp = this.EmitAddress(expressionOpt, this._method.RefKind == RefKind.RefReadOnly ? AddressKind.ReadOnlyStrict : AddressKind.Writeable); + Debug.Assert(unexpectedTemp == null, "ref-returning a temp?"); } if (ShouldUseIndirectReturn()) diff --git a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs index e6b49b576b52e..612e107c3e445 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs @@ -2152,7 +2152,7 @@ internal override SyntaxNode GetDeclaratorSyntax() throw new NotImplementedException(); } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs index 8bfa13f270fd2..ab3feffe8183e 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs @@ -3081,12 +3081,6 @@ internal bool EnableEnumArrayBlockInitialization } } - internal override bool IsIOperationFeatureEnabled() - { - var options = (CSharpParseOptions)this.SyntaxTrees.FirstOrDefault()?.Options; - return options?.IsFeatureEnabled(MessageID.IDS_FeatureIOperation) ?? false; - } - private class SymbolSearcher { private readonly Dictionary _cache; diff --git a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs index 08bd5a05b442e..afe1ac351b39f 100644 --- a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs @@ -163,9 +163,6 @@ internal override Binder GetEnclosingBinderInternal(int position) internal override IOperation GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken) { - // in case this is right side of a qualified name or member access (or part of a cref) - node = SyntaxFactory.GetStandaloneNode(node); - var model = this.GetMemberModel(node); if (model != null) { diff --git a/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs b/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs index ae9b9486e2eab..51c6baf4dee2b 100644 --- a/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs +++ b/src/Compilers/CSharp/Portable/Declarations/MergedTypeDeclaration.cs @@ -211,7 +211,7 @@ protected override ImmutableArray GetDeclarationChildren() return StaticCast.From(this.Children); } - public IEnumerable MemberNames + public ICollection MemberNames { get { diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index ee8f4619ebdbf..ce21872a38569 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -1294,7 +1294,7 @@ internal enum ErrorCode ERR_EncodinglessSyntaxTree = 8055, // ERR_AccessorListAndExpressionBody = 8056, Deprecated in favor of ERR_BlockBodyAndExpressionBody ERR_BlockBodyAndExpressionBody = 8057, - ERR_FeatureIsExperimental = 8058, + //ERR_FeatureIsExperimental = 8058, No experimental feature ERR_FeatureNotAvailableInVersion6 = 8059, // available 8062-8069 ERR_SwitchFallOut = 8070, diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs index 7764903e8d2e1..935a0f2d0495b 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs @@ -126,7 +126,7 @@ internal enum MessageID IDS_FeatureTuples = MessageBase + 12711, IDS_FeatureOutVar = MessageBase + 12713, - IDS_FeatureIOperation = MessageBase + 12714, + // IDS_FeatureIOperation = MessageBase + 12714, IDS_FeatureExpressionBodiedAccessor = MessageBase + 12715, IDS_FeatureExpressionBodiedDeOrConstructor = MessageBase + 12716, IDS_ThrowExpression = MessageBase + 12717, @@ -178,23 +178,6 @@ public static LocalizableErrorArgument Localize(this MessageID id) return new LocalizableErrorArgument(id); } - // Returns the string to be used in the /features flag switch to enable the MessageID feature. - // Always call this before RequiredVersion: - // If this method returns null, call RequiredVersion and use that. - // If this method returns non-null, use that. - // Features should be mutually exclusive between RequiredFeature and RequiredVersion. - // (hence the above rule - RequiredVersion throws when RequiredFeature returns non-null) - internal static string RequiredFeature(this MessageID feature) - { - switch (feature) - { - case MessageID.IDS_FeatureIOperation: - return "IOperation"; - default: - return null; - } - } - internal static LanguageVersion RequiredVersion(this MessageID feature) { // Based on CSourceParser::GetFeatureUsage from SourceParser.cpp. diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs index 1b8acb8535ab2..99f1676844f01 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs @@ -718,7 +718,6 @@ private void BuildStoresToTemps( if (IsSafeForReordering(argument, argRefKind)) { arguments[p] = argument; - refKinds[p] = argRefKind; } else { @@ -727,6 +726,7 @@ private void BuildStoresToTemps( storesToTemps.Add(assignment); arguments[p] = temp; } + refKinds[p] = argRefKind; } } diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs index ffbe7952cfe6c..7c58d45739225 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_FixedStatement.cs @@ -254,8 +254,10 @@ private BoundStatement InitializeFixedStatementRegularLocal( pinnedTemp = factory.SynthesizedLocal( initializerType, syntax: declarator, - isPinned: true, - refKind: RefKind.Ref, // different from the array and string cases + isPinned: true, + //NOTE: different from the array and string cases + // RefReadOnly to allow referring to readonly variables. (technically we only "read" through the temp anyways) + refKind: RefKind.RefReadOnly, kind: SynthesizedLocalKind.FixedReference); // NOTE: we pin the reference, not the pointer. diff --git a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs index 896e5f0138342..43326ce97bc4c 100644 --- a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs +++ b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs @@ -1269,7 +1269,7 @@ public BoundLocal StoreToTemp( #endif ) { - if (refKind == RefKind.Out || refKind == RefKind.In) + if (refKind == RefKind.Out) { refKind = RefKind.Ref; } diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs b/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs index 85531c51017da..4d2a9c5a5c09b 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpArgument.cs @@ -7,8 +7,8 @@ namespace Microsoft.CodeAnalysis.CSharp { internal abstract class BaseCSharpArgument : BaseArgument { - public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) { } @@ -19,8 +19,8 @@ public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, internal sealed class CSharpArgument : BaseCSharpArgument { - public CSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + public CSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) { ValueImpl = value; } @@ -32,11 +32,11 @@ internal sealed class LazyCSharpArgument : BaseCSharpArgument { private readonly Lazy _lazyValue; - public LazyCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + public LazyCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) { _lazyValue = value ?? throw new ArgumentNullException(nameof(value)); - } + } protected override IOperation ValueImpl => _lazyValue.Value; } diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs index c090b2b6e3eb5..e85b4a6a50e82 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs @@ -10,7 +10,7 @@ internal class CSharpOperationCloner : OperationCloner public override IOperation VisitArgument(IArgumentOperation operation, object argument) { - return new CSharpArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new CSharpArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitConversion(IConversionOperation operation, object argument) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index 0bdf6d24247ea..c48273846b707 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -18,6 +18,9 @@ internal sealed partial class CSharpOperationFactory private readonly ConcurrentDictionary _cache = new ConcurrentDictionary(concurrencyLevel: 2, capacity: 10); + private readonly Lazy _lazyNullOperation = + new Lazy(() => null); + private readonly SemanticModel _semanticModel; public CSharpOperationFactory(SemanticModel semanticModel) @@ -479,7 +482,7 @@ private IAnonymousObjectCreationOperation CreateBoundAnonymousObjectCreationExpr private IPropertyReferenceOperation CreateBoundAnonymousPropertyDeclarationOperation(BoundAnonymousPropertyDeclaration boundAnonymousPropertyDeclaration) { PropertySymbol property = boundAnonymousPropertyDeclaration.Property; - Lazy instance = new Lazy(() => null); + Lazy instance = _lazyNullOperation; Lazy> arguments = new Lazy>(() => ImmutableArray.Empty); SyntaxNode syntax = boundAnonymousPropertyDeclaration.Syntax; ITypeSymbol type = boundAnonymousPropertyDeclaration.Type; @@ -770,7 +773,9 @@ private IOperation CreateBoundConversionOperation(BoundConversion boundConversio // Semantic model has a special case here that we match: if the underlying syntax is missing, don't create a conversion expression, // and instead directly return the operand, which will be a BoundBadExpression. When we generate a node for the BoundBadExpression, // the resulting IOperation will also have a null Type. - Debug.Assert(boundConversion.Operand.Kind == BoundKind.BadExpression); + Debug.Assert(boundConversion.Operand.Kind == BoundKind.BadExpression || + ((boundConversion.Operand as BoundLambda)?.Body.Statements.SingleOrDefault() as BoundReturnStatement)?. + ExpressionOpt?.Kind == BoundKind.BadExpression); return Create(boundConversion.Operand); } @@ -903,10 +908,9 @@ private IArrayInitializerOperation CreateBoundArrayInitializationOperation(Bound { Lazy> elementValues = new Lazy>(() => boundArrayInitialization.Initializers.SelectAsArray(n => Create(n))); SyntaxNode syntax = boundArrayInitialization.Syntax; - ITypeSymbol type = boundArrayInitialization.Type; Optional constantValue = ConvertToOptional(boundArrayInitialization.ConstantValue); bool isImplicit = boundArrayInitialization.WasCompilerGenerated; - return new LazyArrayInitializer(elementValues, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyArrayInitializer(elementValues, _semanticModel, syntax, constantValue, isImplicit); } private IDefaultValueOperation CreateBoundDefaultExpressionOperation(BoundDefaultExpression boundDefaultExpression) @@ -951,19 +955,20 @@ private ISimpleAssignmentOperation CreateBoundAssignmentOperatorOperation(BoundA Debug.Assert(!IsMemberInitializer(boundAssignmentOperator)); Lazy target = new Lazy(() => Create(boundAssignmentOperator.Left)); + bool isRef = boundAssignmentOperator.RefKind != RefKind.None; Lazy value = new Lazy(() => Create(boundAssignmentOperator.Right)); SyntaxNode syntax = boundAssignmentOperator.Syntax; ITypeSymbol type = boundAssignmentOperator.Type; Optional constantValue = ConvertToOptional(boundAssignmentOperator.ConstantValue); bool isImplicit = boundAssignmentOperator.WasCompilerGenerated; - return new LazySimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazySimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit); } private IMemberInitializerOperation CreateBoundMemberInitializerOperation(BoundAssignmentOperator boundAssignmentOperator) { Debug.Assert(IsMemberInitializer(boundAssignmentOperator)); - Lazy target = new Lazy(() => (IMemberReferenceOperation)Create(boundAssignmentOperator.Left)); + Lazy target = new Lazy(() => Create(boundAssignmentOperator.Left)); Lazy value = new Lazy(() => (IObjectOrCollectionInitializerOperation)Create(boundAssignmentOperator.Right)); SyntaxNode syntax = boundAssignmentOperator.Syntax; ITypeSymbol type = boundAssignmentOperator.Type; @@ -1060,11 +1065,12 @@ private IConditionalOperation CreateBoundConditionalOperatorOperation(BoundCondi Lazy condition = new Lazy(() => Create(boundConditionalOperator.Condition)); Lazy whenTrue = new Lazy(() => Create(boundConditionalOperator.Consequence)); Lazy whenFalse = new Lazy(() => Create(boundConditionalOperator.Alternative)); + bool isRef = boundConditionalOperator.IsByRef; SyntaxNode syntax = boundConditionalOperator.Syntax; ITypeSymbol type = boundConditionalOperator.Type; Optional constantValue = ConvertToOptional(boundConditionalOperator.ConstantValue); bool isImplicit = boundConditionalOperator.WasCompilerGenerated; - return new LazyConditionalOperation(condition, whenTrue, whenFalse, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyConditionalOperation(condition, whenTrue, whenFalse, isRef, _semanticModel, syntax, type, constantValue, isImplicit); } private ICoalesceOperation CreateBoundNullCoalescingOperatorOperation(BoundNullCoalescingOperator boundNullCoalescingOperator) @@ -1298,37 +1304,42 @@ private IConditionalOperation CreateBoundIfStatementOperation(BoundIfStatement b Lazy condition = new Lazy(() => Create(boundIfStatement.Condition)); Lazy ifTrueStatement = new Lazy(() => Create(boundIfStatement.Consequence)); Lazy ifFalseStatement = new Lazy(() => Create(boundIfStatement.AlternativeOpt)); + bool isRef = false; SyntaxNode syntax = boundIfStatement.Syntax; ITypeSymbol type = null; Optional constantValue = default(Optional); bool isImplicit = boundIfStatement.WasCompilerGenerated; - return new LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, isRef, _semanticModel, syntax, type, constantValue, isImplicit); } private IWhileLoopOperation CreateBoundWhileStatementOperation(BoundWhileStatement boundWhileStatement) { Lazy condition = new Lazy(() => Create(boundWhileStatement.Condition)); Lazy body = new Lazy(() => Create(boundWhileStatement.Body)); + Lazy ignoredCondition = _lazyNullOperation; ImmutableArray locals = boundWhileStatement.Locals.As(); + bool conditionIsTop = true; + bool conditionIsUntil = false; SyntaxNode syntax = boundWhileStatement.Syntax; ITypeSymbol type = null; Optional constantValue = default(Optional); bool isImplicit = boundWhileStatement.WasCompilerGenerated; - return new LazyWhileLoopStatement(condition, body, locals, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyWhileLoopStatement(condition, body, ignoredCondition, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit); } - private IDoLoopOperation CreateBoundDoStatementOperation(BoundDoStatement boundDoStatement) + private IWhileLoopOperation CreateBoundDoStatementOperation(BoundDoStatement boundDoStatement) { - DoLoopKind doLoopKind = DoLoopKind.DoWhileBottomLoop; Lazy condition = new Lazy(() => Create(boundDoStatement.Condition)); Lazy body = new Lazy(() => Create(boundDoStatement.Body)); - Lazy ignoredCondition = new Lazy(() => null); + Lazy ignoredCondition = _lazyNullOperation; + bool conditionIsTop = false; + bool conditionIsUntil = false; ImmutableArray locals = boundDoStatement.Locals.As(); SyntaxNode syntax = boundDoStatement.Syntax; ITypeSymbol type = null; Optional constantValue = default(Optional); bool isImplicit = boundDoStatement.WasCompilerGenerated; - return new LazyDoLoopStatement(doLoopKind, condition, body, ignoredCondition, locals, _semanticModel, syntax, type, constantValue, isImplicit); + return new LazyWhileLoopStatement(condition, body, ignoredCondition, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit); } private IForLoopOperation CreateBoundForStatementOperation(BoundForStatement boundForStatement) @@ -1356,13 +1367,13 @@ private IForEachLoopOperation CreateBoundForEachStatementOperation(BoundForEachS else if (locals.Length == 1) { var local = (LocalSymbol)locals.Single(); - bool isDeclaration = true; - // This node is implicit because there is no good syntax for it other than the entire 'foreach' statement. - loopControlVariable = new Lazy(() => new LocalReferenceExpression(local, isDeclaration, _semanticModel, local.GetDeclaratorSyntax(), local.Type, local.ConstantValue, isImplicit: true)); + // We use iteration variable type syntax as the underlying syntax node as there is no variable declarator syntax in the syntax tree. + var declaratorSyntax = boundForEachStatement.IterationVariableType.Syntax; + loopControlVariable = new Lazy(() => new VariableDeclarator(local, initializer: null, semanticModel: _semanticModel, syntax: declaratorSyntax, type: null, constantValue: default, isImplicit: false)); } else { - loopControlVariable = new Lazy(() => null); + loopControlVariable = _lazyNullOperation; } Lazy collection = new Lazy(() => Create(boundForEachStatement.Expression)); diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs index 9920cfe7a8089..1477855480d32 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs @@ -46,7 +46,6 @@ internal IArgumentOperation CreateArgumentOperation(ArgumentKind kind, IParamete value, semanticModel: _semanticModel, syntax: argument ?? value.Syntax, - type: value.Type, constantValue: default, isImplicit: expression.WasCompilerGenerated || argument == null); } @@ -202,7 +201,8 @@ private ImmutableArray GetAnonymousObjectCreationInitializers(BoundA SyntaxNode syntax = value.Syntax?.Parent ?? expression.Syntax; ITypeSymbol type = target.Type; Optional constantValue = value.ConstantValue; - var assignment = new SimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit: expression.WasCompilerGenerated); + bool isRef = false; + var assignment = new SimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit: expression.WasCompilerGenerated); builder.Add(assignment); } diff --git a/src/Compilers/CSharp/Portable/Parser/Lexer.cs b/src/Compilers/CSharp/Portable/Parser/Lexer.cs index 2d9192cf99eb7..963cab075d827 100644 --- a/src/Compilers/CSharp/Portable/Parser/Lexer.cs +++ b/src/Compilers/CSharp/Portable/Parser/Lexer.cs @@ -901,17 +901,6 @@ private void CheckFeatureAvailability(MessageID feature) return; } - string requiredFeature = feature.RequiredFeature(); - if (requiredFeature != null) - { - if (!options.IsFeatureEnabled(feature)) - { - this.AddError(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature); - } - - return; - } - LanguageVersion availableVersion = this.Options.LanguageVersion; var requiredVersion = feature.RequiredVersion(); if (availableVersion >= requiredVersion) return; diff --git a/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs b/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs index 2dc021bd3b172..e1b4d5233f7e0 100644 --- a/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs +++ b/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs @@ -1058,30 +1058,16 @@ protected TNode CheckFeatureAvailability(TNode node, MessageID feature, b } var featureName = feature.Localize(); - var requiredFeature = feature.RequiredFeature(); - if (requiredFeature != null) - { - if (forceWarning) - { - SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, featureName, requiredFeature); - return this.AddError(node, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code); - } + var requiredVersion = feature.RequiredVersion(); - return this.AddError(node, ErrorCode.ERR_FeatureIsExperimental, featureName, requiredFeature); - } - else + if (forceWarning) { - var requiredVersion = feature.RequiredVersion(); - - if (forceWarning) - { - SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(availableVersion.GetErrorCode(), featureName, - new CSharpRequiredLanguageVersion(requiredVersion)); - return this.AddError(node, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code); - } - - return this.AddError(node, availableVersion.GetErrorCode(), featureName, new CSharpRequiredLanguageVersion(requiredVersion)); + SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(availableVersion.GetErrorCode(), featureName, + new CSharpRequiredLanguageVersion(requiredVersion)); + return this.AddError(node, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code); } + + return this.AddError(node, availableVersion.GetErrorCode(), featureName, new CSharpRequiredLanguageVersion(requiredVersion)); } protected bool IsFeatureEnabled(MessageID feature) diff --git a/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs b/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs index cbc2074edeb40..863a9d62f8594 100644 --- a/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs +++ b/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.cs @@ -183,6 +183,12 @@ public override void VisitLocal(ILocalSymbol symbol) { AddKeyword(SyntaxKind.RefKeyword); AddSpace(); + + if (symbol.RefKind == RefKind.RefReadOnly) + { + AddKeyword(SyntaxKind.ReadOnlyKeyword); + AddSpace(); + } } if (format.LocalOptions.IncludesOption(SymbolDisplayLocalOptions.IncludeType)) diff --git a/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs index 0a3afe13fcea9..b85881a4c001c 100644 --- a/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/LocalSymbol.cs @@ -321,9 +321,9 @@ internal abstract bool IsCompilerGenerated internal abstract ImmutableArray GetConstantValueDiagnostics(BoundExpression boundInitValue); - public bool IsRef => RefKind == RefKind.Ref; + public bool IsRef => RefKind != RefKind.None; - internal abstract RefKind RefKind + public abstract RefKind RefKind { get; } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs index 77dac53792fde..979b4d2d37453 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs @@ -458,7 +458,7 @@ internal override ImmutableArray GetConstantValueDiagnostics(BoundEx return ImmutableArray.Empty; } - internal override RefKind RefKind + public override RefKind RefKind { get { return _refKind; } } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs index 36c7a4dadb144..bbd3f8d9d9fb2 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs @@ -1219,7 +1219,7 @@ public sealed override ImmutableArray GetMembers(string name) internal override ImmutableArray GetSimpleNonTypeMembers(string name) { - if (_lazyMembersDictionary != null || MemberNames.Contains(name)) + if (_lazyMembersDictionary != null || declaration.MemberNames.Contains(name)) { return GetMembers(name); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs index 3c5c5219ef074..1bb3cf05cd66b 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedLocal.cs @@ -74,7 +74,7 @@ internal override LocalSymbol WithSynthesizedLocalKindAndSyntax(SynthesizedLocal _refKind); } - internal override RefKind RefKind + public override RefKind RefKind { get { return _refKind; } } diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs index 1f79df6b1b1ae..551b51de5d5e6 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/TypeSubstitutedLocalSymbol.cs @@ -88,7 +88,7 @@ internal override bool IsPinned get { return _originalVariable.IsPinned; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return _originalVariable.RefKind; } } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs index 7b3a68a01d894..15cd74fd53b42 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs @@ -233,6 +233,64 @@ .locals init (int V_0) } + [Fact] + [CompilerTrait(CompilerFeature.PEVerifyCompat)] + public void InParamPassRoField1() + { + var text = @" +class Program +{ + public static readonly int F = 42; + + public static void Main() + { + System.Console.WriteLine(M(in F)); + } + + static ref readonly int M(in int x) + { + return ref x; + } +} +"; + + var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular, verify: false, expectedOutput: "42"); + + comp.VerifyIL("Program.Main()", @" +{ + // Code size 17 (0x11) + .maxstack 1 + IL_0000: ldsflda ""int Program.F"" + IL_0005: call ""ref readonly int Program.M(in int)"" + IL_000a: ldind.i4 + IL_000b: call ""void System.Console.WriteLine(int)"" + IL_0010: ret +}"); + + + comp.VerifyIL("Program.M(in int)", @" +{ + // Code size 2 (0x2) + .maxstack 1 + IL_0000: ldarg.0 + IL_0001: ret +}"); + + comp = CompileAndVerify(text, verify: false, expectedOutput: "42", parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature()); + + comp.VerifyIL("Program.Main()", @" +{ + // Code size 17 (0x11) + .maxstack 1 + IL_0000: ldsflda ""int Program.F"" + IL_0005: call ""ref readonly int Program.M(in int)"" + IL_000a: ldind.i4 + IL_000b: call ""void System.Console.WriteLine(int)"" + IL_0010: ret +}"); + + } + [Fact] public void InParamPassRoParamReturn() { @@ -798,6 +856,143 @@ public static void M1(in int arg1, in int arg2, in int arg3) ); } + [Fact] + public void ReadonlyParamAsyncSpillInRoField() + { + var text = @" + using System.Threading.Tasks; + + class Program + { + public static readonly int F = 5; + + static void Main(string[] args) + { + Test().Wait(); + } + + public static async Task Test() + { + int local = 1; + M1(in F, await GetT(2), 3); + } + + public static async Task GetT(T val) + { + await Task.Yield(); + MutateReadonlyField(); + return val; + } + + private static unsafe void MutateReadonlyField() + { + fixed(int* ptr = &F) + { + *ptr = 42; + } + } + + public static void M1(in int arg1, in int arg2, in int arg3) + { + System.Console.WriteLine(arg1 + arg2 + arg3); + } + } + +"; + + var comp = CreateCompilationWithMscorlib46(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseExe); + var result = CompileAndVerify(comp, verify: false, expectedOutput: @"47"); + + var expectedIL = @" +{ + // Code size 162 (0xa2) + .maxstack 3 + .locals init (int V_0, + int V_1, + System.Runtime.CompilerServices.TaskAwaiter V_2, + int V_3, + System.Exception V_4) + IL_0000: ldarg.0 + IL_0001: ldfld ""int Program.d__2.<>1__state"" + IL_0006: stloc.0 + .try + { + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_003f + IL_000a: ldc.i4.2 + IL_000b: call ""System.Threading.Tasks.Task Program.GetT(int)"" + IL_0010: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()"" + IL_0015: stloc.2 + IL_0016: ldloca.s V_2 + IL_0018: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get"" + IL_001d: brtrue.s IL_005b + IL_001f: ldarg.0 + IL_0020: ldc.i4.0 + IL_0021: dup + IL_0022: stloc.0 + IL_0023: stfld ""int Program.d__2.<>1__state"" + IL_0028: ldarg.0 + IL_0029: ldloc.2 + IL_002a: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1"" + IL_002f: ldarg.0 + IL_0030: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.d__2.<>t__builder"" + IL_0035: ldloca.s V_2 + IL_0037: ldarg.0 + IL_0038: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted, Program.d__2>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.d__2)"" + IL_003d: leave.s IL_00a1 + IL_003f: ldarg.0 + IL_0040: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1"" + IL_0045: stloc.2 + IL_0046: ldarg.0 + IL_0047: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1"" + IL_004c: initobj ""System.Runtime.CompilerServices.TaskAwaiter"" + IL_0052: ldarg.0 + IL_0053: ldc.i4.m1 + IL_0054: dup + IL_0055: stloc.0 + IL_0056: stfld ""int Program.d__2.<>1__state"" + IL_005b: ldloca.s V_2 + IL_005d: call ""int System.Runtime.CompilerServices.TaskAwaiter.GetResult()"" + IL_0062: stloc.1 + IL_0063: ldsflda ""int Program.F"" + IL_0068: ldloca.s V_1 + IL_006a: ldc.i4.3 + IL_006b: stloc.3 + IL_006c: ldloca.s V_3 + IL_006e: call ""void Program.M1(in int, in int, in int)"" + IL_0073: leave.s IL_008e + } + catch System.Exception + { + IL_0075: stloc.s V_4 + IL_0077: ldarg.0 + IL_0078: ldc.i4.s -2 + IL_007a: stfld ""int Program.d__2.<>1__state"" + IL_007f: ldarg.0 + IL_0080: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.d__2.<>t__builder"" + IL_0085: ldloc.s V_4 + IL_0087: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)"" + IL_008c: leave.s IL_00a1 + } + IL_008e: ldarg.0 + IL_008f: ldc.i4.s -2 + IL_0091: stfld ""int Program.d__2.<>1__state"" + IL_0096: ldarg.0 + IL_0097: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.d__2.<>t__builder"" + IL_009c: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()"" + IL_00a1: ret +} +"; + + result.VerifyIL("Program.d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", expectedIL); + + comp = CreateCompilationWithMscorlib46(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseExe, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature()); + result = CompileAndVerify(comp, verify: false, expectedOutput: @"47"); + + result.VerifyIL("Program.d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", expectedIL); + + } + [Fact] public void InParamAsyncSpill2() { diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs index eb182c51d140d..c00ebfae00b48 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs @@ -54,35 +54,30 @@ ref readonly S M() } }"; - var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature()); + // WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref assignments + var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: false); comp.VerifyIL("C.M", @" { - // Code size 65 (0x41) + // Code size 59 (0x3b) .maxstack 2 - .locals init (S V_0, - S V_1, - S2 V_2) + .locals init (S V_0) IL_0000: ldsflda ""S C.s1"" IL_0005: dup IL_0006: ldobj ""S"" IL_000b: stloc.0 IL_000c: ldloca.s V_0 IL_000e: call ""void S.AddOne()"" - IL_0013: ldsfld ""S C.s2"" - IL_0018: stloc.0 - IL_0019: ldloca.s V_0 - IL_001b: ldobj ""S"" - IL_0020: stloc.1 - IL_0021: ldloca.s V_1 - IL_0023: call ""void S.AddOne()"" - IL_0028: ldsflda ""S2 C.s3"" - IL_002d: call ""void S2.AddOne()"" - IL_0032: ldarg.0 - IL_0033: ldfld ""S2 C.s4"" - IL_0038: stloc.2 - IL_0039: ldloca.s V_2 - IL_003b: call ""void S2.AddOne()"" - IL_0040: ret + IL_0013: ldsflda ""S C.s2"" + IL_0018: ldobj ""S"" + IL_001d: stloc.0 + IL_001e: ldloca.s V_0 + IL_0020: call ""void S.AddOne()"" + IL_0025: ldsflda ""S2 C.s3"" + IL_002a: call ""void S2.AddOne()"" + IL_002f: ldarg.0 + IL_0030: ldflda ""S2 C.s4"" + IL_0035: call ""void S2.AddOne()"" + IL_003a: ret }"); comp = CompileAndVerify(source, verify: false); @@ -864,47 +859,36 @@ .locals init (bool V_0) //b IL_0033: ldflda ""int System.ValueTuple.Item1"" IL_0038: ret }"); - comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: false); + // WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref returns + comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: false); comp.VerifyIL("Program.Test", @" { - // Code size 70 (0x46) + // Code size 57 (0x39) .maxstack 1 - .locals init (bool V_0, //b - int V_1, - System.ValueTuple V_2, - int V_3, - System.ValueTuple V_4) + .locals init (bool V_0) //b IL_0000: ldc.i4.1 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: brfalse.s IL_0020 + IL_0003: brfalse.s IL_001a IL_0005: ldloc.0 - IL_0006: brfalse.s IL_0012 + IL_0006: brfalse.s IL_000f IL_0008: ldarg.0 - IL_0009: ldfld ""int Program.F"" - IL_000e: stloc.1 - IL_000f: ldloca.s V_1 - IL_0011: ret - IL_0012: ldsfld ""(int Alice, int Bob) Program.F1"" - IL_0017: stloc.2 - IL_0018: ldloca.s V_2 - IL_001a: ldflda ""int System.ValueTuple.Item1"" - IL_001f: ret - IL_0020: ldloc.0 - IL_0021: brfalse.s IL_0032 - IL_0023: ldarg.0 - IL_0024: ldfld ""Program.S Program.S1"" - IL_0029: ldfld ""int Program.S.F"" - IL_002e: stloc.3 - IL_002f: ldloca.s V_3 - IL_0031: ret - IL_0032: ldsfld ""Program.S Program.S2"" - IL_0037: ldfld ""(int Alice, int Bob) Program.S.F1"" - IL_003c: stloc.s V_4 - IL_003e: ldloca.s V_4 - IL_0040: ldflda ""int System.ValueTuple.Item1"" - IL_0045: ret + IL_0009: ldflda ""int Program.F"" + IL_000e: ret + IL_000f: ldsflda ""(int Alice, int Bob) Program.F1"" + IL_0014: ldflda ""int System.ValueTuple.Item1"" + IL_0019: ret + IL_001a: ldloc.0 + IL_001b: brfalse.s IL_0029 + IL_001d: ldarg.0 + IL_001e: ldflda ""Program.S Program.S1"" + IL_0023: ldflda ""int Program.S.F"" + IL_0028: ret + IL_0029: ldsflda ""Program.S Program.S2"" + IL_002e: ldflda ""(int Alice, int Bob) Program.S.F1"" + IL_0033: ldflda ""int System.ValueTuple.Item1"" + IL_0038: ret }"); } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs index 2ade9d50ba8d5..9d9fa9b872913 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs @@ -12025,7 +12025,7 @@ public MyManagedStruct(int x) n.n.num = x; } }"; - var comp = CompileAndVerify(source, expectedOutput: @"42", verify: false); + var comp = CompileAndVerify(source, expectedOutput: @"42", parseOptions: TestOptions.Regular7_2, verify: false); comp.VerifyIL("Program.Main", @" @@ -12088,6 +12088,38 @@ .locals init (MyManagedStruct V_0) IL_0046: call ""void System.Console.WriteLine(int)"" IL_004b: ret } +"); + + comp = CompileAndVerify(source, expectedOutput: @"42", verify: true, parseOptions: TestOptions.Regular7_1); + + comp.VerifyIL("Program.Main", +@" +{ + // Code size 76 (0x4c) + .maxstack 3 + .locals init (MyManagedStruct V_0) + IL_0000: newobj ""cls1..ctor()"" + IL_0005: dup + IL_0006: ldfld ""MyManagedStruct cls1.y"" + IL_000b: stloc.0 + IL_000c: ldloca.s V_0 + IL_000e: ldc.i4.s 123 + IL_0010: call ""void MyManagedStruct.mutate(int)"" + IL_0015: dup + IL_0016: ldfld ""MyManagedStruct cls1.y"" + IL_001b: stloc.0 + IL_001c: ldloca.s V_0 + IL_001e: ldflda ""MyManagedStruct.Nested MyManagedStruct.n"" + IL_0023: ldflda ""MyManagedStruct.Nested.Nested1 MyManagedStruct.Nested.n"" + IL_0028: ldc.i4 0x1c8 + IL_002d: call ""void MyManagedStruct.Nested.Nested1.mutate(int)"" + IL_0032: ldfld ""MyManagedStruct cls1.y"" + IL_0037: ldfld ""MyManagedStruct.Nested MyManagedStruct.n"" + IL_003c: ldfld ""MyManagedStruct.Nested.Nested1 MyManagedStruct.Nested.n"" + IL_0041: ldfld ""int MyManagedStruct.Nested.Nested1.num"" + IL_0046: call ""void System.Console.WriteLine(int)"" + IL_004b: ret +} "); } diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs index 14bbf39255734..fa12510e08ebd 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs @@ -893,7 +893,7 @@ public void TestReportingDiagnosticWithInvalidLocation() { var source1 = @"class C1 { void M() { int i = 0; i++; } }"; var source2 = @"class C2 { void M() { int i = 0; i++; } }"; - var compilation = CreateCompilationWithMscorlib45(source1, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateCompilationWithMscorlib45(source1); var anotherCompilation = CreateCompilationWithMscorlib45(source2); var treeInAnotherCompilation = anotherCompilation.SyntaxTrees.Single(); @@ -920,7 +920,7 @@ public void TestReportingDiagnosticWithInvalidLocation() public void TestReportingDiagnosticWithInvalidSpan() { var source1 = @"class C1 { void M() { int i = 0; i++; } }"; - var compilation = CreateCompilationWithMscorlib45(source1, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateCompilationWithMscorlib45(source1); var treeInAnotherCompilation = compilation.SyntaxTrees.Single(); var badSpan = new Text.TextSpan(100000, 10000); @@ -1990,7 +1990,7 @@ void MixMethod() } } "; - var tree = CSharpSyntaxTree.ParseText(source, TestOptions.RegularWithIOperationFeature, "Source.cs"); + var tree = CSharpSyntaxTree.ParseText(source, path: "Source.cs"); var compilation = CreateCompilationWithMscorlib45(new[] { tree }); compilation.VerifyDiagnostics(); diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs index ce7e1ff69fab2..0f181fdde8cde 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs @@ -39,7 +39,7 @@ void M1() int[,][] arr12 = new int[0,0][]; // no } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new EmptyArrayAnalyzer() }, null, null, false, Diagnostic(EmptyArrayAnalyzer.UseArrayEmptyDescriptor.Id, "new int[0]").WithLocation(6, 22), @@ -101,7 +101,7 @@ class D object OField = 33; object SField = ""Zap""; }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BoxingOperationAnalyzer() }, null, null, false, Diagnostic(BoxingOperationAnalyzer.BoxingDescriptor.Id, "3").WithLocation(9, 25), @@ -132,7 +132,7 @@ public void M1(int z) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BadStuffTestAnalyzer() }, null, null, false, Diagnostic(BadStuffTestAnalyzer.InvalidExpressionDescriptor.Id, "Framitz()").WithLocation(6, 9), Diagnostic(BadStuffTestAnalyzer.IsInvalidDescriptor.Id, "Framitz()").WithLocation(6, 9), @@ -180,7 +180,7 @@ public void M1(object o) } } "; - CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions.WithIOperationsFeature()) + CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BadStuffTestAnalyzer() }, null, null, false ); @@ -209,7 +209,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BigForTestAnalyzer() }, null, null, false, Diagnostic(BigForTestAnalyzer.BigForDescriptor.Id, "for (x = 0; x < 2000000; x++) {}").WithLocation(9, 9), @@ -273,7 +273,7 @@ public void M1(int x, int y) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_EmptySwitch, "{").WithLocation(40, 20), Diagnostic(ErrorCode.ERR_ConstantExpected, ":").WithLocation(44, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SwitchTestAnalyzer() }, null, null, false, @@ -339,7 +339,7 @@ public void M6() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new InvocationTestAnalyzer() }, null, null, false, Diagnostic(InvocationTestAnalyzer.BigParamArrayArgumentsDescriptor.Id, "M0(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)").WithLocation(19, 9), @@ -417,7 +417,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new FieldCouldBeReadOnlyAnalyzer() }, null, null, false, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(8, 9), @@ -490,7 +490,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new FieldCouldBeReadOnlyAnalyzer() }, null, null, false, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(8, 16), @@ -546,7 +546,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LocalCouldBeConstAnalyzer() }, null, null, false, Diagnostic(LocalCouldBeConstAnalyzer.LocalCouldBeConstDescriptor.Id, "e").WithLocation(13, 13), @@ -718,7 +718,7 @@ interface IDerived : IMiddle, IBase2 } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SymbolCouldHaveMoreSpecificTypeAnalyzer() }, null, null, false, Diagnostic(SymbolCouldHaveMoreSpecificTypeAnalyzer.LocalCouldHaveMoreSpecificTypeDescriptor.Id, "a").WithArguments("a", "Middle").WithLocation(6, 16), @@ -784,7 +784,7 @@ enum E D = 18 } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SeventeenTestAnalyzer() }, null, null, false, Diagnostic(SeventeenTestAnalyzer.SeventeenDescriptor.Id, "17").WithLocation(4, 40), @@ -825,7 +825,7 @@ public void M3() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NullArgumentTestAnalyzer() }, null, null, false, Diagnostic(NullArgumentTestAnalyzer.NullArgumentsDescriptor.Id, "null").WithLocation(16, 12), @@ -867,7 +867,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (25,30): error CS1010: Newline in constant // var e2 = new Goo() { " }; @@ -929,7 +929,7 @@ public void M2() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AssignmentTestAnalyzer() }, null, null, false, Diagnostic("DoNotUseMemberAssignment", "Property2 = new Bar { Field = true }").WithLocation(27, 30), @@ -978,7 +978,7 @@ void M1() int[][] arr14 = new int[][] { new int[] { 1,2,3 }, new[] { 1, 2, 3, 4, 5, 6 } }; // LargeList } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ArrayInitializerTestAnalyzer() }, null, null, false, Diagnostic(ArrayInitializerTestAnalyzer.DoNotUseLargeListOfArrayInitializersDescriptor.Id, "{ 1, 2, 3, 4, 5, 6 }").WithLocation(14, 32), @@ -1012,7 +1012,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( Diagnostic(ErrorCode.ERR_IdentifierExpected, ";").WithLocation(12, 25), Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(13, 29)) @@ -1077,7 +1077,7 @@ public void M1(int x, int y) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_EmptySwitch, "{").WithLocation(37, 20), Diagnostic(ErrorCode.ERR_ConstantExpected, ":").WithLocation(41, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CaseTestAnalyzer() }, null, null, false, @@ -1119,7 +1119,7 @@ public override void M1() M2(); } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ExplicitVsImplicitInstanceAnalyzer() }, null, null, false, Diagnostic(ExplicitVsImplicitInstanceAnalyzer.ExplicitInstanceDescriptor.Id, "this").WithLocation(6, 9), @@ -1156,7 +1156,7 @@ private void Mumbler(object sender, System.EventArgs args) { } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new MemberReferenceAnalyzer() }, null, null, false, // Bug: we are missing diagnostics of "MethodBindingDescriptor" here. https://github.com/dotnet/roslyn/issues/20095 @@ -1219,7 +1219,7 @@ public D(string a, params int[] b) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ParamsArrayTestAnalyzer() }, null, null, false, Diagnostic(ParamsArrayTestAnalyzer.LongParamsDescriptor.Id, "M0(1, 2, 3, 4, 5)").WithLocation(13, 9), @@ -1245,7 +1245,7 @@ class C static int Bar(int P1 = 15, int F2 = 33) { return P1 + F2; } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new EqualsValueTestAnalyzer() }, null, null, false, Diagnostic(EqualsValueTestAnalyzer.EqualsValueDescriptor.Id, "= 44").WithLocation(4, 19), @@ -1277,7 +1277,7 @@ public void FunkyMethod() public int UnFunkyField = 12; } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new OwningSymbolTestAnalyzer() }, null, null, false, Diagnostic(OwningSymbolTestAnalyzer.ExpressionDescriptor.Id, "0").WithLocation(12, 17), @@ -1301,7 +1301,7 @@ public void M0() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NoneOperationTestAnalyzer() }, null, null, false); } @@ -1339,7 +1339,7 @@ public static long Calculate1(long[] f) } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AssignmentOperationSyntaxTestAnalyzer() }, null, null, true, Diagnostic(AssignmentOperationSyntaxTestAnalyzer.AssignmentOperationDescriptor.Id, $"x = { buildSequenceOfBinaryExpressions(8192) }").WithLocation(7, 9), @@ -1388,7 +1388,7 @@ public unsafe void M1() private int _i = 0; }"; - CreateCompilationWithMscorlib45(source, options: TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source, options: TestOptions.UnsafeReleaseDll) .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_InvalidAddrOp, "a + b").WithLocation(7, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AddressOfTestAnalyzer() }, null, null, false, Diagnostic("AddressOfOperation", "&(a + b)").WithLocation(7, 16), @@ -1432,7 +1432,7 @@ public void OnMumble(System.EventArgs args) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LambdaTestAnalyzer() }, null, null, false, Diagnostic(LambdaTestAnalyzer.LambdaExpressionDescriptor.Id, "input => { }").WithLocation(8, 31), @@ -1481,7 +1481,7 @@ void Goo() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E").WithArguments("D.E").WithLocation(6, 32)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new StaticMemberTestAnalyzer() }, null, null, false, Diagnostic(StaticMemberTestAnalyzer.StaticMemberDescriptor.Id, "C.E").WithLocation(23, 9), @@ -1508,7 +1508,7 @@ public void Fred() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LabelOperationsTestAnalyzer() }, null, null, false, Diagnostic(LabelOperationsTestAnalyzer.LabelDescriptor.Id, "Wilma: goto Betty;").WithLocation(6, 9), @@ -1568,7 +1568,7 @@ static void Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new UnaryAndBinaryOperationsTestAnalyzer() }, null, null, false, Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.BooleanNotDescriptor.Id, "!b").WithLocation(41, 13), @@ -1615,7 +1615,7 @@ static void Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_BadBinaryOps, "x + 10", new object[] { "+", "A", "int" }).WithLocation(29, 13), Diagnostic(ErrorCode.ERR_BadUnaryOp, "-x", new object[] { "-", "A" }).WithLocation(31, 13)) // no diagnostics from the analyzer since node it is looking for is invalid @@ -1643,7 +1643,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NullOperationSyntaxTestAnalyzer() }, null, null, false, Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "M0()"), @@ -1669,7 +1669,7 @@ static void Main() int i = global::MyType(); } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (8,17): error CS0023: Operator '.' cannot be applied to operand of type '' // int x = null.Length; @@ -1709,7 +1709,7 @@ public void Increment(string f) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( Diagnostic(ErrorCode.ERR_NoSuchMember, "Nan").WithArguments("float", "Nan").WithLocation(6, 27), Diagnostic(ErrorCode.ERR_BadUnaryOp, "-f").WithArguments("-", "string").WithLocation(11, 16), @@ -1736,7 +1736,7 @@ public static int Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (4,28): error CS0225: The params parameter must be a single dimensional array // public static void Goo(params int a) {} @@ -1785,7 +1785,7 @@ public void M0(C p) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ConditionalAccessOperationTestAnalyzer() }, null, null, false, Diagnostic(ConditionalAccessOperationTestAnalyzer.ConditionalAccessOperationDescriptor.Id, "p?.Prop").WithLocation(24, 17), @@ -1830,7 +1830,7 @@ void M( } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "a").WithArguments("a").WithLocation(6, 16)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LiteralTestAnalyzer() }, null, null, false, Diagnostic("Literal", "null").WithArguments("null").WithLocation(6, 20), @@ -1878,79 +1878,13 @@ public void M() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new TrueFalseUnaryOperationTestAnalyzer() }, null, null, false, Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x && y").WithLocation(29, 13), Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x").WithLocation(30, 18)); } - [Fact, WorkItem(9202, "https://github.com/dotnet/roslyn/issues/9202")] - public void IOperationFeatureFlagCSharp() - { - const string source = @" -public class A -{ - public void M() - { - var a = 1; - } -} - -"; - // with IOperation disabled (by default), public methods - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextAnalyzer() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.AnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextAnalyzer() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.CompilationStartAnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelAnalyzer() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.SemanticModelAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - // with IOperation disabled (by default), internal methods - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelInternalAnalyzer() }, null, null, true, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(6, 17)); - - // with IOperation enabled, public methods - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextAnalyzer() }, null, null, true, - Diagnostic(AnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextAnalyzer() }, null, null, true, - Diagnostic(CompilationStartAnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelAnalyzer() }, null, null, true, - Diagnostic(SemanticModelAnalyzer.GetOperationDescriptor.Id, "1").WithLocation(6, 17)); - - // with IOperation enabled, internal methods - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CompilationStartAnalysisContextInternalAnalyzer() }, null, null, true, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SemanticModelInternalAnalyzer() }, null, null, true, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(6, 17)); - } - [Fact] public void TestOperationBlockAnalyzer_EmptyMethodBody() { @@ -1970,7 +1904,7 @@ public void M3(int i = 0) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new OperationBlockAnalyzer() }, null, null, false, Diagnostic("ID", "M2").WithArguments("M2", "Block").WithLocation(8, 17), diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs index 3f36ef79b0846..167aa9a25d6ed 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests.cs @@ -50,7 +50,7 @@ static void Test2(int y, params int[] x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[]) (Syntax: 'null') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'null') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32[], Constant: null, IsImplicit) (Syntax: 'null') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -88,7 +88,7 @@ public void Deconstruct(out int a, out int b, out int c) a = b = c = 1; } }"; - var compilation = CreateStandardCompilation(text, references: new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateStandardCompilation(text, references: new[] { ValueTupleRef, SystemRuntimeFacadeRef }); compilation.VerifyDiagnostics(); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); @@ -141,7 +141,7 @@ public void GlobalStatement_Parent() var tree = compilation.SyntaxTrees.Single(); var statement = tree.GetRoot().DescendantNodes().OfType().Single(); var model = compilation.GetSemanticModel(tree); - var operation = model.GetOperationInternal(statement); + var operation = model.GetOperation(statement); Assert.Equal(OperationKind.ExpressionStatement, operation.Kind); Assert.Null(operation.Parent); @@ -159,5 +159,45 @@ public void TestParentOperations() VerifyParentOperations(model); } + + [CompilerTrait(CompilerFeature.IOperation)] + [WorkItem(23001, "https://github.com/dotnet/roslyn/issues/23001")] + [Fact] + public void TestGetOperationForQualifiedName() + { + var text = @"using System; + +public class Test +{ + class A + { + public B b; + } + class B + { + } + + void M(A a) + { + int x2 = /**/a.b/**/; + } +} +"; + var comp = CreateStandardCompilation(text); + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + + // Verify we return non-null operation only for topmost member access expression. + var expr = (MemberAccessExpressionSyntax)GetExprSyntaxForBinding(GetExprSyntaxList(tree)); + Assert.Equal("a.b", expr.ToString()); + var operation = model.GetOperation(expr); + Assert.NotNull(operation); + Assert.Equal(OperationKind.FieldReference, operation.Kind); + var fieldOperation = (IFieldReferenceOperation)operation; + Assert.Equal("b", fieldOperation.Field.Name); + + // Verify we return null operation for child nodes of member access expression. + Assert.Null(model.GetOperation(expr.Name)); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs index f8c73d4ad3aeb..2d7ac2a0e8ace 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IAnonymousFunctionExpression.cs @@ -401,17 +401,17 @@ static void F() var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType().Single(); var lambdaSyntax = (LambdaExpressionSyntax)variableDeclaration.Declaration.Variables.Single().Initializer.Value; - var variableDeclarationGroupOperation = (IVariableDeclarationGroupOperation)semanticModel.GetOperationInternal(variableDeclaration); + var variableDeclarationGroupOperation = (IVariableDeclarationGroupOperation)semanticModel.GetOperation(variableDeclaration); var variableTreeLambdaOperation = (IAnonymousFunctionOperation)variableDeclarationGroupOperation.Declarations.Single().Declarators.Single().Initializer.Value; - var lambdaOperation = (IAnonymousFunctionOperation)semanticModel.GetOperationInternal(lambdaSyntax); + var lambdaOperation = (IAnonymousFunctionOperation)semanticModel.GetOperation(lambdaSyntax); // Assert that both ways of getting to the lambda (requesting the lambda directly, and requesting via the lambda syntax) // return the same bound node. Assert.Same(variableTreeLambdaOperation, lambdaOperation); - var variableDeclarationGroupOperationSecondRequest = (IVariableDeclarationGroupOperation)semanticModel.GetOperationInternal(variableDeclaration); + var variableDeclarationGroupOperationSecondRequest = (IVariableDeclarationGroupOperation)semanticModel.GetOperation(variableDeclaration); var variableTreeLambdaOperationSecondRequest = (IAnonymousFunctionOperation)variableDeclarationGroupOperation.Declarations.Single().Declarators.Single(). Initializer.Value; - var lambdaOperationSecondRequest = (IAnonymousFunctionOperation)semanticModel.GetOperationInternal(lambdaSyntax); + var lambdaOperationSecondRequest = (IAnonymousFunctionOperation)semanticModel.GetOperation(lambdaSyntax); // Assert that, when request the variable declaration or the lambda for a second time, there is no rebinding of the // underlying UnboundLambda, and we get the same IAnonymousFunctionExpression as before diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs index a90a7d5a775af..94fd27e6bb967 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs @@ -58,11 +58,11 @@ static void M2(int x, double y) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Double) (Syntax: '2.0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '2.0') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 2) (Syntax: '2.0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -92,11 +92,11 @@ static void M2(int x, double y = 0.0) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Double, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 0, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -126,11 +126,11 @@ static void M2(int x, double y = 0.0) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Double) (Syntax: 'y: 9.9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 9.9') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 9.9) (Syntax: '9.9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -160,11 +160,11 @@ static void M2(int x, double y = 0.0) { } Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Double) (Syntax: 'y: 9.9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 9.9') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 9.9) (Syntax: '9.9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -194,15 +194,15 @@ static void M2(int x = 1, int y = 2, int z = 3) { } Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: 0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'z: 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'z: 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(y: 0, z: 2)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(y: 0, z: 2)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(y: 0, z: 2)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -232,15 +232,15 @@ static void M2(int x = 1, int y = 2, int z = 3) { } Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'z: 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'z: 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 9') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 9) (Syntax: '9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(z: 2, x: 9)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(z: 2, x: 9)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(z: 2, x: 9)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -272,15 +272,15 @@ static void M2(int x = 1, int y = 2, int z = 3) { } Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '9') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '9') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 9) (Syntax: '9') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'z: 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'z: 10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(9, z: 10)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(9, z: 10)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(9, z: 10)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -312,11 +312,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'ref a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'ref a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'out b') ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -348,11 +348,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: ref a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: ref a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: out b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: out b') ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -384,11 +384,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: out b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: out b') ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: ref a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: ref a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -420,7 +420,7 @@ struct S { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IDefaultValueOperation (OperationKind.DefaultValue, Type: S, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -452,7 +452,7 @@ struct S { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sobj) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IDefaultValueOperation (OperationKind.DefaultValue, Type: S, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -483,7 +483,7 @@ void M2(double s = Pi) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: System.Double, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 3.14, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -517,15 +517,15 @@ public static void E1(this P p, int x = 0, int y = 0) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: P, IsImplicit) (Syntax: 'this') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this') IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -561,15 +561,15 @@ public static void E1(this P p, int x = 0, int y = 0) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: P, IsImplicit) (Syntax: 'this') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this') IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -603,15 +603,15 @@ public static void E1(this P p, int x = 0, int y = 0) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: P, IsImplicit) (Syntax: 'this') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this') IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'y: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'this.E1(y: 1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this.E1(y: 1)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'this.E1(y: 1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -642,11 +642,11 @@ void M2(int x, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -676,11 +676,11 @@ void M2(int x, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(1, 0.1, 0.2)') @@ -717,11 +717,11 @@ void M2(int x, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(1)') @@ -757,11 +757,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2()') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2()') @@ -797,11 +797,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'array: a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'array: a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(array: a)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: a)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(array: a)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -831,7 +831,7 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(array: 1)') @@ -844,7 +844,7 @@ Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2(array: 1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: 1)') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(array: 1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -875,11 +875,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'array: a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'array: a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -909,11 +909,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, array: 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1, array: 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(1, array: 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(1, array: 1)') @@ -955,11 +955,11 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[]) (Syntax: 'array: a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: array) (OperationKind.Argument, Type: null) (Syntax: 'array: a') ILocalReferenceOperation: a (OperationKind.LocalReference, Type: System.Double[]) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -989,7 +989,7 @@ void M2(int x = 0, params double[] array) { } Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(2): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1, x: 10)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(array: 1, x: 10)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Double[], IsImplicit) (Syntax: 'M2(array: 1, x: 10)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(array: 1, x: 10)') @@ -1002,7 +1002,7 @@ Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x: 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'x: 10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1038,15 +1038,15 @@ void M2( Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""M1"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 8, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1081,15 +1081,15 @@ bool M2( Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""M1"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1124,15 +1124,15 @@ static bool M2( Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""field"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1179,15 +1179,15 @@ static bool M2( Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: memberName) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""MyEvent"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceFilePath) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""file.cs"", IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: sourceLineNumber) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 11, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1311,32 +1311,32 @@ void M() Instance Receiver: null Arguments(6): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""{0} {1} {2} {3} {4}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""{0} {1} {2} {3} {4}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""{0} {1} {2} {3} {4}"") (Syntax: '""{0} {1} {2} {3} {4}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: '1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: '2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg2) (OperationKind.Argument, Type: System.Object) (Syntax: '3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg2) (OperationKind.Argument, Type: null) (Syntax: '3') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '3') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg3) (OperationKind.Argument, Type: System.Object) (Syntax: '4') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg3) (OperationKind.Argument, Type: null) (Syntax: '4') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '4') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1376,7 +1376,7 @@ void M2(int x = ""string"") Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1415,7 +1415,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1450,7 +1450,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1485,11 +1485,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j:10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: null) (Syntax: 'j:10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'this[j:10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: i) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[j:10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'this[j:10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1605,11 +1605,11 @@ static void Main() Instance Receiver: ILocalReferenceOperation: d (OperationKind.LocalReference, Type: Derived) (Syntax: 'd') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'd[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'd[0]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'd[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1647,11 +1647,11 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[0]') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'this[0]') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'this[0]') @@ -1689,7 +1689,7 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1799,11 +1799,11 @@ public static void Main(string[] args) Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p[10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p[10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4, IsImplicit) (Syntax: 'p[10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1917,11 +1917,11 @@ public static void Main(string[] args) Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p[10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p[10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'p[10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2036,11 +2036,11 @@ public static void Main(string[] args) Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '10') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p[10]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: j) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p[10]') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'p[10]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2101,7 +2101,7 @@ public void M2() Instance Receiver: ILocalReferenceOperation: p (OperationKind.LocalReference, Type: P) (Syntax: 'p') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'p.M1()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'p.M1()') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'p.M1()') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -2136,7 +2136,7 @@ static void M2(bool? x = true) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2()') IInvalidOperation (OperationKind.Invalid, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Boolean[missing], Constant: True, IsInvalid, IsImplicit) (Syntax: 'M2()') @@ -2195,7 +2195,7 @@ static P M1() string expectedOperationTree = @" IObjectCreationOperation (Constructor: P..ctor([System.Boolean[missing]? x = true])) (OperationKind.ObjectCreation, Type: P, IsInvalid) (Syntax: 'new P()') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'new P()') IInvalidOperation (OperationKind.Invalid, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Boolean[missing], Constant: True, IsInvalid, IsImplicit) (Syntax: 'new P()') @@ -2264,11 +2264,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'this[0]') IInvalidOperation (OperationKind.Invalid, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 5, IsInvalid, IsImplicit) (Syntax: 'this[0]') @@ -2344,7 +2344,7 @@ static void M2(bool? x = null) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'M2()') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2398,7 +2398,7 @@ static P M1() string expectedOperationTree = @" IObjectCreationOperation (Constructor: P..ctor([System.Boolean[missing]? x = null])) (OperationKind.ObjectCreation, Type: P, IsInvalid) (Syntax: 'new P()') Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'new P()') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Boolean[missing]?, IsInvalid, IsImplicit) (Syntax: 'new P()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2462,11 +2462,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'this[0]') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: 'this[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2540,11 +2540,11 @@ static void M2(int x, S s = 0) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2582,11 +2582,11 @@ static P M1() string expectedOperationTree = @" IObjectCreationOperation (Constructor: P..ctor(System.Int32 x, [S s = null])) (OperationKind.ObjectCreation, Type: P) (Syntax: 'new P(1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'new P(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new P(1)') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: 'new P(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2631,11 +2631,11 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: index) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: 'this[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[0]') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: 'this[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2682,11 +2682,11 @@ class G Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: G, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') ILiteralOperation (OperationKind.Literal, Type: G, Constant: null, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2730,11 +2730,11 @@ struct G Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: G?, IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') IDefaultValueOperation (OperationKind.DefaultValue, Type: G?, IsImplicit) (Syntax: 'M2(1)') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2792,7 +2792,7 @@ static void M2(int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2817,7 +2817,7 @@ static void M2(ref int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'ref i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'ref i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2843,7 +2843,7 @@ static void M2(in int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'refI') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'refI') ILocalReferenceOperation: refI (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'refI') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2868,7 +2868,7 @@ static void M2(out int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'out i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2902,7 +2902,7 @@ static void M2(params int[] array) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'M2(1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'M2(1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(1)') @@ -2938,7 +2938,7 @@ static void M2(params int[] array) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'M2(0, 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2(0, 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'M2(0, 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(0, 1)') @@ -2969,7 +2969,7 @@ static void M2(int i, int j) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j: 1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: j) (OperationKind.Argument, Type: null) (Syntax: 'j: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2993,7 +2993,7 @@ static void M2(int i, int j) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i: 1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i: 1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3017,7 +3017,7 @@ public P(int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3042,7 +3042,7 @@ public P(ref int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'ref i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'ref i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3067,7 +3067,7 @@ public P(out int i) { } } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out i') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'out i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3099,7 +3099,7 @@ public P(params int[] array) { } Expression: IObjectCreationOperation (Constructor: P..ctor(params System.Int32[] array)) (OperationKind.ObjectCreation, Type: P) (Syntax: 'new P(1)') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'new P(1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new P(1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'new P(1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'new P(1)') @@ -3135,7 +3135,7 @@ public P(params int[] array) { } Expression: IObjectCreationOperation (Constructor: P..ctor(params System.Int32[] array)) (OperationKind.ObjectCreation, Type: P) (Syntax: 'new P(0, 1)') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'new P(0, 1)') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new P(0, 1)') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'new P(0, 1)') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'new P(0, 1)') @@ -3168,7 +3168,7 @@ void M1() } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3196,7 +3196,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'this[1]') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[1]') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'this[1]') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'this[1]') @@ -3230,7 +3230,7 @@ void M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P) (Syntax: 'this') Arguments(1): - IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: System.Int32[], IsImplicit) (Syntax: 'this[0, 1]') + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: array) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'this[0, 1]') IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: 'this[0, 1]') Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'this[0, 1]') @@ -3301,7 +3301,7 @@ void M1(int i, int i2) } "; string expectedOperationTree = @" -IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i2) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') +IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i2) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3330,10 +3330,10 @@ static void M2(int? x = 10) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32?, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') IObjectCreationOperation (Constructor: System.Int32?..ctor(System.Int32 value)) (OperationKind.ObjectCreation, Type: System.Int32?, IsImplicit) (Syntax: 'M2()') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'M2()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'M2()') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10, IsImplicit) (Syntax: 'M2()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3464,11 +3464,11 @@ P M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsInvalid, IsImplicit) (Syntax: '[0]') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: '[0]') IInvalidOperation (OperationKind.Invalid, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') Children(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid, IsImplicit) (Syntax: '[0]') @@ -3561,11 +3561,11 @@ P M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsInvalid, IsImplicit) (Syntax: '[0]') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32[missing], IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32[missing], Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: y) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: '[0]') IDefaultValueOperation (OperationKind.DefaultValue, Type: System.Int32[missing]?, IsInvalid, IsImplicit) (Syntax: '[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3654,11 +3654,11 @@ P M1() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: '[0]') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: S, IsImplicit) (Syntax: '[0]') + IArgumentOperation (ArgumentKind.DefaultValue, Matching Parameter: s) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '[0]') ILiteralOperation (OperationKind.Literal, Type: S, IsImplicit) (Syntax: '[0]') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs index 68618e82c85d5..157600de28517 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IBinaryOperatorExpression.cs @@ -188,7 +188,7 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') IBinaryOperation (BinaryOperatorKind.Or) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') Left: IBinaryOperation (BinaryOperatorKind.And) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... / e % f & g') @@ -322,7 +322,7 @@ void M(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') IBinaryOperation (BinaryOperatorKind.Or) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... 0) ? 1 : 0)') Left: IBinaryOperation (BinaryOperatorKind.And) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a >> 10) + ... / e % f & g') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs new file mode 100644 index 0000000000000..9434decd5d819 --- /dev/null +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConditionalOperation.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.CSharp.Test.Utilities; +using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests +{ + public partial class IOperationTests : SemanticModelTestBase + { + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void ConditionalExpression_01() + { + string source = @" +class P +{ + private void M() + { + int i = 0; + int j = 2; + var z = (/**/true ? i : j/**/); + } +} +"; + string expectedOperationTree = @" +IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'true ? i : j') + Condition: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') + WhenTrue: + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + WhenFalse: + ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void ConditionalExpression_02() + { + string source = @" +class P +{ + private void M() + { + int i = 0; + int j = 2; + (/**/true ? ref i : ref j/**/) = 4; + } +} +"; + string expectedOperationTree = @" +IConditionalOperation (IsRef) (OperationKind.Conditional, Type: System.Int32) (Syntax: 'true ? ref i : ref j') + Condition: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') + WhenTrue: + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + WhenFalse: + ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + } +} diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs index 1b6bc5a809a0e..6781b88a10800 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IFixedStatement.cs @@ -57,7 +57,7 @@ void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""P is {*p}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""P is {*p}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""P is {*p}""') Parts(2): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'P is ') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs index 8487069c22354..f93a2542b6843 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.cs @@ -31,7 +31,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String value LoopControlVariable: - ILocalReferenceOperation: value (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (st ... }') + IVariableDeclaratorOperation (Symbol: System.String value) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'pets') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -45,7 +47,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'value') ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.String) (Syntax: 'value') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -82,7 +84,9 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String item LoopControlVariable: - ILocalReferenceOperation: item (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (st ... }') + IVariableDeclaratorOperation (Symbol: System.String item) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.List, IsImplicit) (Syntax: 'list') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -96,7 +100,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'item') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'item') ILocalReferenceOperation: item (OperationKind.LocalReference, Type: System.String) (Syntax: 'item') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -134,7 +138,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (Ke ... }') Locals: Local_1: System.Collections.Generic.KeyValuePair pair LoopControlVariable: - ILocalReferenceOperation: pair (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair, Constant: null, IsImplicit) (Syntax: 'foreach (Ke ... }') + IVariableDeclaratorOperation (Symbol: System.Collections.Generic.KeyValuePair pair) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'KeyValuePair') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.Dictionary, IsImplicit) (Syntax: '_h') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -150,11 +156,11 @@ static void Main() Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""{0},{1}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""{0},{1}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""{0},{1}"") (Syntax: '""{0},{1}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Key') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: 'pair.Key') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Key') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -163,7 +169,7 @@ static void Main() ILocalReferenceOperation: pair (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair) (Syntax: 'pair') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: 'pair.Value') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Value') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -203,7 +209,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - ILocalReferenceOperation: num (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclaratorOperation (Symbol: System.Int32 num) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'numbers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -229,7 +237,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'num') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'num') ILocalReferenceOperation: num (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'num') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -264,7 +272,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - ILocalReferenceOperation: num (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclaratorOperation (Symbol: System.Int32 num) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'numbers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -290,7 +300,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'num') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'num') ILocalReferenceOperation: num (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'num') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -323,7 +333,9 @@ orderby letter IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (st ... }') Locals: Local_1: System.String value LoopControlVariable: - ILocalReferenceOperation: value (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (st ... }') + IVariableDeclaratorOperation (Symbol: System.String value) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') + Initializer: + null Collection: ILocalReferenceOperation: sorted (OperationKind.LocalReference, Type: ?, IsInvalid) (Syntax: 'sorted') Body: @@ -334,7 +346,7 @@ orderby letter Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'value') ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.String) (Syntax: 'value') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -384,7 +396,9 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (Fi ... }') Locals: Local_1: System.Reflection.FieldInfo fi LoopControlVariable: - ILocalReferenceOperation: fi (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Reflection.FieldInfo, Constant: null, IsImplicit) (Syntax: 'foreach (Fi ... }') + IVariableDeclaratorOperation (Symbol: System.Reflection.FieldInfo fi) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'FieldInfo') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'employee.Ge ... GetFields()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -404,7 +418,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'fi.Name + "" ... (employee))') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'fi.Name + "" ... (employee))') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'fi.Name + "" ... (employee))') Left: IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'fi.Name + "" = ""') @@ -419,12 +433,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'fi.GetValue(employee)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'fi.GetValue(employee)') IInvocationOperation (virtual System.Object System.Reflection.FieldInfo.GetValue(System.Object obj)) (OperationKind.Invocation, Type: System.Object) (Syntax: 'fi.GetValue(employee)') Instance Receiver: ILocalReferenceOperation: fi (OperationKind.LocalReference, Type: System.Reflection.FieldInfo) (Syntax: 'fi') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'employee') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'employee') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'employee') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -463,7 +477,9 @@ public void M() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (ch ... }') Locals: Local_1: System.Char c LoopControlVariable: - ILocalReferenceOperation: c (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Char, Constant: null, IsImplicit) (Syntax: 'foreach (ch ... }') + IVariableDeclaratorOperation (Symbol: System.Char c) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'char') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.String, IsImplicit) (Syntax: 's') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -477,7 +493,7 @@ public void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: 'c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c') ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Char) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -513,7 +529,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... }') Locals: Local_1: System.Collections.Generic.KeyValuePair pair LoopControlVariable: - ILocalReferenceOperation: pair (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair, Constant: null, IsImplicit) (Syntax: 'foreach (va ... }') + IVariableDeclaratorOperation (Symbol: System.Collections.Generic.KeyValuePair pair) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.Dictionary, IsImplicit) (Syntax: '_f') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -529,11 +547,11 @@ static void Main() Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""{0},{1}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""{0},{1}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""{0},{1}"") (Syntax: '""{0},{1}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Key') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: 'pair.Key') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Key') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -542,7 +560,7 @@ static void Main() ILocalReferenceOperation: pair (OperationKind.LocalReference, Type: System.Collections.Generic.KeyValuePair) (Syntax: 'pair') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: 'pair.Value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: 'pair.Value') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'pair.Value') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -577,7 +595,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (Mi ... }') Locals: Local_1: MissingType x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: MissingType, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (Mi ... }') + IVariableDeclaratorOperation (Symbol: MissingType x) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'MissingType') + Initializer: + null Collection: ILocalReferenceOperation: sequence (OperationKind.LocalReference, Type: System.Collections.IEnumerable) (Syntax: 'sequence') Body: @@ -626,7 +646,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null, IsInvalid) (Syntax: 'null') Body: @@ -655,7 +677,9 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'args') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -685,7 +709,9 @@ void F(int[] a) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... a) { x++; }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsInvalid, IsImplicit) (Syntax: 'foreach (in ... a) { x++; }') + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -734,7 +760,9 @@ class Enumerator IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (lo ... x in e) { }') Locals: Local_1: System.Int64 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int64, Constant: null, IsImplicit) (Syntax: 'foreach (lo ... x in e) { }') + IVariableDeclaratorOperation (Symbol: System.Int64 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'long') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: Enumerable, IsImplicit) (Syntax: 'e') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -764,7 +792,9 @@ void F(string s) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (var x in s) { }') Locals: Local_1: System.Char x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Char, Constant: null, IsImplicit) (Syntax: 'foreach (var x in s) { }') + IVariableDeclaratorOperation (Symbol: System.Char x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.String, IsImplicit) (Syntax: 's') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -796,7 +826,9 @@ class var { } IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (var x in a) { }') Locals: Local_1: C.var x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: C.var, Constant: null, IsImplicit) (Syntax: 'foreach (var x in a) { }') + IVariableDeclaratorOperation (Symbol: C.var x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -826,7 +858,9 @@ void F(dynamic d) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (int x in d) { }') Locals: Local_1: System.Int32 x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (int x in d) { }') + IVariableDeclaratorOperation (Symbol: System.Int32 x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'd') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -864,7 +898,9 @@ public class Enumerable IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (ob ... }') Locals: Local_1: System.Object x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Object, Constant: null, IsImplicit) (Syntax: 'foreach (ob ... }') + IVariableDeclaratorOperation (Symbol: System.Object x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'object') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: Enumerable, IsImplicit) (Syntax: 'new Enumerable()') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -881,7 +917,7 @@ public class Enumerable Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'x') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'x') ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -909,7 +945,9 @@ static void Main(string[] args) IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (st ... e)args) { }') Locals: Local_1: System.String x LoopControlVariable: - ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (st ... e)args) { }') + IVariableDeclaratorOperation (Symbol: System.String x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'string') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: '(IEnumerable)args') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -952,7 +990,9 @@ static void Main() IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (in ... }') Locals: Local_1: System.Int32 num LoopControlVariable: - ILocalReferenceOperation: num (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, Constant: null, IsImplicit) (Syntax: 'foreach (in ... }') + IVariableDeclaratorOperation (Symbol: System.Int32 num) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'numbers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -972,7 +1012,7 @@ static void Main() IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw new S ... ""testing"");') IObjectCreationOperation (Constructor: System.Exception..ctor(System.String message)) (OperationKind.ObjectCreation, Type: System.Exception) (Syntax: 'new System. ... (""testing"")') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: System.String) (Syntax: '""testing""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: null) (Syntax: '""testing""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""testing"") (Syntax: '""testing""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -986,7 +1026,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'num') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'num') ILocalReferenceOperation: num (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'num') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1192,5 +1232,49 @@ public static void M(int[] x) VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(17602, "https://github.com/dotnet/roslyn/issues/17602")] + public void IForEachLoopStatement_InvalidLoopControlVariableDeclaration() + { + string source = @" +class X +{ + public static void M(int[] x) + { + int i = 0; + /**/foreach (int i in x) + { + }/**/ + } +} +"; + string expectedOperationTree = @" +IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'foreach (in ... }') + Locals: Local_1: System.Int32 i + LoopControlVariable: + IVariableDeclaratorOperation (Symbol: System.Int32 i) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'int') + Initializer: + null + Collection: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'x') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32[]) (Syntax: 'x') + Body: + IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + NextVariables(0) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(7,32): error CS0136: A local or parameter named 'i' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // /**/foreach (int i in x) + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "i").WithArguments("i").WithLocation(7, 32), + // file.cs(6,13): warning CS0219: The variable 'i' is assigned but its value is never used + // int i = 0; + Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "i").WithArguments("i").WithLocation(6, 13) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs index 08cf1431e8b9d..8e2b64dc56288 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.cs @@ -1186,7 +1186,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1630,7 +1630,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""hello""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""hello""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""hello"") (Syntax: '""hello""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1896,24 +1896,24 @@ select z into w Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'select z') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x in ""123""') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""123"") (Syntax: '""123""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x.ToString()') @@ -1922,11 +1922,11 @@ select z into w ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'let z = x.ToString()') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IInvocationOperation (virtual System.String System.Char.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'x.ToString()') Instance Receiver: IOperation: (OperationKind.None, Type: null) (Syntax: 'x') @@ -1939,7 +1939,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'z') @@ -1951,7 +1951,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'w') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'w') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'w') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'w') @@ -1969,7 +1969,9 @@ select z into w IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... }') Locals: Local_1: System.String item LoopControlVariable: - ILocalReferenceOperation: item (IsDeclaration: True) (OperationKind.LocalReference, Type: System.String, Constant: null, IsImplicit) (Syntax: 'foreach (va ... }') + IVariableDeclaratorOperation (Symbol: System.String item) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'str') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1983,7 +1985,7 @@ select z into w Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'item') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'item') ILocalReferenceOperation: item (OperationKind.LocalReference, Type: System.String) (Syntax: 'item') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2056,24 +2058,24 @@ select z into w Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'select z') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select<, System.String>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.String> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select z') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let z = x.ToString()') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x in ""123""') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in ""123""') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""123"") (Syntax: '""123""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'x.ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x.ToString()') @@ -2082,11 +2084,11 @@ select z into w ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Char x, System.String z)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'let z = x.ToString()') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = x.ToString()') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Char, IsImplicit) (Syntax: 'let z = x.ToString()') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.String, IsImplicit) (Syntax: 'x.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString()') IInvocationOperation (virtual System.String System.Char.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'x.ToString()') Instance Receiver: IOperation: (OperationKind.None, Type: null) (Syntax: 'x') @@ -2099,7 +2101,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.String>, IsImplicit) (Syntax: 'z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'z') @@ -2111,7 +2113,7 @@ select z into w OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'w') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'w') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'w') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'w') @@ -2199,12 +2201,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'lambda(i)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'lambda(i)') IInvocationOperation (virtual System.Int32 System.Func.Invoke(System.Int32 arg)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'lambda(i)') Instance Receiver: ILocalReferenceOperation: lambda (OperationKind.LocalReference, Type: System.Func) (Syntax: 'lambda') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2303,12 +2305,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'lambda(i)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'lambda(i)') IInvocationOperation (virtual System.Int32 System.Func.Invoke(System.Int32 arg)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'lambda(i)') Instance Receiver: ILocalReferenceOperation: lambda (OperationKind.LocalReference, Type: System.Func) (Syntax: 'lambda') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2430,7 +2432,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2491,7 +2493,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2545,7 +2547,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2584,7 +2586,7 @@ static int foo(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'i--') IIncrementOrDecrementOperation (Postfix) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'i--') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') @@ -2613,7 +2615,7 @@ static int foo(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2651,7 +2653,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""z""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""z""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""z"") (Syntax: '""z""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2756,11 +2758,11 @@ private void M() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: null) (Syntax: 's') ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: null) (Syntax: 'out var i') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var i') ILocalReferenceOperation: i (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2785,7 +2787,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""i={i}, s={s}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""i={i}, s={s}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""i={i}, s={s}""') Parts(4): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'i=') @@ -2814,5 +2816,53 @@ private void M() VerifyOperationTreeForTest(source, expectedOperationTree); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void IForLoopStatement_InvalidIterationVariableDeclaration() + { + string source = @" +class Program +{ + static void Main(string[] args) + { + int i = 0; + /**/for (int i = 0; true;) + { + System.Console.WriteLine(i); + }/**/ + } +} +"; + string expectedOperationTree = @" +IForLoopOperation (LoopKind.For) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'for (int i ... }') + Locals: Local_1: System.Int32 i + Condition: + ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') + Before: + IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null, IsInvalid, IsImplicit) (Syntax: 'int i = 0') + IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'int i = 0') + Declarators: + IVariableDeclaratorOperation (Symbol: System.Int32 i) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'i = 0') + Initializer: + IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= 0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Initializer: + null + AtLoopBottom(0) + Body: + IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'System.Cons ... iteLine(i);') + Expression: + IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'System.Cons ... riteLine(i)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"; + VerifyOperationTreeForTest(source, expectedOperationTree); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs index b842d5cb88ac7..d42602e733823 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IIfStatement.cs @@ -205,7 +205,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'm') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'm') ILocalReferenceOperation: m (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'm') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -219,7 +219,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'n') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'n') ILocalReferenceOperation: n (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'n') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -277,7 +277,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'm') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'm') ILocalReferenceOperation: m (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'm') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -289,7 +289,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'n') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'n') ILocalReferenceOperation: n (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'n') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -345,7 +345,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Nothing is ... er than m.""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Nothing is ... er than m.""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Nothing is larger than m."") (Syntax: '""Nothing is ... er than m.""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -401,7 +401,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Result1""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Result1""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Result1"") (Syntax: '""Result1""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -421,7 +421,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Result2""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Result2""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Result2"") (Syntax: '""Result2""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -433,7 +433,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Result3""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Result3""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Result3"") (Syntax: '""Result3""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -467,11 +467,11 @@ private void M() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: null) (Syntax: 's') ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: null) (Syntax: 'out var i') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var i') ILocalReferenceOperation: i (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -483,7 +483,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""i ={i}, s ={s}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') Parts(4): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'i =') @@ -515,7 +515,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '$""i ={i}, s ={s}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""i ={i}, s ={s}""') Parts(4): IInterpolatedStringTextOperation (OperationKind.InterpolatedStringText, Type: null) (Syntax: 'i =') @@ -584,7 +584,7 @@ private int A() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'A()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'A()') IInvocationOperation ( System.Int32 P.A()) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'A()') Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'A') @@ -636,16 +636,16 @@ private void A(bool flag) Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: P, IsImplicit) (Syntax: 'A') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'int.TryPars ... out var i)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: null) (Syntax: 'int.TryPars ... out var i)') IInvocationOperation (System.Boolean System.Int32.TryParse(System.String s, out System.Int32 result)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'int.TryPars ... out var i)') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: s) (OperationKind.Argument, Type: null) (Syntax: 's') ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: result) (OperationKind.Argument, Type: null) (Syntax: 'out var i') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var i') ILocalReferenceOperation: i (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -696,7 +696,7 @@ private static void A(bool flag, int number) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'o is int i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: null) (Syntax: 'o is int i') IIsPatternOperation (OperationKind.IsPattern, Type: System.Boolean) (Syntax: 'o is int i') Expression: ILocalReferenceOperation: o (OperationKind.LocalReference, Type: System.Object) (Syntax: 'o') @@ -704,7 +704,7 @@ private static void A(bool flag, int number) IDeclarationPatternOperation (Declared Symbol: System.Int32 i) (OperationKind.DeclarationPattern, Type: null) (Syntax: 'int i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -752,7 +752,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'str') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'str') ILocalReferenceOperation: str (OperationKind.LocalReference, Type: System.String) (Syntax: 'str') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -796,7 +796,7 @@ private static void A(object o) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: o) (OperationKind.Argument, Type: System.Object) (Syntax: '25') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: o) (OperationKind.Argument, Type: null) (Syntax: '25') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '25') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -849,7 +849,7 @@ private static void A(bool flag, int number) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'o is int i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: flag) (OperationKind.Argument, Type: null) (Syntax: 'o is int i') IIsPatternOperation (OperationKind.IsPattern, Type: System.Boolean) (Syntax: 'o is int i') Expression: ILocalReferenceOperation: o (OperationKind.LocalReference, Type: System.Object) (Syntax: 'o') @@ -857,7 +857,7 @@ private static void A(bool flag, int number) IDeclarationPatternOperation (Declared Symbol: System.Int32 i) (OperationKind.DeclarationPattern, Type: null) (Syntax: 'int i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: number) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -906,7 +906,7 @@ private void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'str') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'str') ILocalReferenceOperation: str (OperationKind.LocalReference, Type: System.String) (Syntax: 'str') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1145,7 +1145,7 @@ Type Arguments(0) Operand: IParameterReferenceOperation: d (OperationKind.ParameterReference, Type: dynamic) (Syntax: 'd') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'x') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'x') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs index 6f9c98361d54f..001c2398cf427 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IInterpolatedStringExpression.cs @@ -314,7 +314,7 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: Class, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32) (Syntax: 'y') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'y') ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'y') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -369,7 +369,7 @@ public void M() Instance Receiver: IInstanceReferenceOperation (OperationKind.InstanceReference, Type: Class, IsImplicit) (Syntax: 'M2') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.String) (Syntax: '$""{y}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: '$""{y}""') IInterpolatedStringOperation (OperationKind.InterpolatedString, Type: System.String) (Syntax: '$""{y}""') Parts(1): IInterpolationOperation (OperationKind.Interpolation, Type: null) (Syntax: '{y}') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs index 130f9fdd87fac..0acc33a18a233 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILocalFunctionStatement.cs @@ -162,7 +162,7 @@ public void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: System.Int32) (Syntax: 'p1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: null) (Syntax: 'p1') IParameterReferenceOperation: p1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'p1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -194,7 +194,7 @@ public void M(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x + p1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: p1) (OperationKind.Argument, Type: null) (Syntax: 'x + p1') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + p1') Left: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') @@ -240,7 +240,7 @@ public void M(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: millisecondsDelay) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: millisecondsDelay) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs index a7bc7d00eb90a..07bded68413a0 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ILockStatement.cs @@ -364,7 +364,7 @@ public void M() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""Hello World!""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""Hello World!""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Hello World!"") (Syntax: '""Hello World!""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs index 26c09ceeb2540..9334b471af2c6 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.cs @@ -289,7 +289,7 @@ public void M1(int x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'new[] { x, y }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new[] { x, y }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'new[] { x, y }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -472,5 +472,137 @@ static void Main() VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(22967, "https://github.com/dotnet/roslyn/issues/22967")] + public void ObjectCreationWithInvalidInitializer() + { + string source = @" +class C +{ + public void M1() + { + var x1 = /**/new C() { MissingMember = 1 }/**/; + } +} +"; + string expectedOperationTree = @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C() { M ... ember = 1 }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C, IsInvalid) (Syntax: '{ MissingMember = 1 }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'MissingMember = 1') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingMember') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'MissingMember') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(6,38): error CS0117: 'C' does not contain a definition for 'MissingMember' + // var x1 = /**/new C() { MissingMember = 1 }/**/; + Diagnostic(ErrorCode.ERR_NoSuchMember, "MissingMember").WithArguments("C", "MissingMember").WithLocation(6, 38) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(22967, "https://github.com/dotnet/roslyn/issues/22967")] + public void ObjectCreationWithInvalidMemberInitializer() + { + string source = @" +class C +{ + public void M1() + { + var x1 = /**/new C(){ MissingField = { x = 1 } }/**/; + } +} +"; + string expectedOperationTree = @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(){ Mi ... { x = 1 } }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C, IsInvalid) (Syntax: '{ MissingFi ... { x = 1 } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: ?, IsInvalid) (Syntax: 'MissingField = { x = 1 }') + InitializedMember: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingField') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'MissingField') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: ?) (Syntax: '{ x = 1 }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?) (Syntax: 'x = 1') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsImplicit) (Syntax: 'x') + Children(1): + IOperation: (OperationKind.None, Type: null) (Syntax: 'x') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingField') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(6,37): error CS0117: 'C' does not contain a definition for 'MissingField' + // var x1 = /**/new C(){ MissingField = { x = 1 } }/**/; + Diagnostic(ErrorCode.ERR_NoSuchMember, "MissingField").WithArguments("C", "MissingField").WithLocation(6, 37) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(22967, "https://github.com/dotnet/roslyn/issues/22967")] + public void ObjectCreationWithInvalidCollectionInitializer() + { + string source = @" +using System.Collections.Generic; + +class C +{ + public void M1() + { + var x1 = /**/new C(){ MissingField = new List() { 1 }}/**/; + } +} +"; + string expectedOperationTree = @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(){ Mi ... t>() { 1 }}') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C, IsInvalid) (Syntax: '{ MissingFi ... t>() { 1 }}') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'MissingFiel ... nt>() { 1 }') + Left: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'MissingField') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'MissingField') + Children(1): + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') + Right: + IObjectCreationOperation (Constructor: System.Collections.Generic.List..ctor()) (OperationKind.ObjectCreation, Type: System.Collections.Generic.List) (Syntax: 'new List() { 1 }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Collections.Generic.List) (Syntax: '{ 1 }') + Initializers(1): + ICollectionElementInitializerOperation (AddMethod: void System.Collections.Generic.List.Add(System.Int32 item)) (IsDynamic: False) (OperationKind.CollectionElementInitializer, Type: System.Void, IsImplicit) (Syntax: '1') + Arguments(1): + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // file.cs(8,37): error CS0117: 'C' does not contain a definition for 'MissingField' + // var x1 = /**/new C(){ MissingField = new List() { 1 }}/**/; + Diagnostic(ErrorCode.ERR_NoSuchMember, "MissingField").WithArguments("C", "MissingField").WithLocation(8, 37) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs index 35ea6190e4e4d..cd981286c2580 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.cs @@ -159,14 +159,14 @@ public void M(List customers) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from cust in customers') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from cust in customers') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from cust in customers') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IParameterReferenceOperation: customers (OperationKind.ParameterReference, Type: System.Collections.Generic.List) (Syntax: 'customers') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'cust.Name') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'cust.Name') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'cust.Name') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'cust.Name') @@ -780,7 +780,7 @@ public void M(string x) IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw new A ... (nameof(x))') IObjectCreationOperation (Constructor: System.ArgumentNullException..ctor(System.String paramName)) (OperationKind.ObjectCreation, Type: System.ArgumentNullException) (Syntax: 'new Argumen ... (nameof(x))') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: paramName) (OperationKind.Argument, Type: System.String) (Syntax: 'nameof(x)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: paramName) (OperationKind.Argument, Type: null) (Syntax: 'nameof(x)') INameOfOperation (OperationKind.NameOf, Type: System.String, Constant: ""x"") (Syntax: 'nameof(x)') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.String) (Syntax: 'x') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1040,7 +1040,9 @@ static IEnumerable MyIterator(IEnumerable source, Func predica IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'foreach (va ... rn element;') Locals: Local_1: T element LoopControlVariable: - ILocalReferenceOperation: element (IsDeclaration: True) (OperationKind.LocalReference, Type: T, Constant: null, IsImplicit) (Syntax: 'foreach (va ... rn element;') + IVariableDeclaratorOperation (Symbol: T element) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'var') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'source') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1053,7 +1055,7 @@ static IEnumerable MyIterator(IEnumerable source, Func predica Instance Receiver: IParameterReferenceOperation: predicate (OperationKind.ParameterReference, Type: System.Func) (Syntax: 'predicate') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: T) (Syntax: 'element') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg) (OperationKind.Argument, Type: null) (Syntax: 'element') ILocalReferenceOperation: element (OperationKind.LocalReference, Type: T) (Syntax: 'element') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs new file mode 100644 index 0000000000000..feb64c6b71f8e --- /dev/null +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IParenthesized.cs @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests +{ + public partial class IOperationTests : SemanticModelTestBase + { + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesized() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return /**/(a + b)/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedChild() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return (/**/a + b/**/); + } +} +"; + string expectedOperationTree = @" +IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedParent() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + /**/return (a + b);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (a + b);') + ReturnedValue: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return (/**/((a + b))/**/); + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNestingParent() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + /**/return (((a + b)));/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (((a + b)));') + ReturnedValue: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting02() + { + string source = @" +class P +{ + static int M1(int a, int b, int c) + { + return (/**/((a + b) * c)/**/); + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting02Parent() + { + string source = @" +class P +{ + static int M1(int a, int b, int c) + { + /**/return (((a + b) * c));/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (((a + b) * c));') + ReturnedValue: + IBinaryOperation (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: '(a + b) * c') + Left: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') + Right: + IParameterReferenceOperation: c (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'c') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting03() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return /**/(((a + b)))/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting03Parent() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + /**/return (((a + b)));/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (((a + b)));') + ReturnedValue: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting04() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return ((/**/(a + b)/**/)); + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedMultipleNesting05() + { + string source = @" +class P +{ + static int M1(int a, int b) + { + return (((/**/a + b/**/))); + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedImplicitConversion() + { + string source = @" +class P +{ + static long M1(int a, int b) + { + return /**/(a + b)/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedImplicitConversionParent() + { + string source = @" +class P +{ + static long M1(int a, int b) + { + /**/return (a + b);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (a + b);') + ReturnedValue: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int64, IsImplicit) (Syntax: 'a + b') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedExplicitConversion() + { + string source = @" +class P +{ + static double M1(int a, int b) + { + return /**/(double)(a + b)/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedExplicitConversionParent() + { + string source = @" +class P +{ + static double M1(int a, int b) + { + /**/return (double)(a + b);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (double)(a + b);') + ReturnedValue: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Double) (Syntax: '(double)(a + b)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'a + b') + Left: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') + Right: + IParameterReferenceOperation: b (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'b') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedConstantValue() + { + string source = @" +class P +{ + static int M1() + { + return /**/(5)/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedConstantValueParent() + { + string source = @" +class P +{ + static int M1() + { + /**/return (5);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return (5);') + ReturnedValue: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 5) (Syntax: '5') +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedQueryClause() + { + string source = @" +using System.Linq; + +class P +{ + static object M1(int[] a) + { + return from r in a select /**/(-r)/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedQueryClauseParent() + { + string source = @" +using System.Linq; + +class P +{ + static object M1(int[] a) + { + /**/return from r in a select (-r);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return from ... elect (-r);') + ReturnedValue: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'from r in a select (-r)') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: + ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collections.Generic.IEnumerable) (Syntax: 'from r in a select (-r)') + Expression: + IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select (-r)') + Instance Receiver: + null + Arguments(2): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from r in a') + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from r in a') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: + IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32[]) (Syntax: 'a') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '(-r)') + IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: '(-r)') + Target: + IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: '(-r)') + IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: '(-r)') + IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: '(-r)') + ReturnedValue: + IUnaryOperation (UnaryOperatorKind.Minus) (OperationKind.UnaryOperator, Type: System.Int32) (Syntax: '-r') + Operand: + IOperation: (OperationKind.None, Type: null) (Syntax: 'r') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"; + var expectedDiagnostics = DiagnosticDescription.None; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedErrorOperand() + { + string source = @" +class P +{ + static int M1() + { + return /**/(a)/**/; + } +} +"; + // GetOperation returns null for ParenthesizedExpressionSyntax + Assert.Null(GetOperationTreeForTest(source)); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact] + public void TestParenthesizedErrorOperandParent() + { + string source = @" +class P +{ + static int M1() + { + /**/return (a);/**/ + } +} +"; + string expectedOperationTree = @" +IReturnOperation (OperationKind.Return, Type: null, IsInvalid) (Syntax: 'return (a);') + ReturnedValue: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'a') + Children(0) +"; + var expectedDiagnostics = new DiagnosticDescription[] { + // CS0103: The name 'a' does not exist in the current context + // return /**/(a)/**/; + Diagnostic(ErrorCode.ERR_NameNotInContext, "a").WithArguments("a").WithLocation(6, 27) + }; + + VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); + } + } +} diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs index 6a55b3a20004b..42617245ac57d 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.cs @@ -32,7 +32,7 @@ class C var semanticModel = compilation.GetSemanticModel(tree); foreach (var node in nodes) { - Assert.Null(semanticModel.GetOperationInternal(node)); + Assert.Null(semanticModel.GetOperation(node)); } } @@ -335,7 +335,7 @@ class C Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -363,7 +363,7 @@ class C Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs index 56ae1d50d75c1..44634249d8e05 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_ITupleExpression.cs @@ -570,7 +570,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -640,7 +640,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -903,7 +903,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -980,7 +980,7 @@ public void M(C c1) Operand: IObjectCreationOperation (Constructor: C..ctor(System.Int32 x)) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'new C(0)') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsInvalid) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1044,11 +1044,11 @@ public void M() Right: IObjectCreationOperation (Constructor: Point..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: Point) (Syntax: 'new Point(0, 1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1115,11 +1115,11 @@ Dimension Sizes(1): Element Values(1): IObjectCreationOperation (Constructor: Point..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: Point) (Syntax: 'new Point(0, 1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1177,11 +1177,11 @@ public void M() Right: IObjectCreationOperation (Constructor: Point..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: Point) (Syntax: 'new Point(0, 1)') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: '0') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs index ad4b4c801ab6f..03978c0630066 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IUsingStatement.cs @@ -53,7 +53,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c.ToString()') Instance Receiver: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: C) (Syntax: 'c') @@ -119,7 +119,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') Instance Receiver: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: C) (Syntax: 'c1') @@ -167,7 +167,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c.ToString()') Instance Receiver: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: C) (Syntax: 'c') @@ -241,7 +241,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -302,7 +302,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -374,7 +374,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -470,7 +470,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString ... .ToString()') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.String) (Syntax: 'c1.ToString ... .ToString()') Left: IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') @@ -551,7 +551,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') Instance Receiver: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: C) (Syntax: 'c1') @@ -600,7 +600,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c1.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c1.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c1.ToString()') Instance Receiver: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: C) (Syntax: 'c1') @@ -836,7 +836,7 @@ public static void M1() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 'c.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'c.ToString()') IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: 'c.ToString()') Instance Receiver: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: C) (Syntax: 'c') diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs index 7a8c9948a067b..4fbbb4ee55ee0 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.cs @@ -33,15 +33,13 @@ static void Main() } "; string expectedOperationTree = @" -IDoLoopOperation (DoLoopKind: DoWhileBottomLoop) (LoopKind.Do) (OperationKind.Loop, Type: null) (Syntax: 'do ... le (i < 4);') +IWhileLoopOperation (ConditionIsTop: False, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'do ... le (i < 4);') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i < 4') Left: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') - IgnoredCondition: - null Body: IBlockOperation (2 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'sum += ids[i];') @@ -60,6 +58,8 @@ static void Main() IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'i++') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -88,7 +88,7 @@ static int SumWhile() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i < ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i < ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i < 5') Left: @@ -109,6 +109,8 @@ static int SumWhile() IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'i++') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -138,7 +140,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (cond ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (cond ... }') Condition: ILocalReferenceOperation: condition (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'condition') Body: @@ -173,6 +175,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') WhenFalse: null + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -203,7 +207,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -235,7 +239,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""While-loop break""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""While-loop break""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop break"") (Syntax: '""While-loop break""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -248,10 +252,12 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""While-loop statement""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""While-loop statement""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop statement"") (Syntax: '""While-loop statement""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -281,7 +287,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -310,7 +316,7 @@ static void Main() IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw new E ... ever hit"");') IObjectCreationOperation (Constructor: System.Exception..ctor(System.String message)) (OperationKind.ObjectCreation, Type: System.Exception) (Syntax: 'new Excepti ... Never hit"")') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: System.String) (Syntax: '""Never hit""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument, Type: null) (Syntax: '""Never hit""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""Never hit"") (Syntax: '""Never hit""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -324,10 +330,12 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: '""While-loop statement""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '""While-loop statement""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While-loop statement"") (Syntax: '""While-loop statement""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -354,7 +362,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ((i = ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ((i = ... }') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '(i = value) >= 0') Left: @@ -373,18 +381,18 @@ static void Main() Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: System.String) (Syntax: '""While {0} {1}""') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: format) (OperationKind.Argument, Type: null) (Syntax: '""While {0} {1}""') ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""While {0} {1}"") (Syntax: '""While {0} {1}""') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: System.Object) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg0) (OperationKind.Argument, Type: null) (Syntax: 'i') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'i') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: System.Object) (Syntax: 'value') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: arg1) (OperationKind.Argument, Type: null) (Syntax: 'value') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'value') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -396,6 +404,8 @@ static void Main() IIncrementOrDecrementOperation (Postfix) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'value--') Target: ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'value') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -417,7 +427,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while (numb ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while (numb ... }') Condition: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Boolean, IsInvalid, IsImplicit) (Syntax: 'number') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -425,6 +435,8 @@ static void Main() ILocalReferenceOperation: number (OperationKind.LocalReference, Type: System.Int32, IsInvalid) (Syntax: 'number') Body: IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -456,7 +468,7 @@ public static int GetFirstEvenNumber(int number) "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -484,6 +496,8 @@ public static int GetFirstEvenNumber(int number) IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'number++') Target: IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -515,7 +529,7 @@ public static int GetFirstEvenNumber(int number) } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (true ... }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: True) (Syntax: 'true') Body: @@ -546,6 +560,8 @@ public static int GetFirstEvenNumber(int number) IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return number;') ReturnedValue: IParameterReferenceOperation: number (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'number') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -573,7 +589,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while () ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'while () ... }') Condition: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) @@ -609,6 +625,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') WhenFalse: null + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -631,7 +649,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 10') Left: @@ -640,6 +658,8 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') Body: IBlockOperation (0 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -667,7 +687,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i <= ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThanOrEqual) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 10') Left: @@ -699,10 +719,12 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -732,7 +754,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i<10') Left: @@ -756,7 +778,7 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') Initializer: null - IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') + IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j < 10') Left: @@ -776,20 +798,24 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'System.Cons ... iteLine(i);') Expression: IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'System.Cons ... riteLine(i)') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -820,7 +846,7 @@ static void Main() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while(i<10) ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i<10') Left: @@ -844,7 +870,7 @@ static void Main() ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') Initializer: null - IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') + IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (j < ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'j < 10') Left: @@ -875,20 +901,24 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'j') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'j') ILocalReferenceOperation: j (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'j') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'System.Cons ... iteLine(i);') Expression: IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'System.Cons ... riteLine(i)') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -937,7 +967,7 @@ public void Next() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (d.Do ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (d.Do ... }') Condition: IUnaryOperation (UnaryOperatorKind.True) (OperationKind.UnaryOperator, Type: System.Boolean, IsImplicit) (Syntax: 'd.Done') Operand: @@ -958,6 +988,8 @@ Type Arguments(0) Arguments(0) ArgumentNames(0) ArgumentRefKinds(0) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -981,7 +1013,7 @@ static void Main(string[] args) "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ( ++i ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while ( ++i ... }') Condition: IBinaryOperation (BinaryOperatorKind.LessThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: '++i < 5') Left: @@ -998,10 +1030,12 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'i') ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1023,7 +1057,7 @@ static void Main(string[] args) } }"; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i > ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (i > ... }') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i > 0') Left: @@ -1037,6 +1071,8 @@ static void Main(string[] args) IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'i++') Target: ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1059,7 +1095,7 @@ bool foo() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (b == ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (b == ... }') Condition: IBinaryOperation (BinaryOperatorKind.Equals) (OperationKind.BinaryOperator, Type: System.Boolean, Constant: True) (Syntax: 'b == b') Left: @@ -1071,6 +1107,8 @@ bool foo() IReturnOperation (OperationKind.Return, Type: null) (Syntax: 'return b;') ReturnedValue: ILocalReferenceOperation: b (OperationKind.LocalReference, Type: System.Boolean, Constant: True) (Syntax: 'b') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1101,7 +1139,7 @@ public void TryMethod() } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (x-- ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (x-- ... }') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThan) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'x-- > 0') Left: @@ -1143,6 +1181,8 @@ Catch clauses(0) Arguments(0) Initializer: null + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1179,18 +1219,18 @@ static bool TakeOutParam(T y, out T x) } "; string expectedOperationTree = @" -IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (Dumm ... }') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'while (Dumm ... }') Locals: Local_1: System.Int32 x1 Condition: IInvocationOperation (System.Boolean X.Dummy(System.Boolean x, System.Object y, System.Object z)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'Dummy(f, Ta ... ar x1), x1)') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'f') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'f') ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Object) (Syntax: 'TakeOutPara ... out var x1)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'TakeOutPara ... out var x1)') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'TakeOutPara ... out var x1)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1198,7 +1238,7 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'f ? 1 : 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'f ? 1 : 2') IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') Condition: ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') @@ -1208,14 +1248,14 @@ static bool TakeOutParam(T y, out T x) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'out var x1') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var x1') ILocalReferenceOperation: x1 (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Object) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'x1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1230,7 +1270,7 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'x1') ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1241,6 +1281,8 @@ static bool TakeOutParam(T y, out T x) ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') Right: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') + IgnoredCondition: + null "; VerifyOperationTreeForTest(source, expectedOperationTree); } @@ -1276,18 +1318,18 @@ static bool TakeOutParam(T y, out T x) } "; string expectedOperationTree = @" -IDoLoopOperation (DoLoopKind: DoWhileBottomLoop) (LoopKind.Do) (OperationKind.Loop, Type: null) (Syntax: 'do ... x1), x1));') +IWhileLoopOperation (ConditionIsTop: False, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'do ... x1), x1));') Locals: Local_1: System.Int32 x1 Condition: IInvocationOperation (System.Boolean X.Dummy(System.Boolean x, System.Object y, System.Object z)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'Dummy(f, Ta ... ar x1), x1)') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Boolean) (Syntax: 'f') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'f') ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Object) (Syntax: 'TakeOutPara ... out var x1)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null) (Syntax: 'TakeOutPara ... out var x1)') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'TakeOutPara ... out var x1)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1295,7 +1337,7 @@ static bool TakeOutParam(T y, out T x) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'f ? 1 : 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'f ? 1 : 2') IConditionalOperation (OperationKind.Conditional, Type: System.Int32) (Syntax: 'f ? 1 : 2') Condition: ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') @@ -1305,22 +1347,20 @@ static bool TakeOutParam(T y, out T x) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out var x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'out var x1') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'var x1') ILocalReferenceOperation: x1 (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Object) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null) (Syntax: 'x1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'x1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IgnoredCondition: - null Body: IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ ... }') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'f = false;') @@ -1330,6 +1370,8 @@ static bool TakeOutParam(T y, out T x) ILocalReferenceOperation: f (OperationKind.LocalReference, Type: System.Boolean) (Syntax: 'f') Right: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') + IgnoredCondition: + null "; var expectedDiagnostics = DiagnosticDescription.None; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs index e86bde03ed58b..675ee8d9d7720 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_TryCatch.cs @@ -491,7 +491,7 @@ Catch clauses(0) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.String) (Syntax: 's') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 's') IParameterReferenceOperation: s (OperationKind.ParameterReference, Type: System.String) (Syntax: 's') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs index bc55c44d99edf..3a8c1469875f0 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/DeconstructionTests.cs @@ -2079,11 +2079,11 @@ static void Main() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: '42') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '42') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42, IsInvalid) (Syntax: '42') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: (System.Int32, System.Int32), IsInvalid) (Syntax: '(43, 44)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: '(43, 44)') ITupleOperation (OperationKind.Tuple, Type: (System.Int32, System.Int32), IsInvalid) (Syntax: '(43, 44)') Elements(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43, IsInvalid) (Syntax: '43') @@ -2130,11 +2130,11 @@ static void Main() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item1) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: System.Int32) (Syntax: '2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: item2) (OperationKind.Argument, Type: null) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2321,7 +2321,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: 'x1') ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32, IsInvalid) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -2363,7 +2363,7 @@ static void M(int a) { } Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: System.Int32, IsInvalid) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null, IsInvalid) (Syntax: 'x1') ILocalReferenceOperation: x1 (OperationKind.LocalReference, Type: System.Int32, IsInvalid) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3435,7 +3435,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: System.Int32) (Syntax: 'out int x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: a) (OperationKind.Argument, Type: null) (Syntax: 'out int x1') IDeclarationExpressionOperation (OperationKind.DeclarationExpression, Type: System.Int32) (Syntax: 'int x1') ILocalReferenceOperation: x1 (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs index 28d375cc3ba9a..fb781389a2a3c 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/IteratorTests.cs @@ -7,6 +7,7 @@ using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Symbols; +using Microsoft.CodeAnalysis.Test.Utilities; using System.Linq; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics @@ -408,6 +409,7 @@ protected override IEnumerable M() comp.Compilation.VerifyDiagnostics(); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] [WorkItem(261047, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=261047&_a=edit")] public void MissingExpression() @@ -428,6 +430,19 @@ IEnumerable I() // yield return; Diagnostic(ErrorCode.ERR_EmptyYield, "return").WithLocation(7, 15) ); + + var tree = comp.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("yield return;", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: +@" +IReturnOperation (OperationKind.YieldReturn, Type: null, IsInvalid) (Syntax: 'yield return;') + ReturnedValue: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'yield return;') + Children(0) +"); } [Fact] diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs index 3652fb1e36b25..1f475bf2496a3 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs @@ -552,7 +552,7 @@ static void Main(S zero, S one) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: ''a'') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: ''a'') ILiteralOperation (OperationKind.Literal, Type: System.Char, Constant: a) (Syntax: ''a'') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -563,7 +563,7 @@ static void Main(S zero, S one) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: ''b'') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: ''b'') ILiteralOperation (OperationKind.Literal, Type: System.Char, Constant: b) (Syntax: ''b'') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -573,7 +573,7 @@ static void Main(S zero, S one) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Char) (Syntax: 'one ? 'g' : 'h'') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'one ? 'g' : 'h'') IConditionalOperation (OperationKind.Conditional, Type: System.Char) (Syntax: 'one ? 'g' : 'h'') Condition: IUnaryOperation (UnaryOperatorKind.True) (OperatorMethod: System.Boolean S.op_True(S s)) (OperationKind.UnaryOperator, Type: System.Boolean, IsImplicit) (Syntax: 'one') @@ -679,7 +679,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '+a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '+a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '+a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -694,7 +694,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '-a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '-a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '-a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -709,7 +709,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '~a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '~a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '~a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -724,7 +724,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '!a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '!a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '!a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -739,7 +739,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '+~!-a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '+~!-a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '+~!-a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -799,7 +799,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '++a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -814,7 +814,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a++') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -829,7 +829,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '--a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -844,7 +844,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a--') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -902,7 +902,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '++a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -917,7 +917,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a++') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -932,7 +932,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '--a') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -947,7 +947,7 @@ static void Method(S a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Object) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'a--') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -987,7 +987,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IIncrementOrDecrementOperation (Prefix) (OperationKind.Increment, Type: System.Int32) (Syntax: '++a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -999,7 +999,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'a++') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1011,7 +1011,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IIncrementOrDecrementOperation (Prefix) (OperationKind.Decrement, Type: System.Int32) (Syntax: '--a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1023,7 +1023,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IIncrementOrDecrementOperation (Postfix) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'a--') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1064,7 +1064,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '++a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '++a') IIncrementOrDecrementOperation (Prefix, Checked) (OperationKind.Increment, Type: System.Int32) (Syntax: '++a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1076,7 +1076,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a++') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a++') IIncrementOrDecrementOperation (Postfix, Checked) (OperationKind.Increment, Type: System.Int32) (Syntax: 'a++') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1088,7 +1088,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: '--a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: '--a') IIncrementOrDecrementOperation (Prefix, Checked) (OperationKind.Decrement, Type: System.Int32) (Syntax: '--a') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') @@ -1100,7 +1100,7 @@ static void Method(int a) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: System.Int32) (Syntax: 'a--') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'a--') IIncrementOrDecrementOperation (Postfix, Checked) (OperationKind.Decrement, Type: System.Int32) (Syntax: 'a--') Target: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs index 82b390a1cbff4..48b999434d663 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs @@ -1090,7 +1090,7 @@ private static void AssertTypeFromOperation(SemanticModel model, TypeSymbol expe return; } - Assert.Equal(expectedType, model.GetOperationInternal(decl)?.Type); + Assert.Equal(expectedType, model.GetOperation(decl)?.Type); } private static void VerifyDataFlow(SemanticModel model, DeclarationExpressionSyntax decl, bool isDelegateCreation, bool isExecutableCode, IdentifierNameSyntax[] references, ISymbol symbol) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs index ec362dc446a2c..ac5a04ca7ee8e 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs @@ -3598,6 +3598,7 @@ static void M(object o) ); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(13383, "https://github.com/dotnet/roslyn/issues/13383")] public void MethodGroupAsExpressionInIsPatternBrokenCode() { @@ -3613,7 +3614,7 @@ static void M(object o) } } }"; - CreateCompilationWithMscorlib45(source).VerifyDiagnostics( + var compilation = CreateCompilationWithMscorlib45(source).VerifyDiagnostics( // (7,29): error CS1525: Invalid expression term ')' // if (o.Equals is()) {} Diagnostic(ErrorCode.ERR_InvalidExprTerm, ")").WithArguments(")").WithLocation(7, 29), @@ -3627,6 +3628,27 @@ static void M(object o) // if (object.Equals is()) {} Diagnostic(ErrorCode.ERR_LambdaInIsAs, "object.Equals is()").WithLocation(8, 17) ); + + var tree = compilation.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("o.Equals is()", node.ToString()); + + compilation.VerifyOperationTree(node, expectedOperationTree: +@" +IIsPatternOperation (OperationKind.IsPattern, Type: System.Boolean, IsInvalid) (Syntax: 'o.Equals is()') + Expression: + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'o.Equals is()') + Children(1): + IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'o.Equals') + Children(1): + IParameterReferenceOperation: o (OperationKind.ParameterReference, Type: System.Object, IsInvalid) (Syntax: 'o') + Pattern: + IConstantPatternOperation (OperationKind.ConstantPattern, Type: null, IsInvalid) (Syntax: '()') + Value: + IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') + Children(0) +"); } [Fact, WorkItem(13383, "https://github.com/dotnet/roslyn/issues/13383")] diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs index 1f586848c3264..8b7a7a9084275 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs @@ -57,14 +57,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i') @@ -123,19 +123,19 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'select i') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Select(this System.Collections.Generic.IEnumerable source, System.Func selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'select i') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i') @@ -147,7 +147,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'q') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'q') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'q') @@ -204,14 +204,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i+1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i+1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i+1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i+1') @@ -272,14 +272,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i % 2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i % 2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i % 2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i % 2') @@ -356,12 +356,12 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int i in c') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -370,7 +370,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i') @@ -426,12 +426,12 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int i in c') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int i in c') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -440,7 +440,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i < 5') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i < 5') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i < 5') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i < 5') @@ -509,21 +509,21 @@ join x2 in c2 on x1 equals x2/10 Instance Receiver: null Arguments(5): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x1 in c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c2 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1') @@ -533,7 +533,7 @@ join x2 in c2 on x1 equals x2/10 IOperation: (OperationKind.None, Type: null) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x2/10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x2/10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x2/10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x2/10') @@ -547,7 +547,7 @@ join x2 in c2 on x1 equals x2/10 ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x1+x2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1+x2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x1+x2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1+x2') @@ -613,19 +613,19 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Linq.IOrderedEnumerable, IsImplicit) (Syntax: 'i/10 descending') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i/10 descending') IInvocationOperation (System.Linq.IOrderedEnumerable System.Linq.Enumerable.OrderByDescending(this System.Collections.Generic.IEnumerable source, System.Func keySelector)) (OperationKind.Invocation, Type: System.Linq.IOrderedEnumerable, IsImplicit) (Syntax: 'i/10 descending') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i/10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i/10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i/10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i/10') @@ -641,7 +641,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i%10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: keySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i%10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i%10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i%10') @@ -712,21 +712,21 @@ join x2 in c2 on x1 equals x2 / 10 into g Instance Receiver: null Arguments(5): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x1 in c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x1 in c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c2 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1') @@ -736,7 +736,7 @@ join x2 in c2 on x1 equals x2 / 10 into g IOperation: (OperationKind.None, Type: null) (Syntax: 'x1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x2 / 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x2 / 10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x2 / 10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x2 / 10') @@ -750,7 +750,7 @@ join x2 in c2 on x1 equals x2 / 10 into g ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 10) (Syntax: '10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, System.String>, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, System.String>, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x1 + "":"" + g.ToString()') @@ -823,14 +823,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from x in c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from x in c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c1 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c2') @@ -843,7 +843,7 @@ public static void Main(string[] args) ILocalReferenceOperation: c2 (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'x + y') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'x + y') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + y') @@ -929,22 +929,22 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'let z = g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = g + x*100') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> System.Linq.Enumerable.Select<, <>h__TransparentIdentifier0, System.Int32 z>>(this System.Collections.Generic.IEnumerable<> source, System.Func<, <>h__TransparentIdentifier0, System.Int32 z>> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'let z = g + x*100') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let g = x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x * 10') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.Select>(this System.Collections.Generic.IEnumerable source, System.Func> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'let g = x * 10') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int x in c1') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -953,7 +953,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x * 10') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'x * 10') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x * 10') @@ -962,11 +962,11 @@ public static void Main(string[] args) ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Int32 x, System.Int32 g)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'let g = x * 10') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'let g = x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x * 10') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'let g = x * 10') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'x * 10') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x * 10') IBinaryOperation (BinaryOperatorKind.Multiply) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x * 10') Left: IOperation: (OperationKind.None, Type: null) (Syntax: 'x') @@ -980,7 +980,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func<, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'g + x*100') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'g + x*100') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'g + x*100') @@ -989,11 +989,11 @@ public static void Main(string[] args) ReturnedValue: IObjectCreationOperation (Constructor: <>h__TransparentIdentifier0, System.Int32 z>..ctor( <>h__TransparentIdentifier0, System.Int32 z)) (OperationKind.ObjectCreation, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'let z = g + x*100') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: , IsImplicit) (Syntax: 'let z = g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let z = g + x*100') IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: , IsImplicit) (Syntax: 'let z = g + x*100') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'g + x*100') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'g + x*100') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'g + x*100') Left: IOperation: (OperationKind.None, Type: null) (Syntax: 'g') @@ -1011,7 +1011,7 @@ public static void Main(string[] args) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32>, IsImplicit) (Syntax: 'x + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, System.Int32>, IsImplicit) (Syntax: 'x + z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + z') @@ -1090,32 +1090,32 @@ from int z in c3 Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'where (x + ... / 100) < 6') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'where (x + ... / 100) < 6') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> System.Linq.Enumerable.Where< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>(this System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> source, System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean> predicate)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'where (x + ... / 100) < 6') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'let g = x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x + y + z') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> System.Linq.Enumerable.Select< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>(this System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> source, System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>> selector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'let g = x + y + z') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IInvocationOperation (System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>> System.Linq.Enumerable.SelectMany<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>(this System.Collections.Generic.IEnumerable<> source, System.Func<, System.Collections.Generic.IEnumerable> collectionSelector, System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>> resultSelector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable< <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.SelectMany>(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func> resultSelector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int x in c1') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1124,7 +1124,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c2') @@ -1135,7 +1135,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1144,7 +1144,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from int y in c2') @@ -1153,11 +1153,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'from int y in c2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: y (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1167,7 +1167,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c3') @@ -1178,7 +1178,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1187,7 +1187,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Int32, <>h__TransparentIdentifier0, System.Int32 z>>, IsImplicit) (Syntax: 'from int z in c3') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from int z in c3') @@ -1196,11 +1196,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: <>h__TransparentIdentifier0, System.Int32 z>..ctor( <>h__TransparentIdentifier0, System.Int32 z)) (OperationKind.ObjectCreation, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'from int z in c3') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: , IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier0) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: , IsImplicit) (Syntax: 'from int z in c3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int z in c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: z) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int z in c3') IParameterReferenceOperation: z (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int z in c3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1210,7 +1210,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y + z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z>, <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>>, IsImplicit) (Syntax: 'x + y + z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + y + z') @@ -1219,11 +1219,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>..ctor( <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g)) (OperationKind.ObjectCreation, Type: <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, IsImplicit) (Syntax: 'let g = x + y + z') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier1) (OperationKind.Argument, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'let g = x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: <>h__TransparentIdentifier1) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'let g = x + y + z') IParameterReferenceOperation: <>h__TransparentIdentifier1 (OperationKind.ParameterReference, Type: <>h__TransparentIdentifier0, System.Int32 z>, IsImplicit) (Syntax: 'let g = x + y + z') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: g) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y + z') IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y + z') Left: IBinaryOperation (BinaryOperatorKind.Add) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'x + y') @@ -1241,7 +1241,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean>, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: predicate) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Boolean>, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: '(x + y / 10 ... / 100) < 6') @@ -1273,7 +1273,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Int32>, IsImplicit) (Syntax: 'g') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'g') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< <>h__TransparentIdentifier0, System.Int32 z> <>h__TransparentIdentifier1, System.Int32 g>, System.Int32>, IsImplicit) (Syntax: 'g') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'g') @@ -1461,17 +1461,17 @@ from int z in c3 Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IInvocationOperation (System.Collections.Generic.IEnumerable<> System.Linq.Enumerable.SelectMany>(this System.Collections.Generic.IEnumerable source, System.Func> collectionSelector, System.Func> resultSelector)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable<>, IsImplicit) (Syntax: 'from int y in c2') Instance Receiver: null Arguments(3): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int x in c1') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Cast(this System.Collections.IEnumerable source)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from int x in c1') Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c1') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1480,7 +1480,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c2') @@ -1491,7 +1491,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c2') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1500,7 +1500,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'from int y in c2') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from int y in c2') @@ -1509,11 +1509,11 @@ from int z in c3 ReturnedValue: IObjectCreationOperation (Constructor: ..ctor(System.Int32 x, System.Int32 y)) (OperationKind.ObjectCreation, Type: , IsImplicit) (Syntax: 'from int y in c2') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from int y in c2') IParameterReferenceOperation: y (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from int y in c2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1523,7 +1523,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: collectionSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Collections.Generic.IEnumerable>, IsImplicit) (Syntax: 'c3') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'c3') @@ -1534,7 +1534,7 @@ from int z in c3 Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'c3') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c3') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1543,7 +1543,7 @@ from int z in c3 OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func<, System.Int32, System.Int32>, IsImplicit) (Syntax: 'x + y + z') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x + y + z') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func<, System.Int32, System.Int32>, IsImplicit) (Syntax: 'x + y + z') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x + y + z') @@ -1788,7 +1788,7 @@ static void Main(string[] args) Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'new int[] { 1 }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'new int[] { 1 }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'new int[] { 1 }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -1957,37 +1957,37 @@ join b in Enumerable.Range(1, 13) on 4 * a equals b Instance Receiver: null Arguments(5): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outer) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Range(System.Int32 start, System.Int32 count)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable) (Syntax: 'Enumerable.Range(1, 13)') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: System.Int32) (Syntax: '13') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: null) (Syntax: '13') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 13) (Syntax: '13') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: inner) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'Enumerable.Range(1, 13)') IInvocationOperation (System.Collections.Generic.IEnumerable System.Linq.Enumerable.Range(System.Int32 start, System.Int32 count)) (OperationKind.Invocation, Type: System.Collections.Generic.IEnumerable) (Syntax: 'Enumerable.Range(1, 13)') Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: System.Int32) (Syntax: '1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: start) (OperationKind.Argument, Type: null) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: System.Int32) (Syntax: '13') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: count) (OperationKind.Argument, Type: null) (Syntax: '13') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 13) (Syntax: '13') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: '4 * a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: outerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '4 * a') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: '4 * a') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: '4 * a') @@ -2001,7 +2001,7 @@ join b in Enumerable.Range(1, 13) on 4 * a equals b IOperation: (OperationKind.None, Type: null) (Syntax: 'a') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'b') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: innerKeySelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'b') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'b') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'b') @@ -2011,7 +2011,7 @@ join b in Enumerable.Range(1, 13) on 4 * a equals b IOperation: (OperationKind.None, Type: null) (Syntax: 'b') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'a') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: resultSelector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'a') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'a') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'a') @@ -2707,7 +2707,7 @@ static void Main() Instance Receiver: null Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.IEnumerable, IsInvalid, IsImplicit) (Syntax: 'string.Empty') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: 'string.Empty') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsInvalid, IsImplicit) (Syntax: 'string.Empty') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -3537,7 +3537,7 @@ where x.ToString() == y.ToString() Instance Receiver: ILocalReferenceOperation: q (OperationKind.LocalReference, Type: Q) (Syntax: 'q') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: System.Func>, IsImplicit) (Syntax: 'q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'q') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsImplicit) (Syntax: 'q') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'q') @@ -3547,7 +3547,7 @@ where x.ToString() == y.ToString() ILocalReferenceOperation: q (OperationKind.LocalReference, Type: Q) (Syntax: 'q') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f2) (OperationKind.Argument, Type: System.Func, y>>, IsImplicit) (Syntax: 'from y in q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f2) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from y in q') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, y>>, IsImplicit) (Syntax: 'from y in q') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'from y in q') @@ -3556,11 +3556,11 @@ where x.ToString() == y.ToString() ReturnedValue: IObjectCreationOperation (Constructor: y>..ctor(System.Int32 x, Q y)) (OperationKind.ObjectCreation, Type: y>, IsImplicit) (Syntax: 'from y in q') Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: System.Int32, IsImplicit) (Syntax: 'from y in q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from y in q') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsImplicit) (Syntax: 'from y in q') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: Q, IsImplicit) (Syntax: 'from y in q') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: y) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from y in q') IParameterReferenceOperation: y (OperationKind.ParameterReference, Type: Q, IsImplicit) (Syntax: 'from y in q') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -3569,7 +3569,7 @@ where x.ToString() == y.ToString() InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: System.Func< y>, System.Boolean>, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: f1) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func< y>, System.Boolean>, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'x.ToString( ... .ToString()') @@ -4056,7 +4056,7 @@ static void Main() Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from a in new[] { 1 }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from a in new[] { 1 }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from a in new[] { 1 }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: @@ -4069,7 +4069,7 @@ Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func>, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func>, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsInvalid, IsImplicit) (Syntax: '(Func)(a => 1)') @@ -4119,14 +4119,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i + 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i + 1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i + 1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i + 1') @@ -4171,14 +4171,14 @@ public static void Main(string[] args) Instance Receiver: null Arguments(2): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: source) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'from i in c') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.Generic.IEnumerable, IsImplicit) (Syntax: 'from i in c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: ILocalReferenceOperation: c (OperationKind.LocalReference, Type: System.Collections.Generic.List) (Syntax: 'c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: System.Func, IsImplicit) (Syntax: 'i + 1') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: selector) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: 'i + 1') IDelegateCreationOperation (OperationKind.DelegateCreation, Type: System.Func, IsImplicit) (Syntax: 'i + 1') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null, IsImplicit) (Syntax: 'i + 1') diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs index fe49e619a7222..4734ae91a9ed4 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs @@ -6872,6 +6872,7 @@ public static void Main() new ErrorDescription[] { new ErrorDescription { Code = (int)ErrorCode.ERR_PtrExpected, Line = 15, Column = 7 } }); } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] public void CS0196ERR_PtrIndexSingle() { @@ -6887,10 +6888,27 @@ public static void Main () // j = i[1]; } }"; - CreateStandardCompilation(text, options: TestOptions.UnsafeReleaseDll).VerifyDiagnostics( + var compilation = CreateStandardCompilation(text, options: TestOptions.UnsafeReleaseDll).VerifyDiagnostics( // (8,11): error CS0196: A pointer must be indexed by only one value // j = i[1,2]; // CS0196 Diagnostic(ErrorCode.ERR_PtrIndexSingle, "i[1,2]")); + + + var tree = compilation.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("i[1,2]", node.ToString()); + + compilation.VerifyOperationTree(node, expectedOperationTree: +@" +IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'i[1,2]') + Children(2): + ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32*, IsInvalid) (Syntax: 'i') + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid, IsImplicit) (Syntax: 'i[1,2]') + Children(2): + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsInvalid) (Syntax: '2') +"); } [Fact] @@ -12484,6 +12502,8 @@ static void M(I i) } [Fact] + [CompilerTrait(CompilerFeature.IOperation)] + [WorkItem(23004, "https://github.com/dotnet/roslyn/issues/23004")] public void CS0856ERR_IndexedPropertyRequiresParams01() { var source1 = @@ -12522,6 +12542,19 @@ static void M(I i) Diagnostic(ErrorCode.ERR_IndexedPropertyRequiresParams, "i.R").WithArguments("I.R").WithLocation(8, 9), // (9,9): error CS7036: There is no argument given that corresponds to the required formal parameter 'y' of 'I.R[int, int, int]' Diagnostic(ErrorCode.ERR_NoCorrespondingArgument, "i.R[1]").WithArguments("y", "I.R[int, int, int]").WithLocation(9, 9)); + + var tree = compilation2.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + + Assert.Equal("i.R[1]", node.ToString()); + + compilation2.VerifyOperationTree(node, expectedOperationTree: +@" +IInvalidOperation (OperationKind.Invalid, Type: System.Object, IsInvalid) (Syntax: 'i.R[1]') + Children(2): + IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: I, IsInvalid) (Syntax: 'i') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') +"); } [Fact] @@ -22918,6 +22951,8 @@ static void Main(string[] args) [Fact] + [CompilerTrait(CompilerFeature.IOperation)] + [WorkItem(23009, "https://github.com/dotnet/roslyn/issues/23009")] public void ConditionalElementAccess001() { var text = @" @@ -22947,7 +22982,7 @@ static void Main(string[] args) } } "; - CreateCompilationWithMscorlib45(text).VerifyDiagnostics( + var compilation = CreateCompilationWithMscorlib45(text).VerifyDiagnostics( // (11,18): error CS0175: Use of keyword 'base' is not valid in this context // var x6 = base?.ToString(); Diagnostic(ErrorCode.ERR_BaseIllegal, "base").WithLocation(11, 18), @@ -22970,8 +23005,23 @@ static void Main(string[] args) // var x5 = null?.ToString(); Diagnostic(ErrorCode.ERR_BadUnaryOp, "?").WithArguments("?", "").WithLocation(24, 22) ); - } + var tree = compilation.SyntaxTrees.Single(); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("base?.ToString()", node.ToString()); + + compilation.VerifyOperationTree(node, expectedOperationTree: +@" +IConditionalAccessOperation (OperationKind.ConditionalAccess, Type: ?, IsInvalid) (Syntax: 'base?.ToString()') + Operation: + IInstanceReferenceOperation (OperationKind.InstanceReference, Type: System.Object, IsInvalid) (Syntax: 'base') + WhenNotNull: + IInvocationOperation (virtual System.String System.Object.ToString()) (OperationKind.Invocation, Type: System.String) (Syntax: '.ToString()') + Instance Receiver: + IConditionalAccessInstanceOperation (OperationKind.ConditionalAccessInstance, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'base') + Arguments(0) +"); + } [Fact] [WorkItem(976765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/976765")] diff --git a/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs b/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs index db5e8d6da25cc..98b8e8429bcac 100644 --- a/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs @@ -5965,5 +5965,130 @@ async unsafe Task Local(in int* x, out char? c) SymbolDisplayPartKind.ParameterName, // c SymbolDisplayPartKind.Punctuation); // ) } + + [Fact] + public void LocalVariable_01() + { + var srcTree = SyntaxFactory.ParseSyntaxTree(@" +class C +{ + void M() + { + int x = 0; + x++; + } +}"); + var root = srcTree.GetRoot(); + var comp = CreateStandardCompilation(srcTree); + + var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single()); + var declarator = root.DescendantNodes().OfType().Single(); + var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat.AddLocalOptions(SymbolDisplayLocalOptions.IncludeRef)), + "int x", + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Assert.False(local.IsRef); + Assert.Equal(RefKind.None, local.RefKind); + } + + [Fact] + public void LocalVariable_02() + { + var srcTree = SyntaxFactory.ParseSyntaxTree(@" +class C +{ + void M(int y) + { + ref int x = y; + x++; + } +}"); + var root = srcTree.GetRoot(); + var comp = CreateStandardCompilation(srcTree); + + var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single()); + var declarator = root.DescendantNodes().OfType().Single(); + var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat.AddLocalOptions(SymbolDisplayLocalOptions.IncludeRef)), + "ref int x", + SymbolDisplayPartKind.Keyword, //ref + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat), + "int x", + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Assert.True(local.IsRef); + Assert.Equal(RefKind.Ref, local.RefKind); + } + + [Fact] + public void LocalVariable_03() + { + var srcTree = SyntaxFactory.ParseSyntaxTree(@" +class C +{ + void M(int y) + { + ref readonly int x = y; + x++; + } +}"); + var root = srcTree.GetRoot(); + var comp = CreateStandardCompilation(srcTree); + + var semanticModel = comp.GetSemanticModel(comp.SyntaxTrees.Single()); + var declarator = root.DescendantNodes().OfType().Single(); + var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat.AddLocalOptions(SymbolDisplayLocalOptions.IncludeRef)), + "ref readonly int x", + SymbolDisplayPartKind.Keyword, //ref + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.Keyword, //readonly + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Verify( + local.ToMinimalDisplayParts( + semanticModel, + declarator.SpanStart, + SymbolDisplayFormat.MinimallyQualifiedFormat), + "int x", + SymbolDisplayPartKind.Keyword, //int + SymbolDisplayPartKind.Space, + SymbolDisplayPartKind.LocalName); // x + + Assert.True(local.IsRef); + Assert.Equal(RefKind.RefReadOnly, local.RefKind); + } } } diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs index 5be6c22f5293b..f49d214317d79 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs @@ -582,7 +582,7 @@ static void Test1(int x) Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') Arguments(1): - IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: System.Object) (Syntax: 'new { }') + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'new { }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new { }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs index 552d72c29af5c..5c17f8ed8e1b5 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ParsingTests.cs @@ -49,9 +49,6 @@ public static void ParseAndValidateFirst(string text, DiagnosticDescription expe public CompilationUnitSyntax ParseFile(string text, CSharpParseOptions parseOptions = null) => SyntaxFactory.ParseCompilationUnit(text, options: parseOptions); - internal CompilationUnitSyntax ParseFileExperimental(string text, MessageID feature) => - ParseFile(text, parseOptions: TestOptions.Regular.WithExperimental(feature)); - protected virtual CSharpSyntaxNode ParseNode(string text, CSharpParseOptions options) => ParseTree(text, options).GetCompilationUnitRoot(); diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs index a269db33fafcb..02d9b7fb9ee1d 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs @@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class CodeAnalysisResources { @@ -838,15 +838,6 @@ internal static string InvalidTree { } } - /// - /// Looks up a localized string similar to Feature 'IOperation' is disabled.. - /// - internal static string IOperationFeatureDisabled { - get { - return ResourceManager.GetString("IOperationFeatureDisabled", resourceCulture); - } - } - /// /// Looks up a localized string similar to Argument to '/keepalive' option is not a 32-bit integer.. /// diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.resx b/src/Compilers/Core/Portable/CodeAnalysisResources.resx index d53562649f721..5bdc66e9a3a13 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.resx +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.resx @@ -579,9 +579,6 @@ The underlying type for a tuple must be tuple-compatible. - - Feature 'IOperation' is disabled. - Unrecognized resource file format. diff --git a/src/Compilers/Core/Portable/Compilation/Compilation.cs b/src/Compilers/Core/Portable/Compilation/Compilation.cs index 8e4765099fc59..6aea4a713b8c7 100644 --- a/src/Compilers/Core/Portable/Compilation/Compilation.cs +++ b/src/Compilers/Core/Portable/Compilation/Compilation.cs @@ -2933,8 +2933,6 @@ internal bool IsTypeMissing(WellKnownType type) { return _lazyMakeWellKnownTypeMissingMap != null && _lazyMakeWellKnownTypeMissingMap.ContainsKey((int)type); } - - internal abstract bool IsIOperationFeatureEnabled(); /// /// Given a reporting unreferenced s, returns diff --git a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs index f556338ee40b1..049d504b3d1bc 100644 --- a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs +++ b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs @@ -70,16 +70,6 @@ public SyntaxTree SyntaxTree /// An optional cancellation token. /// public IOperation GetOperation(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) - { - if (!this.Compilation.IsIOperationFeatureEnabled()) - { - throw new InvalidOperationException(CodeAnalysisResources.IOperationFeatureDisabled); - } - - return GetOperationInternal(node, cancellationToken); - } - - internal IOperation GetOperationInternal(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) { try { @@ -88,7 +78,7 @@ public SyntaxTree SyntaxTree catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) { // Log a Non-fatal-watson and then ignore the crash in the attempt of getting operation - Debug.Assert(false); + Debug.Assert(false, e.ToString()); } return null; diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs index 370f6747e3da0..233877a8b6f8d 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs @@ -2058,7 +2058,7 @@ private static ImmutableArray GetOperationBlocksToAnalyze( foreach (SyntaxNode executableBlock in executableBlocks) { - IOperation operation = semanticModel.GetOperationInternal(executableBlock, cancellationToken); + IOperation operation = semanticModel.GetOperation(executableBlock, cancellationToken); if (operation != null) { operationBlocksToAnalyze.AddRange(operation); diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs index f21f9c4a2abd1..5aadc10391970 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs @@ -202,7 +202,7 @@ public AnalyzerExecutor WithCancellationToken(CancellationToken cancellationToke /// public void ExecuteInitializeMethod(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope sessionScope) { - var context = new AnalyzerAnalysisContext(analyzer, sessionScope, _compilation.IsIOperationFeatureEnabled()); + var context = new AnalyzerAnalysisContext(analyzer, sessionScope); // The Initialize method should be run asynchronously in case it is not well behaved, e.g. does not terminate. ExecuteAndCatchIfThrows( diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs index 44f6c6b17d675..e79425fa0a9fe 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs @@ -139,11 +139,6 @@ public virtual void RegisterOperationBlockStartAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body. /// An operation block action reports s about operation blocks. @@ -154,11 +149,6 @@ public virtual void RegisterOperationBlockAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed at completion of semantic analysis of an with an appropriate Kind. /// An operation action can report s about s, and can also collect @@ -171,11 +161,6 @@ public void RegisterOperationAction(Action action, par this.RegisterOperationAction(action, operationKinds.AsImmutableOrEmpty()); } - internal void RegisterOperationActionParamsArrayInternal(Action action, params OperationKind[] operationKinds) - { - this.RegisterOperationActionImmutableArrayInternal(action, operationKinds.AsImmutableOrEmpty()); - } - /// /// Register an action to be executed at completion of semantic analysis of an with an appropriate Kind. /// An operation action can report s about s, and can also collect @@ -188,11 +173,6 @@ public virtual void RegisterOperationAction(Action act throw new NotImplementedException(); } - internal virtual void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) - { - throw new NotImplementedException(); - } - /// /// Enable concurrent execution of analyzer actions registered by this analyzer. /// An analyzer that registers for concurrent execution can have better performance than a non-concurrent analyzer. @@ -383,11 +363,6 @@ public virtual void RegisterOperationBlockStartAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed after semantic analysis of a method body or an expression appearing outside a method body. /// An operation block action reports s about operation blocks. @@ -398,11 +373,6 @@ public virtual void RegisterOperationBlockAction(Action action) - { - throw new NotImplementedException(); - } - /// /// Register an action to be executed at completion of parsing of a code document. /// A syntax tree action reports s about the of a document. @@ -445,11 +415,6 @@ public void RegisterOperationAction(Action action, par this.RegisterOperationAction(action, operationKinds.AsImmutableOrEmpty()); } - internal void RegisterOperationActionParamsArrayInternal(Action action, params OperationKind[] operationKinds) - { - this.RegisterOperationActionImmutableArrayInternal(action, operationKinds.AsImmutableOrEmpty()); - } - /// /// Register an action to be executed at completion of semantic analysis of an with an appropriate Kind. /// An operation action can report s about s, and can also collect @@ -462,11 +427,6 @@ public virtual void RegisterOperationAction(Action act throw new NotImplementedException(); } - internal virtual void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) - { - throw new NotImplementedException(); - } - /// /// Attempts to compute or get the cached value provided by the given for the given . /// Note that the pair {, } acts as the key. diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs index 58cf39ca3a59b..194277a4b3407 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs @@ -74,14 +74,6 @@ internal static void VerifyDiagnosticLocationsInCompilation(Diagnostic diagnosti } } - internal static void VerifyIOperationFeatureFlag(bool isIOperationFeatureEnabled) - { - if (!isIOperationFeatureEnabled) - { - throw new InvalidOperationException(CodeAnalysisResources.IOperationFeatureDisabled); - } - } - private static void VerifyDiagnosticLocationInCompilation(string id, Location location, Compilation compilation) { if (!location.IsInSource) diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs index fdbf1917ce182..17ed346982c67 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs @@ -17,14 +17,11 @@ internal sealed class AnalyzerAnalysisContext : AnalysisContext { private readonly DiagnosticAnalyzer _analyzer; private readonly HostSessionStartAnalysisScope _scope; - - private readonly bool _isIOperationFeatureEnabled; - public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope, bool isIOperationFeatureEnabled = false) + public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope) { _analyzer = analyzer; _scope = scope; - _isIOperationFeatureEnabled = isIOperationFeatureEnabled; } public override void RegisterCompilationStartAction(Action action) @@ -76,36 +73,18 @@ public override void RegisterSyntaxNodeAction(Action action, ImmutableArray operationKinds) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationActionImmutableArrayInternal(action, operationKinds); - } - - internal override void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) { DiagnosticAnalysisContextHelpers.VerifyArguments(action, operationKinds); _scope.RegisterOperationAction(_analyzer, action, operationKinds); } public override void RegisterOperationBlockStartAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockStartActionInternal(action); - } - - internal override void RegisterOperationBlockStartActionInternal(Action action) { DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockStartAction(_analyzer, action); } public override void RegisterOperationBlockAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockActionInternal(action); - } - - internal override void RegisterOperationBlockActionInternal(Action action) { DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockAction(_analyzer, action); @@ -130,8 +109,6 @@ internal sealed class AnalyzerCompilationStartAnalysisContext : CompilationStart private readonly DiagnosticAnalyzer _analyzer; private readonly HostCompilationStartAnalysisScope _scope; private readonly CompilationAnalysisValueProviderFactory _compilationAnalysisValueProviderFactory; - - private readonly bool _isIOperationFeatureEnabled; public AnalyzerCompilationStartAnalysisContext( DiagnosticAnalyzer analyzer, @@ -145,7 +122,6 @@ public AnalyzerCompilationStartAnalysisContext( _analyzer = analyzer; _scope = scope; _compilationAnalysisValueProviderFactory = compilationAnalysisValueProviderFactory; - _isIOperationFeatureEnabled = compilation.IsIOperationFeatureEnabled(); } public override void RegisterCompilationEndAction(Action action) @@ -184,35 +160,17 @@ public override void RegisterSyntaxNodeAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockStartActionInternal(action); - } - - internal override void RegisterOperationBlockStartActionInternal(Action action) { _scope.RegisterOperationBlockStartAction(_analyzer, action); } public override void RegisterOperationBlockAction(Action action) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationBlockActionInternal(action); - } - - internal override void RegisterOperationBlockActionInternal(Action action) { DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockAction(_analyzer, action); } public override void RegisterOperationAction(Action action, ImmutableArray operationKinds) - { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); - RegisterOperationActionImmutableArrayInternal(action, operationKinds); - } - - internal override void RegisterOperationActionImmutableArrayInternal(Action action, ImmutableArray operationKinds) { _scope.RegisterOperationAction(_analyzer, action, operationKinds); } diff --git a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs index 6caeae24de2a6..e389762e8ee5a 100644 --- a/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs +++ b/src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs @@ -201,8 +201,8 @@ public LazyThrowExpression(Lazy expression, SemanticModel semanticMo /// internal abstract partial class BaseArgument : Operation, IArgumentOperation { - protected BaseArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(OperationKind.Argument, semanticModel, syntax, type, constantValue, isImplicit) + protected BaseArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(OperationKind.Argument, semanticModel, syntax, type: null, constantValue: constantValue, isImplicit: isImplicit) { ArgumentKind = argumentKind; Parameter = parameter; @@ -412,8 +412,8 @@ public LazyArrayElementReferenceExpression(Lazy arrayReference, Lazy /// internal abstract partial class BaseArrayInitializer : Operation, IArrayInitializerOperation { - protected BaseArrayInitializer(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(OperationKind.ArrayInitializer, semanticModel, syntax, type, constantValue, isImplicit) + protected BaseArrayInitializer(SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(OperationKind.ArrayInitializer, semanticModel, syntax, type: null, constantValue: constantValue, isImplicit: isImplicit) { } @@ -450,8 +450,8 @@ public override TResult Accept(OperationVisitor internal sealed partial class ArrayInitializer : BaseArrayInitializer, IArrayInitializerOperation { - public ArrayInitializer(ImmutableArray elementValues, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public ArrayInitializer(ImmutableArray elementValues, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : + base(semanticModel, syntax, constantValue, isImplicit) { ElementValuesImpl = elementValues; } @@ -466,7 +466,7 @@ internal sealed partial class LazyArrayInitializer : BaseArrayInitializer, IArra { private readonly Lazy> _lazyElementValues; - public LazyArrayInitializer(Lazy> elementValues, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, type, constantValue, isImplicit) + public LazyArrayInitializer(Lazy> elementValues, SemanticModel semanticModel, SyntaxNode syntax, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, constantValue, isImplicit) { _lazyElementValues = elementValues; } @@ -514,9 +514,10 @@ public sealed override IEnumerable Children /// internal abstract partial class BaseSimpleAssignmentExpression : AssignmentExpression, ISimpleAssignmentOperation { - public BaseSimpleAssignmentExpression(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + public BaseSimpleAssignmentExpression(bool isRef, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(OperationKind.SimpleAssignment, semanticModel, syntax, type, constantValue, isImplicit) { + IsRef = isRef; } public override void Accept(OperationVisitor visitor) { @@ -526,6 +527,11 @@ public override TResult Accept(OperationVisitor + /// Is this a ref assignment + /// + public bool IsRef { get; } } /// @@ -533,8 +539,8 @@ public override TResult Accept(OperationVisitor internal sealed partial class SimpleAssignmentExpression : BaseSimpleAssignmentExpression, ISimpleAssignmentOperation { - public SimpleAssignmentExpression(IOperation target, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public SimpleAssignmentExpression(IOperation target, bool isRef, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { TargetImpl = target; ValueImpl = value; @@ -551,8 +557,8 @@ internal sealed partial class LazySimpleAssignmentExpression : BaseSimpleAssignm private readonly Lazy _lazyTarget; private readonly Lazy _lazyValue; - public LazySimpleAssignmentExpression(Lazy target, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public LazySimpleAssignmentExpression(Lazy target, bool isRef, Lazy value, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { _lazyTarget = target ?? throw new System.ArgumentNullException(nameof(target)); _lazyValue = value ?? throw new System.ArgumentNullException(nameof(value)); @@ -1279,9 +1285,10 @@ public override TResult Accept(OperationVisitor internal abstract partial class BaseConditionalOperation : Operation, IConditionalOperation { - protected BaseConditionalOperation(SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + protected BaseConditionalOperation(bool isRef, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(OperationKind.Conditional, semanticModel, syntax, type, constantValue, isImplicit) { + IsRef = isRef; } protected abstract IOperation ConditionImpl { get; } protected abstract IOperation WhenTrueImpl { get; } @@ -1324,6 +1331,11 @@ public override TResult Accept(OperationVisitor + /// Is result a managed reference + /// + public bool IsRef { get; } } /// @@ -1336,8 +1348,10 @@ public override TResult Accept(OperationVisitor internal sealed partial class ConditionalOperation : BaseConditionalOperation, IConditionalOperation { - public ConditionalOperation(IOperation condition, IOperation whenTrue, IOperation whenFalse, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(semanticModel, syntax, type, constantValue, isImplicit) + public ConditionalOperation( + IOperation condition, IOperation whenTrue, IOperation whenFalse, bool isRef, + SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { ConditionImpl = condition; WhenTrueImpl = whenTrue; @@ -1363,8 +1377,10 @@ internal sealed partial class LazyConditionalOperation : BaseConditionalOperatio private readonly Lazy _lazyWhenTrue; private readonly Lazy _lazyWhenFalse; - public LazyConditionalOperation(Lazy condition, Lazy whenTrue, Lazy whenFalse, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) - : base(semanticModel, syntax, type, constantValue, isImplicit) + public LazyConditionalOperation( + Lazy condition, Lazy whenTrue, Lazy whenFalse, bool isRef, + SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) + : base(isRef, semanticModel, syntax, type, constantValue, isImplicit) { _lazyCondition = condition ?? throw new System.ArgumentNullException(nameof(condition)); _lazyWhenTrue = whenTrue ?? throw new System.ArgumentNullException(nameof(whenTrue)); @@ -5635,28 +5651,28 @@ public LazyVariableDeclarationGroupOperation(Lazy - /// Represents a C# 'do while' or VB 'Do While' or 'Do Until' loop statement. + /// Represents a while or do while loop. + /// + /// Current usage: + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. + /// /// - internal abstract partial class BaseDoLoopStatement : LoopStatement, IDoLoopOperation + internal abstract partial class BaseWhileLoopStatement : LoopStatement, IWhileLoopOperation { - public BaseDoLoopStatement(DoLoopKind doLoopKind, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(LoopKind.Do, locals, OperationKind.Loop, semanticModel, syntax, type, constantValue, isImplicit) + public BaseWhileLoopStatement(ImmutableArray locals, bool conditionIsTop, bool conditionIsUntil, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(LoopKind.While, locals, OperationKind.Loop, semanticModel, syntax, type, constantValue, isImplicit) { - DoLoopKind = doLoopKind; + ConditionIsTop = conditionIsTop; + ConditionIsUntil = conditionIsUntil; } - /// - /// Represents kind of do loop operation. - /// - public DoLoopKind DoLoopKind { get; } protected abstract IOperation ConditionImpl { get; } protected abstract IOperation IgnoredConditionImpl { get; } public override IEnumerable Children { get { - if (DoLoopKind == DoLoopKind.DoWhileTopLoop || - DoLoopKind == DoLoopKind.DoUntilTopLoop || - DoLoopKind == DoLoopKind.None) + if (ConditionIsTop) { if (Condition != null) { @@ -5667,8 +5683,7 @@ public override IEnumerable Children { yield return Body; } - if (DoLoopKind == DoLoopKind.DoWhileBottomLoop || - DoLoopKind == DoLoopKind.DoUntilBottomLoop) + if (!ConditionIsTop) { if (Condition != null) { @@ -5686,88 +5701,24 @@ public override IEnumerable Children /// public IOperation Condition => Operation.SetParentOperation(ConditionImpl, this); /// - /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. - /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. - /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. - /// This property should be null for all non-error cases. + /// True if the is evaluated at start of each loop iteration. + /// False if it is evaluated at the end of each loop iteration. /// - public IOperation IgnoredCondition => Operation.SetParentOperation(IgnoredConditionImpl, this); - public override void Accept(OperationVisitor visitor) - { - visitor.VisitDoLoop(this); - } - public override TResult Accept(OperationVisitor visitor, TArgument argument) - { - return visitor.VisitDoLoop(this, argument); - } - } - /// - /// Represents a C# 'do while' or VB 'Do While' or 'Do Until' loop statement. - /// - internal sealed partial class DoLoopStatement : BaseDoLoopStatement, IDoLoopOperation - { - public DoLoopStatement(DoLoopKind doLoopKind, IOperation condition, IOperation body, IOperation ignoredConditionOpt, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(doLoopKind, locals, semanticModel, syntax, type, constantValue, isImplicit) - { - ConditionImpl = condition; - BodyImpl = body; - IgnoredConditionImpl = ignoredConditionOpt; - } - protected override IOperation ConditionImpl { get; } - protected override IOperation BodyImpl { get; } - protected override IOperation IgnoredConditionImpl { get; } - } + public bool ConditionIsTop { get; } - /// - /// Represents a C# 'do while' or VB 'Do While' or 'Do Until' loop statement. - /// - internal sealed partial class LazyDoLoopStatement : BaseDoLoopStatement, IDoLoopOperation - { - private readonly Lazy _lazyCondition; - private readonly Lazy _lazyBody; - private readonly Lazy _lazyIgnoredCondition; - - public LazyDoLoopStatement(DoLoopKind doLoopKind, Lazy condition, Lazy body, Lazy ignoredCondition, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(doLoopKind, locals, semanticModel, syntax, type, constantValue, isImplicit) - { - _lazyCondition = condition ?? throw new System.ArgumentNullException(nameof(condition)); - _lazyBody = body ?? throw new System.ArgumentNullException(nameof(body)); - _lazyIgnoredCondition = ignoredCondition ?? throw new System.ArgumentNullException(nameof(ignoredCondition)); - } - protected override IOperation ConditionImpl => _lazyCondition.Value; - protected override IOperation BodyImpl => _lazyBody.Value; - protected override IOperation IgnoredConditionImpl => _lazyIgnoredCondition.Value; - } + /// + /// True if the loop has 'Until' loop semantics and the loop is executed while is false. + /// - /// - /// Represents a C# 'while' or a VB 'While' loop statement. - /// - internal abstract partial class BaseWhileLoopStatement : LoopStatement, IWhileLoopOperation - { - public BaseWhileLoopStatement(ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(LoopKind.While, locals, OperationKind.Loop, semanticModel, syntax, type, constantValue, isImplicit) - { - } - protected abstract IOperation ConditionImpl { get; } - public override IEnumerable Children - { - get - { - if (Condition != null) - { - yield return Condition; - } - if (Body != null) - { - yield return Body; - } - } - } + public bool ConditionIsUntil { get; } /// - /// Condition of the loop. + /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. + /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. + /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. + /// This property should be null for all non-error cases. /// - public IOperation Condition => Operation.SetParentOperation(ConditionImpl, this); + public IOperation IgnoredCondition => Operation.SetParentOperation(IgnoredConditionImpl, this); public override void Accept(OperationVisitor visitor) { visitor.VisitWhileLoop(this); @@ -5779,36 +5730,51 @@ public override TResult Accept(OperationVisitor - /// Represents a C# 'while' or a VB 'While' loop statement. + /// Represents a while or do while loop. + /// + /// Current usage: + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. + /// /// internal sealed partial class WhileLoopStatement : BaseWhileLoopStatement, IWhileLoopOperation { - public WhileLoopStatement(IOperation condition, IOperation body, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(locals, semanticModel, syntax, type, constantValue, isImplicit) + public WhileLoopStatement(IOperation condition, IOperation body, IOperation ignoredCondition, ImmutableArray locals, bool conditionIsTop, bool conditionIsUntil, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(locals, conditionIsTop, conditionIsUntil, semanticModel, syntax, type, constantValue, isImplicit) { ConditionImpl = condition; BodyImpl = body; + IgnoredConditionImpl = ignoredCondition; } protected override IOperation ConditionImpl { get; } protected override IOperation BodyImpl { get; } + protected override IOperation IgnoredConditionImpl { get; } } /// - /// Represents a C# 'while' or a VB 'While' loop statement. + /// Represents a while or do while loop. + /// + /// Current usage: + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. + /// /// internal sealed partial class LazyWhileLoopStatement : BaseWhileLoopStatement, IWhileLoopOperation { private readonly Lazy _lazyCondition; private readonly Lazy _lazyBody; + private readonly Lazy _lazyIgnoredCondition; - public LazyWhileLoopStatement(Lazy condition, Lazy body, ImmutableArray locals, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : - base(locals, semanticModel, syntax, type, constantValue, isImplicit) + public LazyWhileLoopStatement(Lazy condition, Lazy body, Lazy ignoredCondition, ImmutableArray locals, bool conditionIsTop, bool conditionIsUntil, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + base(locals, conditionIsTop, conditionIsUntil, semanticModel, syntax, type, constantValue, isImplicit) { _lazyCondition = condition ?? throw new System.ArgumentNullException(nameof(condition)); _lazyBody = body ?? throw new System.ArgumentNullException(nameof(body)); + _lazyIgnoredCondition = ignoredCondition ?? throw new System.ArgumentNullException(nameof(ignoredCondition)); } protected override IOperation ConditionImpl => _lazyCondition.Value; protected override IOperation BodyImpl => _lazyBody.Value; + protected override IOperation IgnoredConditionImpl => _lazyIgnoredCondition.Value; } /// @@ -6299,7 +6265,7 @@ protected BaseMemberInitializerExpression(SemanticModel semanticModel, SyntaxNod { } - protected abstract IMemberReferenceOperation InitializedMemberImpl { get; } + protected abstract IOperation InitializedMemberImpl { get; } protected abstract IObjectOrCollectionInitializerOperation InitializerImpl { get; } public override IEnumerable Children { @@ -6318,7 +6284,7 @@ public override IEnumerable Children /// /// Initialized member. /// - public IMemberReferenceOperation InitializedMember => Operation.SetParentOperation(InitializedMemberImpl, this); + public IOperation InitializedMember => Operation.SetParentOperation(InitializedMemberImpl, this); /// /// Member initializer. @@ -6339,14 +6305,14 @@ public override TResult Accept(OperationVisitor internal sealed partial class MemberInitializerExpression : BaseMemberInitializerExpression, IMemberInitializerOperation { - public MemberInitializerExpression(IMemberReferenceOperation initializedMember, IObjectOrCollectionInitializerOperation initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + public MemberInitializerExpression(IOperation initializedMember, IObjectOrCollectionInitializerOperation initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, type, constantValue, isImplicit) { InitializedMemberImpl = initializedMember; InitializerImpl = initializer; } - protected override IMemberReferenceOperation InitializedMemberImpl { get; } + protected override IOperation InitializedMemberImpl { get; } protected override IObjectOrCollectionInitializerOperation InitializerImpl { get; } } @@ -6355,17 +6321,17 @@ public MemberInitializerExpression(IMemberReferenceOperation initializedMember, /// internal sealed partial class LazyMemberInitializerExpression : BaseMemberInitializerExpression, IMemberInitializerOperation { - private readonly Lazy _lazyInitializedMember; + private readonly Lazy _lazyInitializedMember; private readonly Lazy _lazyInitializer; - public LazyMemberInitializerExpression(Lazy initializedMember, Lazy initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : + public LazyMemberInitializerExpression(Lazy initializedMember, Lazy initializer, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional constantValue, bool isImplicit) : base(semanticModel, syntax, type, constantValue, isImplicit) { _lazyInitializedMember = initializedMember ?? throw new System.ArgumentNullException(nameof(initializedMember)); _lazyInitializer = initializer ?? throw new System.ArgumentNullException(nameof(initializer)); } - protected override IMemberReferenceOperation InitializedMemberImpl => _lazyInitializedMember.Value; + protected override IOperation InitializedMemberImpl => _lazyInitializedMember.Value; protected override IObjectOrCollectionInitializerOperation InitializerImpl => _lazyInitializer.Value; } diff --git a/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs b/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs index 7fa07e9fb4833..7df2f4130b951 100644 --- a/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IConditionalOperation.cs @@ -31,6 +31,11 @@ public interface IConditionalOperation : IOperation /// Operation to be executed if the is false. /// IOperation WhenFalse { get; } + + /// + /// Is result a managed reference + /// + bool IsRef { get; } } } diff --git a/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs b/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs index 3787cddcb6239..5c95b56a50ac8 100644 --- a/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IMemberInitializerOperation.cs @@ -3,11 +3,10 @@ namespace Microsoft.CodeAnalysis.Operations { /// - /// Represents an initialization of member within an object initializer. + /// Represents an initialization of member within an object initializer with a nested object or collection initializer. /// /// Current usage: - /// (1) C# member initializer expression. - /// (2) VB member initializer expression. + /// (1) C# nested member initializer expression. /// For example, given an object creation with initializer "new Class() { X = x, Y = { x, y, 3 }, Z = { X = z } }", /// member initializers for Y and Z, i.e. "Y = { x, y, 3 }", and "Z = { X = z }" are nested member initializers represented by this operation. /// @@ -19,9 +18,9 @@ namespace Microsoft.CodeAnalysis.Operations public interface IMemberInitializerOperation : IOperation { /// - /// Initialized member. + /// Initialized member reference or an invalid operation for error cases. /// - IMemberReferenceOperation InitializedMember { get; } + IOperation InitializedMember { get; } /// /// Member initializer. diff --git a/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs b/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs index 3532f4410edb4..b0f99d8a5eaa3 100644 --- a/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs +++ b/src/Compilers/Core/Portable/Operations/ISimpleAssignmentOperation.cs @@ -16,6 +16,10 @@ namespace Microsoft.CodeAnalysis.Operations /// public interface ISimpleAssignmentOperation : IAssignmentOperation { + /// + /// Is this a ref assignment + /// + bool IsRef { get; } } } diff --git a/src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs b/src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs deleted file mode 100644 index 0975c89ea6215..0000000000000 --- a/src/Compilers/Core/Portable/Operations/Loops/DoLoopKind.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Operations -{ - /// - /// Represents different kinds of do loop operations. - /// - public enum DoLoopKind - { - /// - /// Represents unknown or error do loop kind. - /// - None = 0x0, - - /// - /// Indicates a C# 'do while' or a VB 'Do While' loop where the loop condition is executed at the bottom of the loop, i.e. end of the loop iteration. - /// Loop executes while the loop condition evaluates to true. - /// - DoWhileBottomLoop = 0x1, - - /// - /// Indicates a VB 'Do While' loop with the loop condition executed at the top of the loop, i.e. beginning of the loop iteration. - /// Loop executes while the loop condition evaluates to true. - /// - DoWhileTopLoop = 0x2, - - /// - /// Indicates a VB 'Do Until' loop with the loop condition executed at the bottom of the loop, i.e. end of the loop iteration. - /// Loop executes while the loop condition evaluates to false. - /// - DoUntilBottomLoop = 0x3, - - /// - /// Indicates a VB 'Do Until' loop with the loop condition executed at the top of the loop, i.e. beginning of the loop iteration. - /// Loop executes while the loop condition evaluates to false. - /// - DoUntilTopLoop = 0x4 - } -} - diff --git a/src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs b/src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs deleted file mode 100644 index 60ed60bd4e39b..0000000000000 --- a/src/Compilers/Core/Portable/Operations/Loops/IDoLoopOperation.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Operations -{ - /// - /// Represents a do loop. - /// - /// Current usage: - /// (1) C# 'do while' loop statement - /// (2) VB 'Do While' loop statement or 'Do Until' loop statement - /// - /// - /// - /// This interface is reserved for implementation by its associated APIs. We reserve the right to - /// change it in the future. - /// - public interface IDoLoopOperation : ILoopOperation - { - /// - /// Condition of the loop. - /// - IOperation Condition { get; } - - /// - /// Represents kind of do loop operation. - /// - DoLoopKind DoLoopKind { get; } - - /// - /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. - /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. - /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. - /// This property should be null for all non-error cases. - /// - IOperation IgnoredCondition { get; } - } -} - diff --git a/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs b/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs index b8b66fed53a2c..d763811b33f57 100644 --- a/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs +++ b/src/Compilers/Core/Portable/Operations/Loops/IWhileLoopOperation.cs @@ -3,13 +3,13 @@ namespace Microsoft.CodeAnalysis.Operations { /// - /// Represents a while loop. - /// + /// Represents a while or do while loop. /// /// Current usage: - /// (1) C# 'while' loop statement - /// (2) VB 'While' loop statement + /// (1) C# 'while' and 'do while' loop statements. + /// (2) VB 'While', 'Do While' and 'Do Until' loop statements. /// + /// /// /// This interface is reserved for implementation by its associated APIs. We reserve the right to /// change it in the future. @@ -20,6 +20,25 @@ public interface IWhileLoopOperation : ILoopOperation /// Condition of the loop. /// IOperation Condition { get; } + + /// + /// True if the is evaluated at start of each loop iteration. + /// False if it is evaluated at the end of each loop iteration. + /// + bool ConditionIsTop { get; } + + /// + /// True if the loop has 'Until' loop semantics and the loop is executed while is false. + /// + bool ConditionIsUntil { get; } + + /// + /// Additional conditional supplied for loop in error cases, which is ignored by the compiler. + /// For example, for VB 'Do While' or 'Do Until' loop with syntax errors where both the top and bottom conditions are provided. + /// The top condition is preferred and exposed as and the bottom condition is ignored and exposed by this property. + /// This property should be null for all non-error cases. + /// + IOperation IgnoredCondition { get; } } } diff --git a/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs b/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs index 0b8d8583c474e..237b0646ef93c 100644 --- a/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs +++ b/src/Compilers/Core/Portable/Operations/Loops/LoopKind.cs @@ -12,30 +12,25 @@ public enum LoopKind /// None = 0x0, - /// - /// Represents an in C# or VB. - /// - Do = 0x1, - /// /// Represents an in C# or VB. /// - While = 0x2, + While = 0x1, /// /// Indicates an in C#. /// - For = 0x3, + For = 0x2, /// /// Indicates an in VB. /// - ForTo = 0x4, + ForTo = 0x3, /// /// Indicates an in C# or VB. /// - ForEach = 0x5 + ForEach = 0x4 } } diff --git a/src/Compilers/Core/Portable/Operations/Operation.cs b/src/Compilers/Core/Portable/Operations/Operation.cs index ff619bd638643..41b31d4c668d6 100644 --- a/src/Compilers/Core/Portable/Operations/Operation.cs +++ b/src/Compilers/Core/Portable/Operations/Operation.cs @@ -274,7 +274,7 @@ internal IOperation SearchParentOperation() while (currentCandidate != null) { // get operation - var tree = SemanticModel.GetOperationInternal(currentCandidate); + var tree = SemanticModel.GetOperation(currentCandidate); if (tree != null) { // walk down operation tree to see whether this tree contains parent of this operation diff --git a/src/Compilers/Core/Portable/Operations/OperationCloner.cs b/src/Compilers/Core/Portable/Operations/OperationCloner.cs index 5dacd38203926..7dc0cb90e717a 100644 --- a/src/Compilers/Core/Portable/Operations/OperationCloner.cs +++ b/src/Compilers/Core/Portable/Operations/OperationCloner.cs @@ -84,14 +84,9 @@ public override IOperation VisitDefaultCaseClause(IDefaultCaseClauseOperation op return new DefaultCaseClause(((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } - public override IOperation VisitDoLoop(IDoLoopOperation operation, object argument) - { - return new DoLoopStatement(operation.DoLoopKind, Visit(operation.Condition), Visit(operation.Body), Visit(operation.IgnoredCondition), operation.Locals, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); - } - public override IOperation VisitWhileLoop(IWhileLoopOperation operation, object argument) { - return new WhileLoopStatement(Visit(operation.Condition), Visit(operation.Body), operation.Locals, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new WhileLoopStatement(Visit(operation.Condition), Visit(operation.Body), Visit(operation.IgnoredCondition), operation.Locals, operation.ConditionIsTop, operation.ConditionIsUntil, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitForLoop(IForLoopOperation operation, object argument) @@ -262,7 +257,7 @@ public override IOperation VisitBinaryOperator(IBinaryOperation operation, objec public override IOperation VisitConditional(IConditionalOperation operation, object argument) { - return new ConditionalOperation(Visit(operation.Condition), Visit(operation.WhenTrue), Visit(operation.WhenFalse), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new ConditionalOperation(Visit(operation.Condition), Visit(operation.WhenTrue), Visit(operation.WhenFalse), operation.IsRef, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitCoalesce(ICoalesceOperation operation, object argument) @@ -372,12 +367,12 @@ public override IOperation VisitArrayCreation(IArrayCreationOperation operation, public override IOperation VisitArrayInitializer(IArrayInitializerOperation operation, object argument) { - return new ArrayInitializer(VisitArray(operation.ElementValues), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new ArrayInitializer(VisitArray(operation.ElementValues), ((Operation)operation).SemanticModel, operation.Syntax, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitSimpleAssignment(ISimpleAssignmentOperation operation, object argument) { - return new SimpleAssignmentExpression(Visit(operation.Target), Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); + return new SimpleAssignmentExpression(Visit(operation.Target), operation.IsRef, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit); } public override IOperation VisitDeconstructionAssignment(IDeconstructionAssignmentOperation operation, object argument) diff --git a/src/Compilers/Core/Portable/Operations/OperationFactory.cs b/src/Compilers/Core/Portable/Operations/OperationFactory.cs index 862b3bfd02e0f..0863786c1a617 100644 --- a/src/Compilers/Core/Portable/Operations/OperationFactory.cs +++ b/src/Compilers/Core/Portable/Operations/OperationFactory.cs @@ -12,12 +12,13 @@ public static IVariableInitializerOperation CreateVariableInitializer(SyntaxNode return new VariableInitializer(initializerValue, semanticModel, syntax, type: null, constantValue: default, isImplicit: isImplicit); } - public static IConditionalOperation CreateConditionalExpression(IOperation condition, IOperation whenTrue, IOperation whenFalse, ITypeSymbol resultType, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) + public static IConditionalOperation CreateConditionalExpression(IOperation condition, IOperation whenTrue, IOperation whenFalse, bool isRef, ITypeSymbol resultType, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) { return new ConditionalOperation( condition, whenTrue, whenFalse, + isRef, semanticModel, syntax, resultType, @@ -25,9 +26,9 @@ public static IConditionalOperation CreateConditionalExpression(IOperation condi isImplicit); } - public static IExpressionStatementOperation CreateSimpleAssignmentExpressionStatement(IOperation target, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) + public static IExpressionStatementOperation CreateSimpleAssignmentExpressionStatement(IOperation target, bool isRef, IOperation value, SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) { - var expression = new SimpleAssignmentExpression(target, value, semanticModel, syntax, target.Type, default(Optional), isImplicit); + var expression = new SimpleAssignmentExpression(target, isRef, value, semanticModel, syntax, target.Type, default(Optional), isImplicit); return new ExpressionStatement(expression, semanticModel, syntax, type: null, constantValue: default(Optional), isImplicit: isImplicit); } diff --git a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs index fb1d1356a3a29..76a5fe9e7f684 100644 --- a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs +++ b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs @@ -75,11 +75,6 @@ public virtual void VisitDefaultCaseClause(IDefaultCaseClauseOperation operation DefaultVisit(operation); } - public virtual void VisitDoLoop(IDoLoopOperation operation) - { - DefaultVisit(operation); - } - public virtual void VisitWhileLoop(IWhileLoopOperation operation) { DefaultVisit(operation); @@ -580,11 +575,6 @@ public virtual TResult VisitDefaultCaseClause(IDefaultCaseClauseOperation operat return DefaultVisit(operation, argument); } - public virtual TResult VisitDoLoop(IDoLoopOperation operation, TArgument argument) - { - return DefaultVisit(operation, argument); - } - public virtual TResult VisitWhileLoop(IWhileLoopOperation operation, TArgument argument) { return DefaultVisit(operation, argument); diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index 0a2a030bd6fbb..102f45be61722 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -36,6 +36,7 @@ Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBloc Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBlockEndActionsCount.set -> void Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBlockStartActionsCount.get -> int Microsoft.CodeAnalysis.Diagnostics.Telemetry.AnalyzerTelemetryInfo.OperationBlockStartActionsCount.set -> void +Microsoft.CodeAnalysis.ILocalSymbol.RefKind.get -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.IMethodSymbol.RefKind.get -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.IMethodSymbol.ReturnsByRefReadonly.get -> bool Microsoft.CodeAnalysis.IOperation @@ -188,12 +189,6 @@ Microsoft.CodeAnalysis.Operations.CommonConversion.IsNumeric.get -> bool Microsoft.CodeAnalysis.Operations.CommonConversion.IsReference.get -> bool Microsoft.CodeAnalysis.Operations.CommonConversion.IsUserDefined.get -> bool Microsoft.CodeAnalysis.Operations.CommonConversion.MethodSymbol.get -> Microsoft.CodeAnalysis.IMethodSymbol -Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoUntilBottomLoop = 3 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoUntilTopLoop = 4 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoWhileBottomLoop = 1 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.DoWhileTopLoop = 2 -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.DoLoopKind.None = 0 -> Microsoft.CodeAnalysis.Operations.DoLoopKind Microsoft.CodeAnalysis.Operations.IAddressOfOperation Microsoft.CodeAnalysis.Operations.IAddressOfOperation.Reference.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IAnonymousFunctionOperation @@ -260,6 +255,7 @@ Microsoft.CodeAnalysis.Operations.IConditionalAccessOperation.Operation.get -> M Microsoft.CodeAnalysis.Operations.IConditionalAccessOperation.WhenNotNull.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IConditionalOperation Microsoft.CodeAnalysis.Operations.IConditionalOperation.Condition.get -> Microsoft.CodeAnalysis.IOperation +Microsoft.CodeAnalysis.Operations.IConditionalOperation.IsRef.get -> bool Microsoft.CodeAnalysis.Operations.IConditionalOperation.WhenFalse.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IConditionalOperation.WhenTrue.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IConstantPatternOperation @@ -279,10 +275,6 @@ Microsoft.CodeAnalysis.Operations.IDefaultCaseClauseOperation Microsoft.CodeAnalysis.Operations.IDefaultValueOperation Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation.Target.get -> Microsoft.CodeAnalysis.IOperation -Microsoft.CodeAnalysis.Operations.IDoLoopOperation -Microsoft.CodeAnalysis.Operations.IDoLoopOperation.Condition.get -> Microsoft.CodeAnalysis.IOperation -Microsoft.CodeAnalysis.Operations.IDoLoopOperation.DoLoopKind.get -> Microsoft.CodeAnalysis.Operations.DoLoopKind -Microsoft.CodeAnalysis.Operations.IDoLoopOperation.IgnoredCondition.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation.Arguments.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation.Operation.get -> Microsoft.CodeAnalysis.IOperation @@ -373,7 +365,7 @@ Microsoft.CodeAnalysis.Operations.ILoopOperation.Body.get -> Microsoft.CodeAnaly Microsoft.CodeAnalysis.Operations.ILoopOperation.Locals.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.ILoopOperation.LoopKind.get -> Microsoft.CodeAnalysis.Operations.LoopKind Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation -Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation.InitializedMember.get -> Microsoft.CodeAnalysis.Operations.IMemberReferenceOperation +Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation.InitializedMember.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IMemberInitializerOperation.Initializer.get -> Microsoft.CodeAnalysis.Operations.IObjectOrCollectionInitializerOperation Microsoft.CodeAnalysis.Operations.IMemberReferenceOperation Microsoft.CodeAnalysis.Operations.IMemberReferenceOperation.Instance.get -> Microsoft.CodeAnalysis.IOperation @@ -418,6 +410,7 @@ Microsoft.CodeAnalysis.Operations.IRelationalCaseClauseOperation.Value.get -> Mi Microsoft.CodeAnalysis.Operations.IReturnOperation Microsoft.CodeAnalysis.Operations.IReturnOperation.ReturnedValue.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.ISimpleAssignmentOperation +Microsoft.CodeAnalysis.Operations.ISimpleAssignmentOperation.IsRef.get -> bool Microsoft.CodeAnalysis.Operations.ISingleValueCaseClauseOperation Microsoft.CodeAnalysis.Operations.ISingleValueCaseClauseOperation.Value.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.ISizeOfOperation @@ -466,13 +459,15 @@ Microsoft.CodeAnalysis.Operations.IVariableDeclaratorOperation.Symbol.get -> Mic Microsoft.CodeAnalysis.Operations.IVariableInitializerOperation Microsoft.CodeAnalysis.Operations.IWhileLoopOperation Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.Condition.get -> Microsoft.CodeAnalysis.IOperation +Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.ConditionIsTop.get -> bool +Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.ConditionIsUntil.get -> bool +Microsoft.CodeAnalysis.Operations.IWhileLoopOperation.IgnoredCondition.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.Do = 1 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.For = 3 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.ForEach = 5 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.ForTo = 4 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.For = 2 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.ForEach = 4 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.ForTo = 3 -> Microsoft.CodeAnalysis.Operations.LoopKind Microsoft.CodeAnalysis.Operations.LoopKind.None = 0 -> Microsoft.CodeAnalysis.Operations.LoopKind -Microsoft.CodeAnalysis.Operations.LoopKind.While = 2 -> Microsoft.CodeAnalysis.Operations.LoopKind +Microsoft.CodeAnalysis.Operations.LoopKind.While = 1 -> Microsoft.CodeAnalysis.Operations.LoopKind Microsoft.CodeAnalysis.Operations.OperationExtensions Microsoft.CodeAnalysis.Operations.OperationVisitor Microsoft.CodeAnalysis.Operations.OperationVisitor.OperationVisitor() -> void @@ -553,7 +548,6 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDeconstructionAs virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultCaseClause(Microsoft.CodeAnalysis.Operations.IDefaultCaseClauseOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultValue(Microsoft.CodeAnalysis.Operations.IDefaultValueOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDelegateCreation(Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation operation) -> void -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDoLoop(Microsoft.CodeAnalysis.Operations.IDoLoopOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicIndexerAccess(Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicInvocation(Microsoft.CodeAnalysis.Operations.IDynamicInvocationOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicMemberReference(Microsoft.CodeAnalysis.Operations.IDynamicMemberReferenceOperation operation) -> void @@ -645,7 +639,6 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.V virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultCaseClause(Microsoft.CodeAnalysis.Operations.IDefaultCaseClauseOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDefaultValue(Microsoft.CodeAnalysis.Operations.IDefaultValueOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDelegateCreation(Microsoft.CodeAnalysis.Operations.IDelegateCreationOperation operation, TArgument argument) -> TResult -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDoLoop(Microsoft.CodeAnalysis.Operations.IDoLoopOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicIndexerAccess(Microsoft.CodeAnalysis.Operations.IDynamicIndexerAccessOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicInvocation(Microsoft.CodeAnalysis.Operations.IDynamicInvocationOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDynamicMemberReference(Microsoft.CodeAnalysis.Operations.IDynamicMemberReferenceOperation operation, TArgument argument) -> TResult diff --git a/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs b/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs index 2400c52c3c07d..7be622258ef27 100644 --- a/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs +++ b/src/Compilers/Core/Portable/Symbols/ILocalSymbol.cs @@ -23,10 +23,16 @@ public interface ILocalSymbol : ISymbol bool IsConst { get; } /// - /// Returns true if this local is a ref-local. + /// Returns true if this local is a ref local or a ref readonly local. + /// Use to get more detailed information. /// bool IsRef { get; } + /// + /// Whether the variable is a ref or ref readonly local. + /// + RefKind RefKind { get; } + /// /// Returns false if the local variable wasn't declared as "const", or constant value was omitted or erroneous. /// True otherwise. diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 071ff745e1e1b..1a3c4a6f3f843 100644 --- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -125,35 +125,6 @@ internal CompilationVerifier CompileAndVerify( verify); } - internal CompilationVerifier CompileAndVerifyExperimental( - string source, - MessageID feature, - string expectedOutput = null, - MetadataReference[] additionalRefs = null, - IEnumerable dependencies = null, - Action sourceSymbolValidator = null, - Action assemblyValidator = null, - Action symbolValidator = null, - SignatureDescription[] expectedSignatures = null, - CSharpCompilationOptions options = null, - bool verify = true) - { - options = options ?? - ((expectedOutput != null) ? TestOptions.ReleaseExe : TestOptions.ReleaseDll); - - var compilation = CreateExperimentalCompilationWithMscorlib45(source, feature, additionalRefs, options); - - return CompileAndVerify( - compilation: compilation, - dependencies: dependencies, - sourceSymbolValidator: Translate2(sourceSymbolValidator), - assemblyValidator: assemblyValidator, - symbolValidator: Translate2(symbolValidator), - expectedSignatures: expectedSignatures, - expectedOutput: expectedOutput, - verify: verify); - } - internal CompilationVerifier CompileAndVerifyWinRt( string source, string expectedOutput = null, @@ -409,40 +380,6 @@ public static CSharpCompilation CreateStandardCompilation( assemblyName: assemblyName); } - internal static CSharpCompilation CreateExperimentalCompilationWithMscorlib45( - string text, - MessageID feature, - IEnumerable references = null, - CSharpCompilationOptions options = null, - string assemblyName = "", - string sourceFileName = "") - { - var refs = new List(); - if (references != null) - { - refs.AddRange(references); - } - refs.Add(MscorlibRef_v4_0_30316_17626); - return CreateCompilation(new[] { Parse(text, sourceFileName, TestOptions.Regular.WithExperimental(feature)) }, refs, options, assemblyName); - } - - internal static CSharpCompilation CreateExperimentalCompilationWithMscorlib45( - string[] texts, - MessageID feature, - IEnumerable references = null, - CSharpCompilationOptions options = null, - string assemblyName = "", - string sourceFileName = "") - { - var refs = new List(); - if (references != null) - { - refs.AddRange(references); - } - refs.Add(MscorlibRef_v4_0_30316_17626); - return CreateCompilation((from text in texts select Parse(text, sourceFileName, TestOptions.Regular.WithExperimental(feature))).ToArray(), refs, options, assemblyName); - } - public static CSharpCompilation CreateCompilationWithMscorlib45AndCSruntime( string text, CSharpCompilationOptions options = null, @@ -1157,7 +1094,7 @@ protected static (IOperation operation, SyntaxNode node) GetOperationAndSyntaxFo return (null, null); } - return (model.GetOperationInternal(syntaxNode), syntaxNode); + return (model.GetOperation(syntaxNode), syntaxNode); } protected static string GetOperationTreeForTest(CSharpCompilation compilation) diff --git a/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs b/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs index 4e8e871982a5a..0ee847322e7ba 100644 --- a/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs @@ -113,12 +113,6 @@ protected CompilationUtils.SemanticInfoSummary GetSemanticInfoForTest(str return GetSemanticInfoForTest(compilation); } - internal CompilationUtils.SemanticInfoSummary GetSemanticInfoForTestExperimental(string testSrc, MessageID feature) where TNode : SyntaxNode - { - var compilation = CreateExperimentalCompilationWithMscorlib45(testSrc, feature, new[] { SystemCoreRef }); - return GetSemanticInfoForTest(compilation); - } - protected CompilationUtils.SemanticInfoSummary GetSemanticInfoForTest(CSharpCompilation compilation) where TNode : SyntaxNode { var tree = compilation.SyntaxTrees[0]; diff --git a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs index bace46be72fab..2e39cb3eef536 100644 --- a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs +++ b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs @@ -27,8 +27,6 @@ public static class TestOptions // to help ensure compatibility of the semantics of the new switch binder with the old switch // binder, so that we may eliminate the old one in the future. public static readonly CSharpParseOptions Regular6WithV7SwitchBinder = Regular6.WithFeatures(new Dictionary() { { "testV7SwitchBinder", "true" } }); - - public static readonly CSharpParseOptions RegularWithIOperationFeature = Regular.WithIOperationsFeature(); public static readonly CSharpCompilationOptions ReleaseDll = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release); public static readonly CSharpCompilationOptions ReleaseExe = new CSharpCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel: OptimizationLevel.Release); @@ -83,34 +81,6 @@ public static CSharpParseOptions WithReplaceFeature(this CSharpParseOptions opti { return options; } - - internal static CSharpParseOptions WithExperimental(this CSharpParseOptions options, params MessageID[] features) - { - if (features.Length == 0) - { - throw new InvalidOperationException("Need at least one feature to enable"); - } - - var list = new List>(); - foreach (var feature in features) - { - var name = feature.RequiredFeature(); - if (name == null) - { - throw new InvalidOperationException($"{feature} is not a valid experimental feature"); - } - - - list.Add(new KeyValuePair(name, "true")); - } - - return options.WithFeatures(options.Features.Concat(list)); - } - - public static CSharpParseOptions WithIOperationsFeature(this CSharpParseOptions options) - { - return options.WithFeatures(options.Features.Concat(new[] { new KeyValuePair("IOperation", "true") })); - } } } diff --git a/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb b/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb index 6b739a42a9f21..3adfa6b8c1ef8 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/BasicTestBase.vb @@ -798,7 +798,7 @@ Public MustInherit Class BasicTestBaseBase Dim tree = (From t In compilation.SyntaxTrees Where t.FilePath = fileName).Single() Dim semanticModel = compilation.GetSemanticModel(tree) - Dim operation = semanticModel.GetOperationInternal(node) + Dim operation = semanticModel.GetOperation(node) If operation IsNot Nothing Then Return (OperationTreeVerifier.GetOperationTree(compilation, operation), node, operation) Else @@ -892,7 +892,7 @@ Public MustInherit Class BasicTestBaseBase End If Dim semanticModel = compilation.GetSemanticModel(node.SyntaxTree) - Dim operation = semanticModel.GetOperationInternal(node) + Dim operation = semanticModel.GetOperation(node) Return (operation, node) End Function diff --git a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb index b2c7183431725..2596c99399ca1 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb @@ -7,8 +7,6 @@ Public Class TestOptions Public Shared ReadOnly Script As New VisualBasicParseOptions(kind:=SourceCodeKind.Script) Public Shared ReadOnly Regular As New VisualBasicParseOptions(kind:=SourceCodeKind.Regular) - Public Shared ReadOnly RegularWithIOperationFeature As VisualBasicParseOptions = Regular.WithIOperationFeature() - Public Shared ReadOnly ReleaseDll As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel:=OptimizationLevel.Release) Public Shared ReadOnly ReleaseExe As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel:=OptimizationLevel.Release) @@ -31,28 +29,4 @@ Friend Module TestOptionExtensions Public Function WithStrictFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions Return options.WithFeatures(options.Features.Concat(New KeyValuePair(Of String, String)() {New KeyValuePair(Of String, String)("Strict", "true")})) End Function - - - Friend Function WithExperimental(options As VisualBasicParseOptions, ParamArray features As Feature()) As VisualBasicParseOptions - If features.Length = 0 Then - Throw New InvalidOperationException("Need at least one feature to enable") - End If - - Dim list As New List(Of KeyValuePair(Of String, String)) - For Each feature In features - Dim flagName = feature.GetFeatureFlag() - If flagName Is Nothing Then - Throw New InvalidOperationException($"{feature} is not an experimental feature") - End If - - list.Add(New KeyValuePair(Of String, String)(flagName, "True")) - Next - - Return options.WithFeatures(options.Features.Concat(list)) - End Function - - - Public Function WithIOperationFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions - Return options.WithFeatures(options.Features.Concat(New KeyValuePair(Of String, String)() {New KeyValuePair(Of String, String)("IOperation", "true")})) - End Function End Module diff --git a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb index 7a6a84386f5d1..6eb7ffcf34667 100644 --- a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb +++ b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb @@ -2712,18 +2712,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return New SymbolSearcher(Me).GetSymbolsWithName(predicate, filter, cancellationToken) End Function - Friend Overrides Function IsIOperationFeatureEnabled() As Boolean - Dim tree = Me.SyntaxTrees.FirstOrDefault() - If tree Is Nothing Then - Return False - End If - - Dim options = DirectCast(tree.Options, VisualBasicParseOptions) - Dim IOperationFeatureFlag = InternalSyntax.FeatureExtensions.GetFeatureFlag(InternalSyntax.Feature.IOperation) - - Return If(IOperationFeatureFlag Is Nothing, False, options.Features.ContainsKey(IOperationFeatureFlag)) - End Function - Friend Overrides Function IsUnreferencedAssemblyIdentityDiagnosticCode(code As Integer) As Boolean Select Case code Case ERRID.ERR_UnreferencedAssemblyEvent3, diff --git a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb index f47a85207a5f3..6a3cc78076937 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb @@ -2012,7 +2012,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic FEATURE_DigitSeparators FEATURE_BinaryLiterals FEATURE_Tuples - FEATURE_IOperation FEATURE_LeadingDigitSeparator FEATURE_PrivateProtected End Enum diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb index 2bedf2ec5ee86..57c1d340c276d 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicArgument.vb @@ -6,8 +6,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Friend MustInherit Class BaseVisualBasicArgument Inherits BaseArgument - Protected Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean) - MyBase.New(argumentKind, parameter, semanticModel, syntax, type, constantValue, isImplicit) + Protected Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean) + MyBase.New(argumentKind, parameter, semanticModel, syntax, constantValue, isImplicit) InConversionInternal = inConversion OutConversionInternal = outConversion @@ -33,8 +33,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Friend NotInheritable Class VisualBasicArgument Inherits BaseVisualBasicArgument - Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, value As IOperation, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean) - MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, type, constantValue, isImplicit) + Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, value As IOperation, inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean) + MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, constantValue, isImplicit) Me.ValueImpl = value End Sub @@ -47,8 +47,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private ReadOnly _valueLazy As Lazy(Of IOperation) - Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, valueLazy As Lazy(Of IOperation), inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean) - MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, type, constantValue, isImplicit) + Public Sub New(argumentKind As ArgumentKind, parameter As IParameterSymbol, valueLazy As Lazy(Of IOperation), inConversion As Conversion, outConversion As Conversion, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean) + MyBase.New(argumentKind, parameter, inConversion, outConversion, semanticModel, syntax, constantValue, isImplicit) _valueLazy = valueLazy End Sub diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb index 3add6b9f9f15e..b794a68cebdc4 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb @@ -8,7 +8,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Public Shared ReadOnly Property Instance As OperationCloner = New VisualBasicOperationCloner() Public Overrides Function VisitArgument(operation As IArgumentOperation, argument As Object) As IOperation - Return New VisualBasicArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), operation.GetInConversion(), operation.GetOutConversion(), DirectCast(operation, Operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit) + Return New VisualBasicArgument(operation.ArgumentKind, operation.Parameter, Visit(operation.Value), operation.GetInConversion(), operation.GetOutConversion(), DirectCast(operation, Operation).SemanticModel, operation.Syntax, operation.ConstantValue, operation.IsImplicit) End Function Public Overrides Function VisitConversion(operation As IConversionOperation, argument As Object) As IOperation diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 96a123e45ecd9..fa382f35b54f4 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -13,6 +13,9 @@ Namespace Microsoft.CodeAnalysis.Operations Private ReadOnly _cache As ConcurrentDictionary(Of BoundNode, IOperation) = New ConcurrentDictionary(Of BoundNode, IOperation)(concurrencyLevel:=2, capacity:=10) + Private ReadOnly _lazyNothingOperation As Lazy(Of IOperation) = + New Lazy(Of IOperation)(Function() Nothing) + Private ReadOnly _semanticModel As SemanticModel Public Sub New(semanticModel As SemanticModel) @@ -296,10 +299,11 @@ Namespace Microsoft.CodeAnalysis.Operations Else Dim target As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundAssignmentOperator.Left)) Dim value As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundAssignmentOperator.Right)) + Dim isRef As Boolean = False Dim syntax As SyntaxNode = boundAssignmentOperator.Syntax Dim type As ITypeSymbol = boundAssignmentOperator.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundAssignmentOperator.ConstantValueOpt) - Return New LazySimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit) + Return New LazySimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit) End If End Function @@ -640,7 +644,8 @@ Namespace Microsoft.CodeAnalysis.Operations Dim type As ITypeSymbol = boundTernaryConditionalExpression.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundTernaryConditionalExpression.ConstantValueOpt) Dim isImplicit As Boolean = boundTernaryConditionalExpression.WasCompilerGenerated - Return New LazyConditionalOperation(condition, whenTrue, whenFalse, _semanticModel, syntax, type, constantValue, isImplicit) + Dim isRef As Boolean = False + Return New LazyConditionalOperation(condition, whenTrue, whenFalse, isRef, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundTypeOfOperation(boundTypeOf As BoundTypeOf) As IIsTypeOperation @@ -758,10 +763,9 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundArrayInitializationOperation(boundArrayInitialization As BoundArrayInitialization) As IArrayInitializerOperation Dim elementValues As Lazy(Of ImmutableArray(Of IOperation)) = New Lazy(Of ImmutableArray(Of IOperation))(Function() boundArrayInitialization.Initializers.SelectAsArray(Function(n) Create(n))) Dim syntax As SyntaxNode = boundArrayInitialization.Syntax - Dim type As ITypeSymbol = boundArrayInitialization.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundArrayInitialization.ConstantValueOpt) Dim isImplicit As Boolean = boundArrayInitialization.WasCompilerGenerated - Return New LazyArrayInitializer(elementValues, _semanticModel, syntax, type, constantValue, isImplicit) + Return New LazyArrayInitializer(elementValues, _semanticModel, syntax, constantValue, isImplicit) End Function Private Function CreateBoundPropertyAccessOperation(boundPropertyAccess As BoundPropertyAccess) As IPropertyReferenceOperation @@ -951,7 +955,8 @@ Namespace Microsoft.CodeAnalysis.Operations Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() Dim isImplicit As Boolean = boundIfStatement.WasCompilerGenerated - Return New LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, _semanticModel, syntax, type, constantValue, isImplicit) + Dim isRef As Boolean = False + Return New LazyConditionalOperation(condition, ifTrueStatement, ifFalseStatement, isRef, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundSelectStatementOperation(boundSelectStatement As BoundSelectStatement) As ISwitchOperation @@ -1049,54 +1054,32 @@ Namespace Microsoft.CodeAnalysis.Operations Return New LazyRelationalCaseClause(value, relation, _semanticModel, syntax, type, constantValue, isImplicit) End Function - Private Function CreateBoundDoLoopStatementOperation(boundDoLoopStatement As BoundDoLoopStatement) As IDoLoopOperation - Dim doLoopKind As DoLoopKind = GetDoLoopKind(boundDoLoopStatement) + Private Function CreateBoundDoLoopStatementOperation(boundDoLoopStatement As BoundDoLoopStatement) As IWhileLoopOperation Dim condition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundDoLoopStatement.ConditionOpt)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundDoLoopStatement.Body)) Dim ignoredConditionOpt As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() - If doLoopKind = DoLoopKind.None Then - Debug.Assert(boundDoLoopStatement.TopConditionOpt IsNot Nothing) - Debug.Assert(boundDoLoopStatement.BottomConditionOpt IsNot Nothing) + If boundDoLoopStatement.TopConditionOpt IsNot Nothing AndAlso boundDoLoopStatement.BottomConditionOpt IsNot Nothing Then Debug.Assert(boundDoLoopStatement.ConditionOpt Is boundDoLoopStatement.TopConditionOpt) Return Create(boundDoLoopStatement.BottomConditionOpt) Else - Debug.Assert(boundDoLoopStatement.TopConditionOpt Is Nothing OrElse boundDoLoopStatement.BottomConditionOpt Is Nothing) Return Nothing End If End Function) Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty + Dim conditionIsTop As Boolean = boundDoLoopStatement.ConditionIsTop + Dim conditionIsUntil As Boolean = boundDoLoopStatement.ConditionIsUntil Dim syntax As SyntaxNode = boundDoLoopStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() Dim isImplicit As Boolean = boundDoLoopStatement.WasCompilerGenerated - Return New LazyDoLoopStatement(doLoopKind, condition, body, ignoredConditionOpt, locals, _semanticModel, syntax, type, constantValue, isImplicit) - End Function - - Private Shared Function GetDoLoopKind(boundDoLoopStatement As BoundDoLoopStatement) As DoLoopKind - If boundDoLoopStatement.TopConditionOpt IsNot Nothing AndAlso boundDoLoopStatement.BottomConditionOpt IsNot Nothing Then - Return DoLoopKind.None - End If - - If boundDoLoopStatement.ConditionIsTop Then - If boundDoLoopStatement.ConditionIsUntil Then - Return DoLoopKind.DoUntilTopLoop - Else - Return DoLoopKind.DoWhileTopLoop - End If - Else - If boundDoLoopStatement.ConditionIsUntil Then - Return DoLoopKind.DoUntilBottomLoop - Else - Return DoLoopKind.DoWhileBottomLoop - End If - End If + Return New LazyWhileLoopStatement(condition, body, ignoredConditionOpt, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundForToStatementOperation(boundForToStatement As BoundForToStatement) As IForToLoopOperation Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundForToStatement.DeclaredOrInferredLocalOpt IsNot Nothing, ImmutableArray.Create(Of ILocalSymbol)(boundForToStatement.DeclaredOrInferredLocalOpt), ImmutableArray(Of ILocalSymbol).Empty) - Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.ControlVariable)) + Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() CreateBoundControlVariableOperation(boundForToStatement)) Dim initialValue As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.InitialValue)) Dim limitValue As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.LimitValue)) Dim stepValue As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForToStatement.StepValue)) @@ -1118,7 +1101,7 @@ Namespace Microsoft.CodeAnalysis.Operations Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundForEachStatement.DeclaredOrInferredLocalOpt IsNot Nothing, ImmutableArray.Create(Of ILocalSymbol)(boundForEachStatement.DeclaredOrInferredLocalOpt), ImmutableArray(Of ILocalSymbol).Empty) - Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForEachStatement.ControlVariable)) + Dim loopControlVariable As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() CreateBoundControlVariableOperation(boundForEachStatement)) Dim collection As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForEachStatement.Collection)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundForEachStatement.Body)) Dim nextVariables As Lazy(Of ImmutableArray(Of IOperation)) = New Lazy(Of ImmutableArray(Of IOperation))( @@ -1134,6 +1117,14 @@ Namespace Microsoft.CodeAnalysis.Operations Return New LazyForEachLoopStatement(locals, loopControlVariable, collection, nextVariables, body, _semanticModel, syntax, type, constantValue, isImplicit) End Function + Private Function CreateBoundControlVariableOperation(boundForStatement As BoundForStatement) As IOperation + Dim localOpt As LocalSymbol = boundForStatement.DeclaredOrInferredLocalOpt + Dim controlVariable As BoundExpression = boundForStatement.ControlVariable + Return If(localOpt IsNot Nothing, + New VariableDeclarator(localOpt, initializer:=Nothing, semanticModel:=_semanticModel, syntax:=controlVariable.Syntax, type:=Nothing, constantValue:=Nothing, isImplicit:=boundForStatement.WasCompilerGenerated), + Create(controlVariable)) + End Function + Private Function CreateBoundTryStatementOperation(boundTryStatement As BoundTryStatement) As ITryOperation Dim body As Lazy(Of IBlockOperation) = New Lazy(Of IBlockOperation)(Function() DirectCast(Create(boundTryStatement.TryBlock), IBlockOperation)) Dim catches As Lazy(Of ImmutableArray(Of ICatchClauseOperation)) = New Lazy(Of ImmutableArray(Of ICatchClauseOperation))(Function() boundTryStatement.CatchBlocks.SelectAsArray(Function(n) DirectCast(Create(n), ICatchClauseOperation))) @@ -1238,12 +1229,15 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundWhileStatementOperation(boundWhileStatement As BoundWhileStatement) As IWhileLoopOperation Dim condition As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundWhileStatement.Condition)) Dim body As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundWhileStatement.Body)) + Dim ignoredCondition As Lazy(Of IOperation) = _lazyNothingOperation Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty + Dim conditionIsTop As Boolean = True + Dim conditionIsUntil As Boolean = False Dim syntax As SyntaxNode = boundWhileStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() Dim isImplicit As Boolean = boundWhileStatement.WasCompilerGenerated - Return New LazyWhileLoopStatement(condition, body, locals, _semanticModel, syntax, type, constantValue, isImplicit) + Return New LazyWhileLoopStatement(condition, body, ignoredCondition, locals, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit) End Function Private Function CreateBoundDimStatementOperation(boundDimStatement As BoundDimStatement) As IVariableDeclarationGroupOperation @@ -1267,7 +1261,7 @@ Namespace Microsoft.CodeAnalysis.Operations Private Function CreateBoundLabelStatementOperation(boundLabelStatement As BoundLabelStatement) As ILabeledOperation Dim label As ILabelSymbol = boundLabelStatement.Label - Dim statement As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Nothing) + Dim statement As Lazy(Of IOperation) = _lazyNothingOperation Dim syntax As SyntaxNode = boundLabelStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() @@ -1514,7 +1508,7 @@ Namespace Microsoft.CodeAnalysis.Operations End Function Private Function CreateBoundAnonymousTypePropertyAccessOperation(boundAnonymousTypePropertyAccess As BoundAnonymousTypePropertyAccess) As IPropertyReferenceOperation - Dim instance As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Nothing) + Dim instance As Lazy(Of IOperation) = _lazyNothingOperation Dim [property] As IPropertySymbol = DirectCast(boundAnonymousTypePropertyAccess.ExpressionSymbol, IPropertySymbol) Dim arguments As Lazy(Of ImmutableArray(Of IArgumentOperation)) = New Lazy(Of ImmutableArray(Of IArgumentOperation))(Function() ImmutableArray(Of IArgumentOperation).Empty) Dim syntax As SyntaxNode = boundAnonymousTypePropertyAccess.Syntax diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb index ce718853ad954..f5560278edfe4 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb @@ -158,7 +158,6 @@ Namespace Microsoft.CodeAnalysis.Operations outConversion:=outConversion, semanticModel:=_semanticModel, syntax:=If(argument, value.Syntax), - type:=Nothing, constantValue:=Nothing, isImplicit:=isImplicit OrElse argument Is Nothing) End Function @@ -203,11 +202,12 @@ Namespace Microsoft.CodeAnalysis.Operations Continue For End If + Dim isRef As Boolean = False Dim target As IOperation = Create(expression.Declarations(i)) Dim syntax As SyntaxNode = If(value.Syntax?.Parent, expression.Syntax) Dim type As ITypeSymbol = target.Type Dim constantValue As [Optional](Of Object) = value.ConstantValue - Dim assignment = New SimpleAssignmentExpression(target, value, _semanticModel, syntax, type, constantValue, isImplicit:=expression.WasCompilerGenerated) + Dim assignment = New SimpleAssignmentExpression(target, isRef, value, _semanticModel, syntax, type, constantValue, isImplicit:=expression.WasCompilerGenerated) builder.Add(assignment) Next i diff --git a/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb b/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb index c9be702ce7783..17ef76190dcd7 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb @@ -32,7 +32,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax DigitSeparators BinaryLiterals Tuples - IOperation InferredTupleNames LeadingDigitSeparator NonTrailingNamedArguments @@ -40,16 +39,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax End Enum Friend Module FeatureExtensions - - Friend Function GetFeatureFlag(feature As Feature) As String - Select Case feature - Case Feature.IOperation - Return "IOperation" - - Case Else - Return Nothing - End Select - End Function Friend Function GetLanguageVersion(feature As Feature) As LanguageVersion @@ -159,8 +148,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Return ERRID.FEATURE_BinaryLiterals Case Feature.Tuples Return ERRID.FEATURE_Tuples - Case Feature.IOperation - Return ERRID.FEATURE_IOperation Case Feature.LeadingDigitSeparator Return ERRID.FEATURE_LeadingDigitSeparator Case Feature.PrivateProtected diff --git a/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb b/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb index d02ac85b7dbb9..b16579c2d33ac 100644 --- a/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb +++ b/src/Compilers/VisualBasic/Portable/Scanner/Scanner.vb @@ -2677,11 +2677,6 @@ baddate: End Function Private Shared Function CheckFeatureAvailability(parseOptions As VisualBasicParseOptions, feature As Feature) As Boolean - Dim featureFlag = feature.GetFeatureFlag() - If featureFlag IsNot Nothing Then - Return parseOptions.Features.ContainsKey(featureFlag) - End If - Dim required = feature.GetLanguageVersion() Dim actual = parseOptions.LanguageVersion Return CInt(required) <= CInt(actual) diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb index 2b32e737107a7..994b7ae34b95e 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/LocalSymbol.vb @@ -286,6 +286,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property + Public ReadOnly Property RefKind As RefKind Implements ILocalSymbol.RefKind + Get + Return RefKind.None + End Get + End Property + Public MustOverride ReadOnly Property IsFunctionValue As Boolean Implements ILocalSymbol.IsFunctionValue Friend ReadOnly Property IsCompilerGenerated As Boolean diff --git a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb index 253074200985e..0ce3725f345f1 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb @@ -40,7 +40,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New EmptyArrayAnalyzer}, Nothing, Nothing, False, Diagnostic(EmptyArrayAnalyzer.UseArrayEmptyDescriptor.Id, "New Integer(-1) { }").WithLocation(3, 33), @@ -91,7 +91,7 @@ End Structure - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BoxingOperationAnalyzer}, Nothing, Nothing, False, Diagnostic(BoxingOperationAnalyzer.BoxingDescriptor.Id, "3").WithLocation(6, 32), @@ -122,7 +122,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyAnalyzerDiagnostics({New BadStuffTestAnalyzer}, Nothing, Nothing, False, Diagnostic(BadStuffTestAnalyzer.InvalidExpressionDescriptor.Id, "Framitz()").WithLocation(3, 9), Diagnostic(BadStuffTestAnalyzer.IsInvalidDescriptor.Id, "Framitz()").WithLocation(3, 9), @@ -227,7 +227,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(60, 17), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(68, 1), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(74, 22)) @@ -280,7 +280,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New InvocationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(InvocationTestAnalyzer.UseDefaultArgumentDescriptor.Id, "M3(Nothing,)").WithArguments("b").WithLocation(25, 9), @@ -354,7 +354,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New FieldCouldBeReadOnlyAnalyzer}, Nothing, Nothing, False, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(6, 12), @@ -420,7 +420,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New FieldCouldBeReadOnlyAnalyzer}, Nothing, Nothing, False, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(6, 19), @@ -474,7 +474,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LocalCouldBeConstAnalyzer}, Nothing, Nothing, False, Diagnostic(LocalCouldBeConstAnalyzer.LocalCouldBeConstDescriptor.Id, "e").WithLocation(10, 13), @@ -639,7 +639,7 @@ End Interface - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New SymbolCouldHaveMoreSpecificTypeAnalyzer}, Nothing, Nothing, False, Diagnostic(SymbolCouldHaveMoreSpecificTypeAnalyzer.LocalCouldHaveMoreSpecificTypeDescriptor.Id, "a").WithArguments("a", "Middle").WithLocation(3, 13), @@ -717,7 +717,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New SeventeenTestAnalyzer}, Nothing, Nothing, False, Diagnostic(SeventeenTestAnalyzer.SeventeenDescriptor.Id, "17").WithLocation(2, 71), @@ -761,7 +761,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NullArgumentTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NullArgumentTestAnalyzer.NullArgumentsDescriptor.Id, "Nothing").WithLocation(13, 12), @@ -802,7 +802,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedQualifiedNameInInit, "").WithLocation(20, 32)) comp.VerifyAnalyzerDiagnostics({New MemberInitializerTestAnalyzer}, Nothing, Nothing, False, Diagnostic(MemberInitializerTestAnalyzer.DoNotUseFieldInitializerDescriptor.Id, "Field").WithLocation(14, 35), @@ -851,7 +851,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New AssignmentTestAnalyzer}, Nothing, Nothing, False, Diagnostic(AssignmentTestAnalyzer.DoNotUseMemberAssignmentDescriptor.Id, ".Prop2 = New Bar() With {.Field = True}").WithLocation(21, 32), @@ -902,7 +902,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ArrayInitializerTestAnalyzer()}, Nothing, Nothing, False, Diagnostic(ArrayInitializerTestAnalyzer.DoNotUseLargeListOfArrayInitializersDescriptor.Id, "{1, 2, 3, 4, 5, 6}").WithLocation(11, 34), @@ -947,7 +947,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_ExpectedIdentifier, "").WithLocation(11, 21), Diagnostic(ERRID.ERR_UndefinedType1, "UndefType").WithArguments("UndefType").WithLocation(12, 35), @@ -1066,7 +1066,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(60, 17), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(68, 1), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(74, 22)) @@ -1113,7 +1113,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ExplicitVsImplicitInstanceAnalyzer}, Nothing, Nothing, False, Diagnostic(ExplicitVsImplicitInstanceAnalyzer.ExplicitInstanceDescriptor.Id, "Me").WithLocation(3, 9), @@ -1153,7 +1153,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New MemberReferenceAnalyzer}, Nothing, Nothing, False, ' Bug: we are missing diagnostics of "MethodBindingDescriptor" here. https://github.com/dotnet/roslyn/issues/20095 Diagnostic(MemberReferenceAnalyzer.HandlerAddedDescriptor.Id, "AddHandler Mumble, New MumbleEventHandler(AddressOf Mumbler)").WithLocation(7, 9), @@ -1206,7 +1206,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ParamsArrayTestAnalyzer}, Nothing, Nothing, False, Diagnostic(ParamsArrayTestAnalyzer.LongParamsDescriptor.Id, "M0(1, 2, 3, 4, 5)").WithLocation(9, 9), @@ -1239,7 +1239,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New EqualsValueTestAnalyzer}, Nothing, Nothing, False, Diagnostic(EqualsValueTestAnalyzer.EqualsValueDescriptor.Id, "= 44").WithLocation(2, 26), @@ -1271,7 +1271,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New OwningSymbolTestAnalyzer}, Nothing, Nothing, False, Diagnostic(OwningSymbolTestAnalyzer.ExpressionDescriptor.Id, "0").WithLocation(8, 28), @@ -1317,7 +1317,7 @@ End Class ' We have 2 OperationKind.None operations in the operation tree: ' (1) BoundUnstructedExceptionHandlingStatement for the method block with Resume statement ' (2) BoundResumeStatement for Resume statement - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NoneOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NoneOperationTestAnalyzer.NoneOperationDescriptor.Id, - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LambdaTestAnalyzer}, Nothing, Nothing, False, Diagnostic(LambdaTestAnalyzer.LambdaExpressionDescriptor.Id, "Sub() @@ -1445,7 +1445,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New StaticMemberTestAnalyzer}, Nothing, Nothing, False, Diagnostic(StaticMemberTestAnalyzer.StaticMemberDescriptor.Id, "AddHandler C.E, AddressOf D.Method").WithLocation(19, 9), @@ -1476,7 +1476,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LabelOperationsTestAnalyzer}, Nothing, Nothing, False, Diagnostic(LabelOperationsTestAnalyzer.LabelDescriptor.Id, "Wilma:").WithLocation(3, 9), @@ -1532,7 +1532,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New UnaryAndBinaryOperationsTestAnalyzer}, Nothing, Nothing, False, Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.BooleanNotDescriptor.Id, "Not b").WithLocation(33, 13), @@ -1680,7 +1680,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BinaryOperatorVBTestAnalyzer}, Nothing, Nothing, False, Diagnostic("BinaryUserDefinedOperator", "x + y").WithArguments("Add").WithLocation(109, 13), @@ -1741,7 +1741,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_DuplicateProcDef1, "-", New Object() {"Public Shared Operator -(x As B2) As B2"}).WithLocation(8, 28), Diagnostic(ERRID.ERR_TypeMismatch2, "10", New Object() {"Integer", "B2"}).WithLocation(23, 17), Diagnostic(ERRID.ERR_NoMostSpecificOverload2, "-x", New Object() {"-", vbCrLf & " 'Public Shared Operator -(x As B2) As B2': Not most specific." & vbCrLf & " 'Public Shared Operator -(x As B2) As B2': Not most specific."}).WithLocation(25, 13)) @@ -1774,7 +1774,7 @@ End Class ' TODO: array should not be treated as ParamArray argument ' https://github.com/dotnet/roslyn/issues/8570 - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NullOperationSyntaxTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "M0()").WithLocation(6, 9), @@ -1801,7 +1801,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_EndFunctionExpected, "Public Function M1(a As Double, b as C) as Double").WithLocation(2, 5), Diagnostic(ERRID.ERR_InvalidEndSub, "End Sub").WithLocation(4, 5), @@ -1832,7 +1832,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.AssertTheseDiagnostics( - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() ' https://github.com/dotnet/roslyn/issues/21294 comp.VerifyAnalyzerDiagnostics({New ConditionalAccessOperationTestAnalyzer}, Nothing, Nothing, False, @@ -1954,7 +1954,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_LoopControlMustNotBeProperty, "Moo").WithLocation(38, 13), Diagnostic(ERRID.ERR_LoopControlMustNotBeProperty, "Boo").WithLocation(41, 13), @@ -2018,7 +2018,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_ExpectedComma, "").WithLocation(6, 39), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(6, 39), @@ -2095,81 +2095,13 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New TrueFalseUnaryOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x").WithLocation(27, 12), Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x AndAlso y").WithLocation(33, 12)) End Sub - - - Public Sub IOperationFeatureFlagVisualBasic() - Dim source = - - - - - - ' with IOperation disabled (by default), public methods - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextAnalyzer}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.AnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextAnalyzer}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.CompilationStartAnalysisContextAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New SemanticModelAnalyzer}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.SemanticModelAnalyzer", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - ' with IOperation disabled (by default), internal methods - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New SemanticModelInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(3, 17)) - - ' with IOperation enabled, public methods - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextAnalyzer}, Nothing, Nothing, False, - Diagnostic(AnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextAnalyzer}, Nothing, Nothing, False, - Diagnostic(CompilationStartAnalysisContextAnalyzer.OperationActionDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New SemanticModelAnalyzer}, Nothing, Nothing, False, - Diagnostic(SemanticModelAnalyzer.GetOperationDescriptor.Id, "1").WithLocation(3, 17)) - - ' with IOperation enabled, internal methods - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New AnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(AnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New CompilationStartAnalysisContextInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(CompilationStartAnalysisContextInternalAnalyzer.OperationActionInternalDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New SemanticModelInternalAnalyzer}, Nothing, Nothing, False, - Diagnostic(SemanticModelInternalAnalyzer.GetOperationInternalDescriptor.Id, "1").WithLocation(3, 17)) - End Sub - Public Sub TestOperationBlockAnalyzer_EmptyMethodBody() Dim source = @@ -2189,7 +2121,7 @@ End Class - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New OperationBlockAnalyzer}, Nothing, Nothing, False, Diagnostic("ID", "M").WithArguments("M", "Block").WithLocation(2, 16), diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb index 379aa893f7e3e..eb0ee29b7960c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests.vb @@ -46,7 +46,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) Dim nodes = tree.GetRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray() @@ -171,7 +171,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) Dim nodes = tree.GetRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray() @@ -289,7 +289,9 @@ End Class]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i = 0 T ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -344,7 +346,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() comp.AssertTheseDiagnostics( @@ -832,5 +834,39 @@ IAnonymousFunctionOperation (Symbol: Sub ()) (OperationKind.AnonymousFunction, T VerifyOperationTreeAndDiagnosticsForTest(Of MultiLineLambdaExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + Public Sub TestGetOperationForQualifiedName() + Dim source = .Value + + Dim comp = CreateVisualBasicCompilation(source) + Dim tree = comp.SyntaxTrees.Single() + Dim model = comp.GetSemanticModel(tree) + + ' Verify we return non-null operation only for topmost member access expression. + Dim expr = CompilationUtils.FindBindingText(Of MemberAccessExpressionSyntax)(comp, tree.FilePath) + Assert.Equal("a.b", expr.ToString()) + Dim operation = model.GetOperation(expr) + Assert.NotNull(operation) + Assert.Equal(OperationKind.FieldReference, operation.Kind) + Dim fieldOperation = DirectCast(operation, IFieldReferenceOperation) + Assert.Equal("b", fieldOperation.Field.Name) + + ' Verify we return null operation for child nodes of member access expression. + Assert.Null(model.GetOperation(expr.Name)) + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb index 25911b700ea59..5018d4657487a 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ArrayCreationAndInitializer.vb @@ -27,7 +27,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String()) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '0') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.String()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -54,7 +54,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'New M() {}') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -86,7 +86,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'dimension') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -117,7 +117,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'dimension') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -153,7 +153,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'dimension') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -187,7 +187,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'DirectCast( ... n, Integer)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -211,7 +211,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String()) (Sy Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New String( ... ring.Empty}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.String()) (Syntax: '{String.Empty}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{String.Empty}') Element Values(1): IFieldReferenceOperation: System.String.Empty As System.String (Static) (OperationKind.FieldReference, Type: System.String) (Syntax: 'String.Empty') Instance Receiver: @@ -241,7 +241,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C()) (Syntax: 'New C Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{New C, Nothing}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{New C, Nothing}') Element Values(2): IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'New C') Arguments(0) @@ -276,7 +276,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: C(), IsInvalid) (Syntax: '{New C}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{New C}') Element Values(1): IObjectCreationOperation (Constructor: Sub C..ctor()) (OperationKind.ObjectCreation, Type: C, IsInvalid) (Syntax: 'New C') Arguments(0) @@ -316,7 +316,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(), IsIn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'x(0)') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsInvalid) (Syntax: '{1, 2}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{1, 2}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsInvalid) (Syntax: '2') @@ -349,7 +349,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: M()) (Syntax: 'New M Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New M() {New M}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: M()) (Syntax: '{New M}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{New M}') Element Values(1): IObjectCreationOperation (Constructor: Sub M..ctor()) (OperationKind.ObjectCreation, Type: M) (Syntax: 'New M') Arguments(0) @@ -484,7 +484,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Byte(,,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '2') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Byte(,,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -510,7 +510,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Byte(,,)) (Sy ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Byte(,, ... {4, 5, 6}}}') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3, IsImplicit) (Syntax: 'New Byte(,, ... {4, 5, 6}}}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Byte(,,)) (Syntax: '{{{1, 2, 3} ... {4, 5, 6}}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{{{1, 2, 3} ... {4, 5, 6}}}') Element Values(2): IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{{1, 2, 3}}') Element Values(1): @@ -606,7 +606,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32()(,)) ( Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '0') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32()(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -646,7 +646,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'x(1)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -678,7 +678,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -710,7 +710,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{}}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{}}') Element Values(1): IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{}') Element Values(0) @@ -751,7 +751,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{}, {}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{}, {}}') Element Values(2): IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{}') Element Values(0) @@ -794,7 +794,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{1, 2}}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{1, 2}}') Element Values(1): IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{1, 2}') Element Values(2): @@ -834,7 +834,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,), IsInvalid) (Syntax: '{{1, 2}, {}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{{1, 2}, {}}') Element Values(2): IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): @@ -876,7 +876,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32(,)) (Sy Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(,)) (Syntax: '{{1, 2}, {1, 2}}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{{1, 2}, {1, 2}}') Element Values(2): IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): @@ -960,7 +960,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String(,), Is Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.String(,)) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -987,7 +987,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'New C() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: C(), IsInvalid) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsInvalid) (Syntax: '{1}') Element Values(1): IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: C, IsInvalid, IsImplicit) (Syntax: '1') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1025,7 +1025,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'c') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1063,7 +1063,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C()) (Syntax: 'New C Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M()') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1101,7 +1101,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C()) (Syntax: 'New C Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'DirectCast(M(), Integer)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1139,7 +1139,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'M()') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1181,7 +1181,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: C(), IsInvalid) (Syn Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: 'DirectCast(M(), Integer)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: C()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1251,7 +1251,7 @@ IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.String(), IsI Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid, IsImplicit) (Syntax: '0.0') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.String()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb index 4a02b8f7af4bb..e6e71db21dbd7 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IArgument.vb @@ -616,7 +616,7 @@ IInvocationOperation ( Sub P.M2(x As System.Int32, ParamArray y As System.Int32( Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(1, 2, 3)') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(1, 2, 3)') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(1, 2, 3)') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -659,7 +659,7 @@ IInvocationOperation ( Sub P.M2(x As System.Int32, ParamArray y As System.Int32( Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0, IsImplicit) (Syntax: 'M2(1)') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(1)') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(1)') Element Values(0) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1186,7 +1186,7 @@ IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'M2(1)') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(1)') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(1)') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1222,7 +1222,7 @@ IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'M2(0, 1)') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'M2(0, 1)') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'M2(0, 1)') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') @@ -1365,7 +1365,7 @@ IObjectCreationOperation (Constructor: Sub Program..ctor(ParamArray a As System. Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'Program') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'Program') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'Program') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1399,7 +1399,7 @@ IObjectCreationOperation (Constructor: Sub Program..ctor(ParamArray a As System. Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'Program') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32(), IsImplicit) (Syntax: 'Program') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: 'Program') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb index 0a1f8354816a8..a610b7e42d61c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConditionalAccessExpression.vb @@ -1,7 +1,8 @@ -' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.VisualBasic.Syntax +Imports Roslyn.Test.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics @@ -67,5 +68,39 @@ IConditionalAccessOperation (OperationKind.ConditionalAccess, Type: System.Nulla VerifyOperationTreeAndDiagnosticsForTest(Of ConditionalAccessExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + + Public Sub IConditionalAccessExpression_ErrorReceiver() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ConditionalAccessExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb index e1a70396cb193..9e404ab156491 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IConversionExpression.vb @@ -1544,7 +1544,7 @@ IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDecla Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -1586,7 +1586,7 @@ IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDecla Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Int32()()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value @@ -2134,7 +2134,7 @@ IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDecla Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '1') Initializer: - IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: System.Char()) (Syntax: '{}') + IArrayInitializerOperation (0 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{}') Element Values(0) ]]>.Value diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb index 8855133040a77..2ffb81cd35994 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForEachLoopStatement.vb @@ -31,7 +31,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each s ... Next') Locals: Local_1: s As System.String LoopControlVariable: - ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's As String') + IVariableDeclaratorOperation (Symbol: s As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 's As String') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'arr') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -77,7 +79,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each it ... Next') Locals: Local_1: item As System.String LoopControlVariable: - ILocalReferenceOperation: item (OperationKind.LocalReference, Type: System.String) (Syntax: 'item As String') + IVariableDeclaratorOperation (Symbol: item As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'item As String') + Initializer: + null Collection: ILocalReferenceOperation: list (OperationKind.LocalReference, Type: System.Collections.Generic.List(Of System.String)) (Syntax: 'list') Body: @@ -123,7 +127,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y As Char') + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Char') + Initializer: + null Collection: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x') Body: @@ -179,7 +185,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next y, x') Locals: Local_1: x As System.String LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x As String') + IVariableDeclaratorOperation (Symbol: x As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As String') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'S') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -190,7 +198,9 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next y, x') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y As Char') + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Char') + Initializer: + null Collection: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x') Body: @@ -251,7 +261,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Int32 LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'y As Integer') + IVariableDeclaratorOperation (Symbol: y As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Integer') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'x') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -296,7 +308,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.String LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x As String') + IVariableDeclaratorOperation (Symbol: x As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As String') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'S') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -307,7 +321,9 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y As Char') + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y As Char') + Initializer: + null Collection: ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.String) (Syntax: 'x') Body: @@ -359,7 +375,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') + IVariableDeclaratorOperation (Symbol: x As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'New Enumerable()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -405,7 +423,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each y ... Next') Locals: Local_1: y As System.Char LoopControlVariable: - ILocalReferenceOperation: y (OperationKind.LocalReference, Type: System.Char) (Syntax: 'y') + IVariableDeclaratorOperation (Symbol: y As System.Char) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'y') + Initializer: + null Collection: ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String, Constant: null) (Syntax: 's') Body: @@ -451,7 +471,9 @@ End Structure IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') + IVariableDeclaratorOperation (Symbol: x As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'New Enumerable()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -532,7 +554,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each co ... Next') Locals: Local_1: country As LoopControlVariable: - ILocalReferenceOperation: country (OperationKind.LocalReference, Type: ) (Syntax: 'country') + IVariableDeclaratorOperation (Symbol: country As ) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'country') + Initializer: + null Collection: ILocalReferenceOperation: countries (OperationKind.LocalReference, Type: System.Linq.IOrderedEnumerable(Of )) (Syntax: 'countries') Body: @@ -565,7 +589,9 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each cu ... Next') Locals: Local_1: customer As Customer LoopControlVariable: - ILocalReferenceOperation: customer (OperationKind.LocalReference, Type: Customer) (Syntax: 'customer') + IVariableDeclaratorOperation (Symbol: customer As Customer) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'customer') + Initializer: + null Collection: IPropertyReferenceOperation: ReadOnly Property .CustomersInCountry As System.Collections.Generic.IEnumerable(Of Customer) (OperationKind.PropertyReference, Type: System.Collections.Generic.IEnumerable(Of Customer)) (Syntax: 'country.Cus ... rsInCountry') Instance Receiver: @@ -638,7 +664,9 @@ End Module IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each [C ... Next') Locals: Local_1: Custom As System.Int32 LoopControlVariable: - ILocalReferenceOperation: Custom (OperationKind.LocalReference, Type: System.Int32) (Syntax: '[Custom]') + IVariableDeclaratorOperation (Symbol: Custom As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: '[Custom]') + Initializer: + null Collection: ILocalReferenceOperation: k (OperationKind.LocalReference, Type: System.Int32(,)) (Syntax: 'k') Body: @@ -715,7 +743,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Object LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Object) (Syntax: 'x') + IVariableDeclaratorOperation (Symbol: x As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'o') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -775,7 +805,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each x ... Next') Locals: Local_1: x As System.Int32 LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x') + IVariableDeclaratorOperation (Symbol: x As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x') + Initializer: + null Collection: IObjectCreationOperation (Constructor: Sub Enumerable..ctor()) (OperationKind.ObjectCreation, Type: Enumerable) (Syntax: 'New Enumerable()') Arguments(0) @@ -883,7 +915,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For Each el ... Next') Locals: Local_1: element As System.Int32 LoopControlVariable: - ILocalReferenceOperation: element (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'element As Integer') + IVariableDeclaratorOperation (Symbol: element As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'element As Integer') + Initializer: + null Collection: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: "Hello World.", IsInvalid) (Syntax: '"Hello World."') Body: @@ -928,7 +962,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each s ... Next') Locals: Local_1: s As System.String LoopControlVariable: - ILocalReferenceOperation: s (OperationKind.LocalReference, Type: System.String) (Syntax: 's As String') + IVariableDeclaratorOperation (Symbol: s As System.String) (OperationKind.VariableDeclarator, Type: null) (Syntax: 's As String') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'arr') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -989,7 +1025,9 @@ End Class IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Syntax: 'For Each o ... Next') Locals: Local_1: o As System.Object LoopControlVariable: - ILocalReferenceOperation: o (OperationKind.LocalReference, Type: System.Object) (Syntax: 'o') + IVariableDeclaratorOperation (Symbol: o As System.Object) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'o') + Initializer: + null Collection: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Collections.IEnumerable, IsImplicit) (Syntax: 'c') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -1100,5 +1138,47 @@ IForEachLoopOperation (LoopKind.ForEach) (OperationKind.Loop, Type: null) (Synta VerifyOperationTreeAndDiagnosticsForTest(Of ForEachBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + Public Sub IForEachLoopStatement_InvalidLoopControlVariableDeclaration() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ForEachBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb index 36341f166db10..a1dcc02e8382c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IForLoopStatement.vb @@ -27,7 +27,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -90,7 +92,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -146,7 +150,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As Do ... Next') Locals: Local_1: i As System.Double LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Double) (Syntax: 'i As Double') + IVariableDeclaratorOperation (Symbol: i As System.Double) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Double') + Initializer: + null InitialValue: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Double, Constant: 2, IsImplicit) (Syntax: '2') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -251,7 +257,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For AVarNam ... xt AVarName') Locals: Local_1: AVarName As System.Int32 LoopControlVariable: - ILocalReferenceOperation: AVarName (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'AVarName') + IVariableDeclaratorOperation (Symbol: AVarName As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'AVarName') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -266,7 +274,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For B = 1 T ... Next B') Locals: Local_1: B As System.Int32 LoopControlVariable: - ILocalReferenceOperation: B (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'B') + IVariableDeclaratorOperation (Symbol: B As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'B') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -281,7 +291,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For C = 1 T ... Next C') Locals: Local_1: C As System.Int32 LoopControlVariable: - ILocalReferenceOperation: C (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'C') + IVariableDeclaratorOperation (Symbol: C As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'C') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -296,7 +308,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For D = 1 T ... Next D') Locals: Local_1: D As System.Int32 LoopControlVariable: - ILocalReferenceOperation: D (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'D') + IVariableDeclaratorOperation (Symbol: D As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'D') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -345,7 +359,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - ILocalReferenceOperation: I (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'I') + IVariableDeclaratorOperation (Symbol: I As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'I') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -360,7 +376,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = 1 T ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - ILocalReferenceOperation: J (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'J') + IVariableDeclaratorOperation (Symbol: J As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'J') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -419,7 +437,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - ILocalReferenceOperation: I (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'I') + IVariableDeclaratorOperation (Symbol: I As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'I') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -434,7 +454,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = I + ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - ILocalReferenceOperation: J (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'J') + IVariableDeclaratorOperation (Symbol: J As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'J') + Initializer: + null InitialValue: IBinaryOperation (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperator, Type: System.Int32) (Syntax: 'I + 1') Left: @@ -490,7 +512,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For I = 1 T ... Next') Locals: Local_1: I As System.Int32 LoopControlVariable: - ILocalReferenceOperation: I (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'I') + IVariableDeclaratorOperation (Symbol: I As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'I') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -505,7 +529,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For J = 1 T ... Next') Locals: Local_1: J As System.Int32 LoopControlVariable: - ILocalReferenceOperation: J (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'J') + IVariableDeclaratorOperation (Symbol: J As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'J') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -558,7 +584,9 @@ End Enum IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For x As e1 ... Next') Locals: Local_1: x As e1 LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: e1) (Syntax: 'x As e1') + IVariableDeclaratorOperation (Symbol: x As e1) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As e1') + Initializer: + null InitialValue: IFieldReferenceOperation: e1.a (Static) (OperationKind.FieldReference, Type: e1, Constant: 0) (Syntax: 'e1.a') Instance Receiver: @@ -607,7 +635,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') + Initializer: + null InitialValue: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'P1(30 + i)') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -663,7 +693,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For global_ ... Next') Locals: Local_1: global_x As System.Int32 LoopControlVariable: - ILocalReferenceOperation: global_x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'global_x As Integer') + IVariableDeclaratorOperation (Symbol: global_x As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'global_x As Integer') + Initializer: + null InitialValue: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, Constant: 20, IsImplicit) (Syntax: 'global_y') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -703,7 +735,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For x As In ... o 10 : Next') Locals: Local_1: x As System.Int32 LoopControlVariable: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x As Integer') + IVariableDeclaratorOperation (Symbol: x As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x As Integer') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -783,7 +817,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For element ... Next') Locals: Local_1: element1 As System.Int32 LoopControlVariable: - ILocalReferenceOperation: element1 (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'element1') + IVariableDeclaratorOperation (Symbol: element1 As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'element1') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 23) (Syntax: '23') LimitValue: @@ -827,7 +863,9 @@ End Class IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For i As In ... Next') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: @@ -968,7 +1006,9 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For A = 1 T ... Next B, A') Locals: Local_1: A As System.Int32 LoopControlVariable: - ILocalReferenceOperation: A (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'A') + IVariableDeclaratorOperation (Symbol: A As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'A') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') LimitValue: @@ -983,7 +1023,9 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: 'For B = A T ... Next B, A') Locals: Local_1: B As System.Int32 LoopControlVariable: - ILocalReferenceOperation: B (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'B') + IVariableDeclaratorOperation (Symbol: B As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'B') + Initializer: + null InitialValue: ILocalReferenceOperation: A (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'A') LimitValue: @@ -1395,5 +1437,52 @@ IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null) (Syntax: ' VerifyOperationTreeAndDiagnosticsForTest(Of ForBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + Public Sub VerifyForToLoop_InvalidLoopControlVariableDeclaration() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ForBlockSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb index d5163a9306b22..c544989e586dd 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IObjectCreationExpression.vb @@ -404,5 +404,140 @@ IObjectCreationOperation (Constructor: Sub [Class]..ctor()) (OperationKind.Objec VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) End Sub + + + + Public Sub ObjectCreationWithInvalidInitializer() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub ObjectCreationWithInvalidCollectionInitializer() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub ObjectCreationWithInvalidCollectionInitializer02() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ObjectCreationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb index 53ba9b2f23ea8..526784f3615c2 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParameterReferenceExpression.vb @@ -157,7 +157,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {x}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{x}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{x}') Element Values(1): IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') Arguments(0) diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb new file mode 100644 index 0000000000000..dc3b7560ea58c --- /dev/null +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IParenthesizedExpression.vb @@ -0,0 +1,465 @@ +' 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.Operations +Imports Microsoft.CodeAnalysis.Test.Utilities +Imports Microsoft.CodeAnalysis.VisualBasic.Syntax +Imports Roslyn.Test.Utilities + +Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics + + Partial Public Class IOperationTests + Inherits SemanticModelTestBase + + + + Public Sub TestParenthesized() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedChild() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of BinaryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ReturnStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting02() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting03() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting04() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedMultipleNesting05() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of BinaryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedConversion() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedConversionParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ReturnStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedConstantValue() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreation() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreationParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of CTypeExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreationWithImplicitConversion() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedDelegateCreationWithImplicitConversionParent() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ReturnStatementSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedQueryClause() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = String.Empty + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + + + + Public Sub TestParenthesizedErrorOperand() + Dim source = .Value + + Dim expectedOperationTree = .Value + + Dim expectedDiagnostics = .Value + + VerifyOperationTreeAndDiagnosticsForTest(Of ParenthesizedExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) + End Sub + End Class +End Namespace diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb index 1dd73494ad5d5..3f4433be2a2b3 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_ISymbolInitializer.vb @@ -33,7 +33,7 @@ End Class Dim semanticModel = compilation.GetSemanticModel(tree) For Each node In nodes - Assert.Null(semanticModel.GetOperationInternal(node)) + Assert.Null(semanticModel.GetOperation(node)) Next End Sub diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb index 15da03b954327..c235dba59d47e 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IUsingStatement.vb @@ -33,12 +33,12 @@ End Module - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) CompilationUtils.AssertNoDiagnostics(comp) Dim tree = comp.SyntaxTrees.Single() Dim node = tree.GetRoot().DescendantNodes().OfType(Of UsingBlockSyntax).Single() - Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperationInternal(node), IUsingOperation) + Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperation(node), IUsingOperation) Assert.NotNull(op.Resources.Syntax) Assert.Same(node.UsingStatement, op.Resources.Syntax) @@ -68,7 +68,7 @@ End Module - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) CompilationUtils.AssertTheseDiagnostics(comp, BC30201: Expression expected. @@ -78,7 +78,7 @@ BC30201: Expression expected. Dim tree = comp.SyntaxTrees.Single() Dim node = tree.GetRoot().DescendantNodes().OfType(Of UsingBlockSyntax).Single() - Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperationInternal(node), IUsingOperation) + Dim op = DirectCast(comp.GetSemanticModel(tree).GetOperation(node), IUsingOperation) Assert.Equal(OperationKind.Invalid, op.Resources.Kind) End Sub @@ -875,7 +875,7 @@ End Module]]> - Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CreateCompilationWithMscorlibAndVBRuntime(source) CompilationUtils.AssertNoDiagnostics(comp) Dim tree = comp.SyntaxTrees.Single() diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IVariableDeclaration.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IVariableDeclaration.vb index a71e5cc4d4afe..e3f5626b20758 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IVariableDeclaration.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IVariableDeclaration.vb @@ -1011,7 +1011,7 @@ IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDecla Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4, IsImplicit) (Syntax: 'New Integer ... 1, 2, 3, 4}') Initializer: - IArrayInitializerOperation (4 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4}') + IArrayInitializerOperation (4 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4}') Element Values(4): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -1059,7 +1059,7 @@ IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDecla Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4, IsImplicit) (Syntax: 'New Integer ... 1, 2, 3, 4}') Initializer: - IArrayInitializerOperation (4 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4}') + IArrayInitializerOperation (4 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4}') Element Values(4): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') diff --git a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb index 52de3c908ddcd..2c0fbd9c7194c 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/IOperation/IOperationTests_IWhileUntilLoopStatement.vb @@ -29,15 +29,13 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of DoLoopBlockSyntax)(source, expectedOperationTree) @@ -77,7 +77,7 @@ Class C End Class]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -131,7 +131,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -197,7 +199,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -245,7 +249,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -323,7 +329,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -401,7 +409,7 @@ End Class ]]>.Value Dim expectedOperationTree = = 0') Left: @@ -454,6 +462,8 @@ IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: ' ILocalReferenceOperation: value (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'value') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IgnoredCondition: + null ]]>.Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -473,7 +483,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -507,7 +519,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -566,7 +580,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -626,7 +642,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -688,13 +706,15 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -719,7 +739,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -785,7 +807,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -840,7 +864,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -929,7 +957,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1022,7 +1054,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1069,7 +1103,7 @@ End Class ]]>.Value Dim expectedOperationTree = 0 ... End While') +IWhileLoopOperation (ConditionIsTop: True, ConditionIsUntil: False) (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: 'While i > 0 ... End While') Condition: IBinaryOperation (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i > 0') Left: @@ -1085,6 +1119,8 @@ IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null) (Syntax: ' ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IgnoredCondition: + null ]]>.Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1106,7 +1142,7 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1143,7 +1181,7 @@ End Class ]]>.Value Dim expectedOperationTree = 0') Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -1204,6 +1242,8 @@ IWhileLoopOperation (LoopKind.While) (OperationKind.Loop, Type: null, IsInvalid) Arguments(0) Initializer: null + IgnoredCondition: + null ]]>.Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) @@ -1229,14 +1269,12 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of DoLoopBlockSyntax)(source, expectedOperationTree) @@ -1274,14 +1314,12 @@ End Class ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of DoLoopBlockSyntax)(source, expectedOperationTree) @@ -1313,7 +1353,7 @@ Class C End Class]]>.Value Dim expectedOperationTree = .Value Dim expectedDiagnostics = String.Empty @@ -1369,7 +1409,7 @@ End Module ]]>.Value Dim expectedOperationTree = .Value VerifyOperationTreeForTest(Of WhileBlockSyntax)(source, expectedOperationTree) End Sub @@ -1418,19 +1460,13 @@ Class C End Class]]>.Value Dim expectedOperationTree = 0') Left: IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') - IgnoredCondition: - IBinaryOperation (BinaryOperatorKind.LessThanOrEqual, Checked) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 0') - Left: - IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') - Right: - ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') Body: IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsInvalid, IsImplicit) (Syntax: 'Do While i ... ntil i <= 0') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'i = i + 1') @@ -1444,6 +1480,12 @@ IDoLoopOperation (DoLoopKind: None) (LoopKind.Do) (OperationKind.Loop, Type: nul IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + IgnoredCondition: + IBinaryOperation (BinaryOperatorKind.LessThanOrEqual, Checked) (OperationKind.BinaryOperator, Type: System.Boolean) (Syntax: 'i <= 0') + Left: + IParameterReferenceOperation: i (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') ]]>.Value Dim expectedDiagnostics = .Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For Step (M ... Next') Locals: Local_1: As System.Object LoopControlVariable: - ILocalReferenceOperation: (OperationKind.LocalReference, Type: System.Object, IsInvalid) (Syntax: '') + IVariableDeclaratorOperation (Symbol: As System.Object) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: '') + Initializer: + null InitialValue: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') Children(0) @@ -331,7 +335,9 @@ End Module]]>.Value IForToLoopOperation (LoopKind.ForTo) (OperationKind.Loop, Type: null, IsInvalid) (Syntax: 'For i As In ... Next i') Locals: Local_1: i As System.Int32 LoopControlVariable: - ILocalReferenceOperation: i (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'i As Integer') + IVariableDeclaratorOperation (Symbol: i As System.Int32) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'i As Integer') + Initializer: + null InitialValue: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') LimitValue: diff --git a/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb b/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb index dcf792e3b3693..2fb3e4d325183 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Semantics/QueryExpressions.vb @@ -5603,7 +5603,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(1): @@ -5663,7 +5663,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(1): @@ -5754,7 +5754,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {3}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') Arguments(1): @@ -7368,7 +7368,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -7381,7 +7381,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -7460,7 +7460,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -7472,7 +7472,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -7524,7 +7524,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {4, 5}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{4, 5}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{4, 5}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 5) (Syntax: '5') @@ -8701,7 +8701,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -8772,7 +8772,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -8849,7 +8849,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -8933,7 +8933,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 6, IsImplicit) (Syntax: 'New Integer ... 3, 4, 2, 3}') Initializer: - IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2, 3, 4, 2, 3}') + IArrayInitializerOperation (6 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2, 3, 4, 2, 3}') Element Values(6): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -9063,7 +9063,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 2}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -9115,7 +9115,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 2}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 2}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 2}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') @@ -9749,7 +9749,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -9762,7 +9762,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -9849,7 +9849,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -9861,7 +9861,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {2, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -9913,7 +9913,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {4, 5}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{4, 5}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{4, 5}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 5) (Syntax: '5') @@ -10025,7 +10025,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -10041,7 +10041,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(4): @@ -10053,7 +10053,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -10100,7 +10100,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11273,7 +11273,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {3, 4}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3, 4}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3, 4}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') @@ -11377,7 +11377,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {3, 4}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3, 4}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3, 4}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') @@ -11396,7 +11396,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Int32) (S Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {1, 3}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1, 3}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1, 3}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') @@ -11496,7 +11496,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(2): @@ -11514,7 +11514,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {2}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11547,7 +11547,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {3}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11629,7 +11629,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2, IsImplicit) (Syntax: 'New Integer() {3, 4}') Initializer: - IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3, 4}') + IArrayInitializerOperation (2 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3, 4}') Element Values(2): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 4) (Syntax: '4') @@ -11690,7 +11690,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {1}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{1}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{1}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') Arguments(2): @@ -11708,7 +11708,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {2}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{2}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{2}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -11741,7 +11741,7 @@ ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.Collectio Dimension Sizes(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: 'New Integer() {3}') Initializer: - IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: System.Int32()) (Syntax: '{3}') + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null) (Syntax: '{3}') Element Values(1): ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs index 41b5237d5f63a..81fa04ed8011f 100644 --- a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/XmlDocumentationCommentCompletionProviderTests.cs @@ -653,6 +653,70 @@ static void Goo() }", "cref", "langword"); } + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionInPlainText() + { + await VerifyItemsExistAsync(@" +class C +{ + /// + /// Some text $$ + /// + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionAfterAngleBracket1() + { + await VerifyItemsAbsentAsync(@" +class C +{ + /// + /// Some text <$$ + /// + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionAfterAngleBracket2() + { + await VerifyItemsAbsentAsync(@" +class C +{ + /// + /// Some text + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + + [WorkItem(22789, "https://github.com/dotnet/roslyn/issues/22789")] + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task LangwordCompletionAfterAngleBracket3() + { + await VerifyItemsExistAsync(@" +class C +{ + /// + /// Some text < $$ + /// + static void Goo() + { + } +}", "null", "sealed", "true", "false", "await"); + } + [WorkItem(11490, "https://github.com/dotnet/roslyn/issues/11490")] [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task SeeLangwordAttributeValue() diff --git a/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb b/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb index 960aa814db98f..37f6d330a6919 100644 --- a/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb +++ b/src/EditorFeatures/Test2/IntelliSense/CSharpCompletionCommandHandlerTests_XmlDoc.vb @@ -577,6 +577,31 @@ class c End Using End Function + + + Public Async Function InvokeWithOpenAngleCommitSeeOnTab() As Task + + Using state = TestState.CreateCSharpTestState( + ) + + state.SendTypeChars("<") + Await state.AssertCompletionSession() + state.SendTypeChars("se") + Await state.AssertSelectedCompletionItem(displayText:="see") + state.SendTab() + Await state.AssertNoCompletionSession() + + ' /// + Await state.AssertLineTextAroundCaret(" /// ") + End Using + End Function + Public Async Function InvokeWithOpenAngleCommitSeeOnSpace() As Task diff --git a/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb b/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb index 6469257e26f41..5be1254148d7a 100644 --- a/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/XmlDocCommentCompletionProviderTests.vb @@ -774,6 +774,66 @@ End Class Await VerifyItemsExistAsync(text, "cref", "langword") End Function + + + Public Async Function TestLangwordCompletionInPlainText() As Task + Dim text = " +Class C + ''' + ''' Some text $$ + ''' + Sub Goo() + End Sub +End Class +" + Await VerifyItemsExistAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + + + + Public Async Function LangwordCompletionAfterAngleBracket1() As Task + Dim text = " +Class C + ''' + ''' Some text <$$ + ''' + Sub Goo() + End Sub +End Class +" + Await VerifyItemsAbsentAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + + + + Public Async Function LangwordCompletionAfterAngleBracket2() As Task + Dim text = " +Class C + ''' + ''' Some text + Sub Goo() + End Sub +End Class +" + Await VerifyItemsAbsentAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + + + + Public Async Function LangwordCompletionAfterAngleBracket3() As Task + Dim text = " +Class C + ''' + ''' Some text < $$ + ''' + Sub Goo() + End Sub +End Class +" + Await VerifyItemsAbsentAsync(text, "Nothing", "Shared", "True", "False", "Await") + End Function + Public Async Function TestSeeLangwordAttributeValue() As Task diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs index 4f29cbd5b876c..f80772feecfb0 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEDisplayClassFieldLocalSymbol.cs @@ -63,7 +63,7 @@ internal override bool IsCompilerGenerated get { return false; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs index a08ac4d8316ab..aec494998799b 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalConstantSymbol.cs @@ -76,7 +76,7 @@ internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol in return _value; } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs index d604dcce76a54..4e57f20aff86e 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EELocalSymbol.cs @@ -112,7 +112,7 @@ internal override bool IsCompilerGenerated get { return _isCompilerGenerated; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return _refKind; } } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs index c8ff0acaf5fc3..b852ba06650ad 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/PlaceholderLocalSymbol.cs @@ -102,7 +102,7 @@ internal override bool IsCompilerGenerated get { return true; } } - internal override RefKind RefKind + public override RefKind RefKind { get { return RefKind.None; } } diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs index ed89824397079..8666a89a933c4 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.cs @@ -101,7 +101,15 @@ protected override async Task> GetItemsWorkerAsync( if (token.Parent.Parent.Kind() == SyntaxKind.XmlElement || token.Parent.Parent.IsParentKind(SyntaxKind.XmlElement)) { - items.AddRange(GetNestedItems(declaredSymbol)); + // Avoid including language keywords when following < or GetNestedItems(ISymbol symbol) + protected IEnumerable GetNestedItems(ISymbol symbol, bool includeKeywords) { var items = s_nestedTagNames.Select(GetItem); @@ -135,7 +135,10 @@ protected IEnumerable GetNestedItems(ISymbol symbol) .Concat(GetTypeParamRefItems(symbol)); } - items = items.Concat(GetKeywordNames().Select(CreateLangwordCompletionItem)); + if (includeKeywords) + { + items = items.Concat(GetKeywordNames().Select(CreateLangwordCompletionItem)); + } return items; } diff --git a/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs b/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs index c7e8e69bfe427..858473d55936e 100644 --- a/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs @@ -104,7 +104,7 @@ private bool ContainsNullCoalesceCheck( var syntax = statement.Syntax; foreach (var coalesceNode in syntax.DescendantNodes().OfType()) { - var operation = GetOperation(semanticModel, coalesceNode, cancellationToken); + var operation = semanticModel.GetOperation(coalesceNode, cancellationToken); if (operation is ICoalesceOperation coalesceExpression) { if (IsParameterReference(coalesceExpression.Value, parameter) && diff --git a/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs b/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs index 5ff3d2ada37db..097d228016ba6 100644 --- a/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs @@ -27,9 +27,6 @@ internal abstract partial class AbstractInitializeParameterCodeRefactoringProvid where TExpressionSyntax : SyntaxNode where TBinaryExpressionSyntax : TExpressionSyntax { - private static MethodInfo s_getOperationInfo = - typeof(SemanticModel).GetTypeInfo().GetDeclaredMethod("GetOperationInternal"); - protected abstract SyntaxNode GetBody(TMemberDeclarationSyntax containingMember); protected abstract bool IsImplicitConversion(Compilation compilation, ITypeSymbol source, ITypeSymbol destination); protected abstract SyntaxNode GetTypeBlock(SyntaxNode node); @@ -109,7 +106,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte var blockStatementOpt = default(IBlockOperation); if (bodyOpt != null) { - blockStatementOpt = GetOperation(semanticModel, bodyOpt, cancellationToken) as IBlockOperation; + blockStatementOpt = semanticModel.GetOperation(bodyOpt, cancellationToken) as IBlockOperation; if (blockStatementOpt == null) { return; @@ -157,7 +154,7 @@ protected static bool ContainsParameterReference( { foreach (var child in condition.Syntax.DescendantNodes().OfType()) { - var childOperation = GetOperation(semanticModel, child, cancellationToken); + var childOperation = semanticModel.GetOperation(child, cancellationToken); if (IsParameterReference(childOperation, parameter)) { return true; @@ -206,15 +203,6 @@ protected static bool IsFieldOrPropertyReference( return false; } - protected static IOperation GetOperation( - SemanticModel semanticModel, - SyntaxNode node, - CancellationToken cancellationToken) - { - return (IOperation)s_getOperationInfo.Invoke( - semanticModel, new object[] { node, cancellationToken }); - } - protected class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument) diff --git a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs index f73a3b6fb8400..106ae73233925 100644 --- a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs +++ b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchCodeFixProvider.cs @@ -124,8 +124,7 @@ private void FixOneDiagnostic( var switchLocation = diagnostic.AdditionalLocations[0]; var switchNode = switchLocation.FindNode(cancellationToken); - var internalMethod = typeof(SemanticModel).GetTypeInfo().GetDeclaredMethod("GetOperationInternal"); - var switchStatement = (ISwitchOperation)internalMethod.Invoke(model, new object[] { switchNode, cancellationToken }); + var switchStatement = (ISwitchOperation)model.GetOperation(switchNode, cancellationToken); var enumType = switchStatement.Value.Type; var generator = editor.Generator; diff --git a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs index 652b2046832ea..c2e1a389ea98b 100644 --- a/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/PopulateSwitch/PopulateSwitchDiagnosticAnalyzer.cs @@ -28,14 +28,8 @@ public PopulateSwitchDiagnosticAnalyzer() public override bool OpenFileOnly(Workspace workspace) => false; - private static MethodInfo s_registerMethod = typeof(AnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - protected override void InitializeWorker(AnalysisContext context) - => s_registerMethod.Invoke(context, new object[] - { - new Action(AnalyzeOperation), - ImmutableArray.Create(OperationKind.Switch) - }); + => context.RegisterOperationAction(AnalyzeOperation, OperationKind.Switch); private void AnalyzeOperation(OperationAnalysisContext context) { diff --git a/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs b/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs index 2401bcd2dcef0..df24efce20663 100644 --- a/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/QualifyMemberAccess/AbstractQualifyMemberAccessDiagnosticAnalyzer.cs @@ -47,14 +47,8 @@ public override bool OpenFileOnly(Workspace workspace) protected abstract bool IsAlreadyQualifiedMemberAccess(SyntaxNode node); - private static MethodInfo s_registerMethod = typeof(AnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - protected override void InitializeWorker(AnalysisContext context) - => s_registerMethod.Invoke(context, new object[] - { - new Action(AnalyzeOperation), - ImmutableArray.Create(OperationKind.FieldReference, OperationKind.PropertyReference, OperationKind.MethodReference) - }); + => context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference, OperationKind.PropertyReference, OperationKind.MethodReference); public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; diff --git a/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs b/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs index ca9f2f9f7d283..43470d86441dd 100644 --- a/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/UseExplicitTupleName/UseExplicitTupleNameDiagnosticAnalyzer.cs @@ -16,8 +16,6 @@ internal class UseExplicitTupleNameDiagnosticAnalyzer : AbstractCodeStyleDiagnos { public const string ElementName = nameof(ElementName); - private static MethodInfo s_registerMethod = typeof(AnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - public UseExplicitTupleNameDiagnosticAnalyzer() : base(IDEDiagnosticIds.UseExplicitTupleNameDiagnosticId, new LocalizableResourceString(nameof(FeaturesResources.Use_explicitly_provided_tuple_name), FeaturesResources.ResourceManager, typeof(FeaturesResources)), @@ -29,11 +27,7 @@ public UseExplicitTupleNameDiagnosticAnalyzer() public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; protected override void InitializeWorker(AnalysisContext context) - => s_registerMethod.Invoke(context, new object[] - { - new Action(AnalyzeOperation), - ImmutableArray.Create(OperationKind.FieldReference) - }); + => context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference); private void AnalyzeOperation(OperationAnalysisContext context) { diff --git a/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs b/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs index 45ca882d056e2..4456c874b7f6d 100644 --- a/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs +++ b/src/Features/Core/Portable/UseThrowExpression/AbstractUseThrowExpressionDiagnosticAnalyzer.cs @@ -46,12 +46,6 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() public override bool OpenFileOnly(Workspace workspace) => false; - private static MethodInfo s_registerOperationActionInfo = - typeof(CompilationStartAnalysisContext).GetTypeInfo().GetDeclaredMethod("RegisterOperationActionImmutableArrayInternal"); - - private static MethodInfo s_getOperationInfo = - typeof(SemanticModel).GetTypeInfo().GetDeclaredMethod("GetOperationInternal"); - protected abstract bool IsSupported(ParseOptions options); protected override void InitializeWorker(AnalysisContext context) @@ -59,11 +53,7 @@ protected override void InitializeWorker(AnalysisContext context) context.RegisterCompilationStartAction(startContext => { var expressionTypeOpt = startContext.Compilation.GetTypeByMetadataName("System.Linq.Expressions.Expression`1"); - s_registerOperationActionInfo.Invoke(startContext, new object[] - { - new Action(operationContext => AnalyzeOperation(operationContext, expressionTypeOpt)), - ImmutableArray.Create(OperationKind.Throw) - }); + startContext.RegisterOperationAction(operationContext => AnalyzeOperation(operationContext, expressionTypeOpt), OperationKind.Throw); }); } @@ -118,8 +108,7 @@ private void AnalyzeOperation(OperationAnalysisContext context, INamedTypeSymbol return; } - var containingBlock = GetOperation( - semanticModel, ifOperation.Syntax.Parent, cancellationToken) as IBlockOperation; + var containingBlock = semanticModel.GetOperation(ifOperation.Syntax.Parent, cancellationToken) as IBlockOperation; if (containingBlock == null) { return; @@ -314,8 +303,7 @@ private IConditionalOperation GetContainingIfOperation( CancellationToken cancellationToken) { var throwStatement = throwOperation.Syntax; - var containingOperation = GetOperation( - semanticModel, throwStatement.Parent, cancellationToken); + var containingOperation = semanticModel.GetOperation(throwStatement.Parent, cancellationToken); if (containingOperation is IBlockOperation block) { @@ -328,8 +316,7 @@ private IConditionalOperation GetContainingIfOperation( // C# may have an intermediary block between the throw-statement // and the if-statement. Walk up one operation higher in that case. - containingOperation = GetOperation( - semanticModel, throwStatement.Parent.Parent, cancellationToken); + containingOperation = semanticModel.GetOperation(throwStatement.Parent.Parent, cancellationToken); } if (containingOperation is IConditionalOperation conditionalOperation) @@ -339,14 +326,5 @@ private IConditionalOperation GetContainingIfOperation( return null; } - - private static IOperation GetOperation( - SemanticModel semanticModel, - SyntaxNode node, - CancellationToken cancellationToken) - { - return (IOperation)s_getOperationInfo.Invoke( - semanticModel, new object[] { node, cancellationToken }); - } } } diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb index 945bc2c4a69b2..ea37d85f9eccf 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/XmlDocCommentCompletionProvider.vb @@ -110,7 +110,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers Dim grandParent = parentElement?.Parent If grandParent.IsKind(SyntaxKind.XmlElement) Then - items.AddRange(GetNestedItems(symbol)) + ' Avoid including language keywords when following < Or createCompilation) { #if TEST_IOPERATION_INTERFACE var compilation = createCompilation(); + var roots = ArrayBuilder.GetInstance(); foreach (var tree in compilation.SyntaxTrees) { @@ -263,14 +266,53 @@ public static void ValidateIOperations(Func createCompilation) foreach (var node in root.DescendantNodesAndSelf()) { - var operation = semanticModel.GetOperationInternal(node); + var operation = semanticModel.GetOperation(node); if (operation != null) { // Make sure IOperation returned by GetOperation(syntaxnode) will have same syntaxnode as the given syntaxnode(IOperation.Syntax == syntaxnode). Assert.True(node == operation.Syntax, $"Expected : {node} - Actual : {operation.Syntax}"); + + Assert.True(operation.Type == null || !operation.MustHaveNullType(), $"Unexpected non-null type: {operation.Type}"); + + if (operation.Parent == null) + { + roots.Add(operation); + } } } } + + var explictNodeMap = new Dictionary(); + + foreach (var root in roots) + { + foreach (var operation in root.DescendantsAndSelf()) + { + if (!operation.IsImplicit) + { + try + { + explictNodeMap.Add(operation.Syntax, operation); + } + catch (ArgumentException) + { + Assert.False(true, $"Duplicate explicit node for syntax ({operation.Syntax.RawKind}): {operation.Syntax.ToString()}"); + } + } + + if (operation.Kind == OperationKind.Argument) + { + var argument = (IArgumentOperation)operation; + + if (argument.ArgumentKind == ArgumentKind.DefaultValue) + { + Assert.True(argument.Descendants().All(n => n.IsImplicit), $"Explicit node in default argument value ({argument.Syntax.RawKind}): {argument.Syntax.ToString()}"); + } + } + } + } + + roots.Free(); #endif } } diff --git a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs index 0f792cc8907e2..5adc0be6154c0 100644 --- a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs @@ -258,6 +258,8 @@ public override void Visit(IOperation operation) } } + Assert.True(operation.Type == null || !operation.MustHaveNullType(), $"Unexpected non-null type: {operation.Type}"); + if (operation != _root) { Indent(); @@ -449,25 +451,15 @@ public override void VisitSwitchCase(ISwitchCaseOperation operation) Unindent(); } - public override void VisitDoLoop(IDoLoopOperation operation) - { - LogString(nameof(IDoLoopOperation)); - - LogString($" (DoLoopKind: {operation.DoLoopKind})"); - LogLoopStatementHeader(operation); - - Visit(operation.Condition, "Condition"); - Visit(operation.IgnoredCondition, "IgnoredCondition"); - Visit(operation.Body, "Body"); - } - public override void VisitWhileLoop(IWhileLoopOperation operation) { LogString(nameof(IWhileLoopOperation)); + LogString($" (ConditionIsTop: {operation.ConditionIsTop}, ConditionIsUntil: {operation.ConditionIsUntil})"); LogLoopStatementHeader(operation); Visit(operation.Condition, "Condition"); Visit(operation.Body, "Body"); + Visit(operation.IgnoredCondition, "IgnoredCondition"); } public override void VisitForLoop(IForLoopOperation operation) @@ -969,6 +961,12 @@ public override void VisitConversion(IConversionOperation operation) public override void VisitConditional(IConditionalOperation operation) { LogString(nameof(IConditionalOperation)); + + if (operation.IsRef) + { + LogString(" (IsRef)"); + } + LogCommonPropertiesAndNewLine(operation); Visit(operation.Condition, "Condition"); @@ -1240,6 +1238,12 @@ public override void VisitArrayInitializer(IArrayInitializerOperation operation) public override void VisitSimpleAssignment(ISimpleAssignmentOperation operation) { LogString(nameof(ISimpleAssignmentOperation)); + + if (operation.IsRef) + { + LogString(" (IsRef)"); + } + LogCommonPropertiesAndNewLine(operation); Visit(operation.Target, "Left"); diff --git a/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs b/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs index 3aacb0a188b04..5092347b3c51e 100644 --- a/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs +++ b/src/Test/Utilities/Portable/Compilation/TestOperationWalker.cs @@ -111,16 +111,10 @@ private void WalkLoop(ILoopOperation operation) } } - public override void VisitDoLoop(IDoLoopOperation operation) - { - var doLoopKind = operation.DoLoopKind; - WalkLoop(operation); - - base.VisitDoLoop(operation); - } - public override void VisitWhileLoop(IWhileLoopOperation operation) { + var conditionIsTop = operation.ConditionIsTop; + var conditionIsUntil = operation.ConditionIsUntil; WalkLoop(operation); base.VisitWhileLoop(operation); @@ -371,6 +365,7 @@ public override void VisitConversion(IConversionOperation operation) public override void VisitConditional(IConditionalOperation operation) { + bool isRef = operation.IsRef; base.VisitConditional(operation); } @@ -536,6 +531,7 @@ public override void VisitArrayInitializer(IArrayInitializerOperation operation) public override void VisitSimpleAssignment(ISimpleAssignmentOperation operation) { + bool isRef = operation.IsRef; base.VisitSimpleAssignment(operation); } diff --git a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs index 25798e11c13c1..9b1dd4fc40236 100644 --- a/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs +++ b/src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs @@ -2094,34 +2094,6 @@ public sealed override void Initialize(AnalysisContext context) } } - // This analyzer is to test internal operation action registration method in AnalysisContext - public class AnalysisContextInternalAnalyzer : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - public static readonly DiagnosticDescriptor OperationActionInternalDescriptor = new DiagnosticDescriptor( - "AnalysisContextInternal", - "An operation related action is invoked", - "An {0} action is invoked in {1} context.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(OperationActionInternalDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterOperationActionParamsArrayInternal( - (operationContext) => - { - operationContext.ReportDiagnostic( - Diagnostic.Create(OperationActionInternalDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "Analysis")); - }, - OperationKind.Literal); - } - } - // This analyzer is to test operation action registration method in CompilationStartAnalysisContext public class CompilationStartAnalysisContextAnalyzer : DiagnosticAnalyzer { @@ -2154,38 +2126,6 @@ public sealed override void Initialize(AnalysisContext context) } } - // This analyzer is to test internal operation action registration method in CompilationStartAnalysisContext - public class CompilationStartAnalysisContextInternalAnalyzer : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - public static readonly DiagnosticDescriptor OperationActionInternalDescriptor = new DiagnosticDescriptor( - "CompilationStartAnalysisContextInternal", - "An operation related action is invoked", - "An {0} action is invoked in {1} context.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(OperationActionInternalDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterCompilationStartAction( - (compilationStartContext) => - { - compilationStartContext.RegisterOperationActionParamsArrayInternal( - (operationContext) => - { - operationContext.ReportDiagnostic( - Diagnostic.Create(OperationActionInternalDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "CompilationStart within Analysis")); - }, - OperationKind.Literal); - }); - } - } - // This analyzer is to test GetOperation method in SemanticModel public class SemanticModelAnalyzer : DiagnosticAnalyzer { @@ -2229,50 +2169,4 @@ public sealed override void Initialize(AnalysisContext context) Microsoft.CodeAnalysis.VisualBasic.SyntaxKind.NumericLiteralExpression); } } - - // This analyzer is to test GetOperationInternal method in SemanticModel - public class SemanticModelInternalAnalyzer : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - - public static readonly DiagnosticDescriptor GetOperationInternalDescriptor = new DiagnosticDescriptor( - "GetOperationInternal", - "An IOperation is returned by SemanticModel", - "An IOperation is returned by SemanticModel.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(GetOperationInternalDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterSyntaxNodeAction( - (syntaxContext) => - { - var node = syntaxContext.Node; - var model = syntaxContext.SemanticModel; - if (model.GetOperationInternal(node) != null) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(GetOperationInternalDescriptor, node.GetLocation())); - } - }, - Microsoft.CodeAnalysis.CSharp.SyntaxKind.NumericLiteralExpression); - - context.RegisterSyntaxNodeAction( - (syntaxContext) => - { - var node = syntaxContext.Node; - var model = syntaxContext.SemanticModel; - if (model.GetOperationInternal(node) != null) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(GetOperationInternalDescriptor, node.GetLocation())); - } - }, - Microsoft.CodeAnalysis.VisualBasic.SyntaxKind.NumericLiteralExpression); - } - } } diff --git a/src/Test/Utilities/Portable/Extensions/OperationExtensions.cs b/src/Test/Utilities/Portable/Extensions/OperationExtensions.cs new file mode 100644 index 0000000000000..b96eaee14f223 --- /dev/null +++ b/src/Test/Utilities/Portable/Extensions/OperationExtensions.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Test.Extensions +{ + internal static class OperationExtensions + { + public static bool MustHaveNullType(this IOperation operation) + { + switch(operation.Kind) + { + // TODO: Expand to cover all operations that must always have null type. + case OperationKind.ArrayInitializer: + case OperationKind.Argument: + return true; + + default: + return false; + } + } + } +} diff --git a/src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs b/src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs deleted file mode 100644 index a69daa2103b26..0000000000000 --- a/src/Test/Utilities/Portable/Extensions/SemanticModelExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Test.Extensions -{ - public static class SemanticModelExtensions - { - public static IOperation GetOperationInternal(this SemanticModel model, SyntaxNode node) - { - // Invoke the GetOperationInternal API to by-pass the IOperation feature flag check. - return model.GetOperationInternal(node); - } - } -}