diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs index dafeda5eb8912..8a3e120b593ab 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs @@ -7937,7 +7937,7 @@ void M(int arg) Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') RightOperand: - IFromEndIndexOperation (OperationKind.FromEndIndex, Type: System.Index) (Syntax: '^1') + IFromEndIndexOperation (OperationKind.None, Type: System.Index) (Syntax: '^1') Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') "; @@ -8079,7 +8079,7 @@ void M(int? start, int? end) Operand: IParameterReferenceOperation: start (OperationKind.ParameterReference, Type: System.Int32?) (Syntax: 'start') RightOperand: - IFromEndIndexOperation (IsLifted) (OperationKind.FromEndIndex, Type: System.Index?) (Syntax: '^end') + IFromEndIndexOperation (IsLifted) (OperationKind.None, Type: System.Index?) (Syntax: '^end') Operand: IParameterReferenceOperation: end (OperationKind.ParameterReference, Type: System.Int32?) (Syntax: 'end') "; diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IFromEndIndexOperation_IRangeOperation.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IFromEndIndexOperation_IRangeOperation.cs index bf02685e21dfe..c4e16d2743c6d 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IFromEndIndexOperation_IRangeOperation.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IFromEndIndexOperation_IRangeOperation.cs @@ -34,7 +34,7 @@ void M(int arg) IVariableDeclaratorOperation (Symbol: System.Index x) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'x = ^arg') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= ^arg') - IFromEndIndexOperation (OperationKind.FromEndIndex, Type: System.Index) (Syntax: '^arg') + IFromEndIndexOperation (OperationKind.None, Type: System.Index) (Syntax: '^arg') Operand: IParameterReferenceOperation: arg (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'arg') Initializer: @@ -60,7 +60,7 @@ void M(int arg) Left: ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Index, IsImplicit) (Syntax: 'x = ^arg') Right: - IFromEndIndexOperation (OperationKind.FromEndIndex, Type: System.Index) (Syntax: '^arg') + IFromEndIndexOperation (OperationKind.None, Type: System.Index) (Syntax: '^arg') Operand: IParameterReferenceOperation: arg (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'arg') diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs index a4e779c35a3ed..76efa2a88304b 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs @@ -3629,7 +3629,7 @@ void M(int arg) }").VerifyDiagnostics(); string expectedOperationTree = @" -IFromEndIndexOperation (OperationKind.FromEndIndex, Type: System.Index) (Syntax: '^arg') +IFromEndIndexOperation (OperationKind.None, Type: System.Index) (Syntax: '^arg') Operand: IParameterReferenceOperation: arg (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'arg') "; @@ -3652,7 +3652,7 @@ void M(int? arg) }").VerifyDiagnostics(); string expectedOperationTree = @" -IFromEndIndexOperation (IsLifted) (OperationKind.FromEndIndex, Type: System.Index?) (Syntax: '^arg') +IFromEndIndexOperation (IsLifted) (OperationKind.None, Type: System.Index?) (Syntax: '^arg') Operand: IParameterReferenceOperation: arg (OperationKind.ParameterReference, Type: System.Int32?) (Syntax: 'arg') "; @@ -3675,7 +3675,7 @@ void M(byte arg) }").VerifyDiagnostics(); string expectedOperationTree = @" -IFromEndIndexOperation (OperationKind.FromEndIndex, Type: System.Index) (Syntax: '^arg') +IFromEndIndexOperation (OperationKind.None, Type: System.Index) (Syntax: '^arg') Operand: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Int32, IsImplicit) (Syntax: 'arg') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: True, IsReference: False, IsUserDefined: False) (MethodSymbol: null) diff --git a/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs b/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs index 30ca52b09e5a6..4267cef0a9637 100644 --- a/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs +++ b/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs @@ -6567,7 +6567,7 @@ public override IOperation VisitDelegateCreation(IDelegateCreationOperation oper operation.Syntax, operation.Type, operation.ConstantValue, IsImplicit(operation)); } - public override IOperation VisitFromEndIndexOperation(IFromEndIndexOperation operation, int? argument) + internal override IOperation VisitFromEndIndexOperation(IFromEndIndexOperation operation, int? argument) { return new FromEndIndexOperation(operation.IsLifted, semanticModel: null, operation.Syntax, operation.Type, Visit(operation.Operand), operation.Symbol, isImplicit: IsImplicit(operation)); } diff --git a/src/Compilers/Core/Portable/Operations/IIndexOperation.cs b/src/Compilers/Core/Portable/Operations/IIndexOperation.cs index 4b6d32bb77e47..c6dd0b8c42515 100644 --- a/src/Compilers/Core/Portable/Operations/IIndexOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IIndexOperation.cs @@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.Operations /// /// This interface is reserved for implementation by its associated APIs. We reserve the right to change it in the future. /// - public interface IFromEndIndexOperation : IOperation + internal interface IFromEndIndexOperation : IOperation { /// /// The operand. diff --git a/src/Compilers/Core/Portable/Operations/OperationCloner.cs b/src/Compilers/Core/Portable/Operations/OperationCloner.cs index 5a8374af986e7..0f98044ed2b5e 100644 --- a/src/Compilers/Core/Portable/Operations/OperationCloner.cs +++ b/src/Compilers/Core/Portable/Operations/OperationCloner.cs @@ -625,7 +625,7 @@ public override IOperation VisitStaticLocalInitializationSemaphore(IStaticLocalI throw ExceptionUtilities.Unreachable; } - public override IOperation VisitFromEndIndexOperation(IFromEndIndexOperation operation, object argument) + internal override IOperation VisitFromEndIndexOperation(IFromEndIndexOperation operation, object argument) { return new FromEndIndexOperation(operation.IsLifted, ((Operation)operation).OwningSemanticModel, operation.Syntax, operation.Type, Visit(operation.Operand), operation.Symbol, operation.IsImplicit); } diff --git a/src/Compilers/Core/Portable/Operations/OperationKind.cs b/src/Compilers/Core/Portable/Operations/OperationKind.cs index f7dbd3839904f..49985ee703719 100644 --- a/src/Compilers/Core/Portable/Operations/OperationKind.cs +++ b/src/Compilers/Core/Portable/Operations/OperationKind.cs @@ -227,8 +227,8 @@ public enum OperationKind /// Indicates an . Range = 0x63, - /// Indicates an . - FromEndIndex = 0x64, + // Unused, FromEndIndex will be a unary operator: https://github.com/dotnet/roslyn/pull/32918 + //FromEndIndex = 0x64, /// Indicates an . ReDim = 0x65, /// Indicates an . diff --git a/src/Compilers/Core/Portable/Operations/OperationNodes.cs b/src/Compilers/Core/Portable/Operations/OperationNodes.cs index e3c659211f8ca..0df809fca8432 100644 --- a/src/Compilers/Core/Portable/Operations/OperationNodes.cs +++ b/src/Compilers/Core/Portable/Operations/OperationNodes.cs @@ -9401,7 +9401,7 @@ public override IObjectOrCollectionInitializerOperation Initializer internal abstract class BaseFromEndIndexOperation : Operation, IFromEndIndexOperation { protected BaseFromEndIndexOperation(bool isLifted, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, IMethodSymbol symbol, bool isImplicit) : - base(OperationKind.FromEndIndex, semanticModel, syntax, type, constantValue: default, isImplicit: isImplicit) + base(OperationKind.None, semanticModel, syntax, type, constantValue: default, isImplicit: isImplicit) { IsLifted = isLifted; Symbol = symbol; diff --git a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs index e3f992c22d5d5..f82ee037e0822 100644 --- a/src/Compilers/Core/Portable/Operations/OperationVisitor.cs +++ b/src/Compilers/Core/Portable/Operations/OperationVisitor.cs @@ -585,7 +585,7 @@ public virtual void VisitStaticLocalInitializationSemaphore(IStaticLocalInitiali DefaultVisit(operation); } - public virtual void VisitFromEndIndexOperation(IFromEndIndexOperation operation) + internal virtual void VisitFromEndIndexOperation(IFromEndIndexOperation operation) { DefaultVisit(operation); } @@ -1193,7 +1193,7 @@ public virtual TResult VisitStaticLocalInitializationSemaphore(IStaticLocalIniti return DefaultVisit(operation, argument); } - public virtual TResult VisitFromEndIndexOperation(IFromEndIndexOperation operation, TArgument argument) + internal virtual TResult VisitFromEndIndexOperation(IFromEndIndexOperation 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 fb166541efc94..0cdb57ec5274e 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -5,7 +5,6 @@ Microsoft.CodeAnalysis.ITypeSymbol.IsUnmanagedType.get -> bool Microsoft.CodeAnalysis.OperationKind.Binary = 32 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.ConstructorBody = 89 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.DiscardPattern = 104 -> Microsoft.CodeAnalysis.OperationKind -Microsoft.CodeAnalysis.OperationKind.FromEndIndex = 100 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.MethodBody = 88 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.Range = 99 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.RecursivePattern = 103 -> Microsoft.CodeAnalysis.OperationKind @@ -168,10 +167,6 @@ Microsoft.CodeAnalysis.Operations.ICoalesceOperation.ValueConversion.get -> Micr Microsoft.CodeAnalysis.Operations.IEventAssignmentOperation.EventReference.get -> Microsoft.CodeAnalysis.IOperation Microsoft.CodeAnalysis.Operations.IForLoopOperation.ConditionLocals.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.IForToLoopOperation.IsChecked.get -> bool -Microsoft.CodeAnalysis.Operations.IFromEndIndexOperation -Microsoft.CodeAnalysis.Operations.IFromEndIndexOperation.IsLifted.get -> bool -Microsoft.CodeAnalysis.Operations.IFromEndIndexOperation.Operand.get -> Microsoft.CodeAnalysis.IOperation -Microsoft.CodeAnalysis.Operations.IFromEndIndexOperation.Symbol.get -> Microsoft.CodeAnalysis.IMethodSymbol Microsoft.CodeAnalysis.Operations.IInstanceReferenceOperation.ReferenceKind.get -> Microsoft.CodeAnalysis.Operations.InstanceReferenceKind Microsoft.CodeAnalysis.Operations.ILoopOperation.ContinueLabel.get -> Microsoft.CodeAnalysis.ILabelSymbol Microsoft.CodeAnalysis.Operations.ILoopOperation.ExitLabel.get -> Microsoft.CodeAnalysis.ILabelSymbol @@ -213,7 +208,6 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitDiscardPattern(M virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFlowAnonymousFunction(Microsoft.CodeAnalysis.FlowAnalysis.IFlowAnonymousFunctionOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFlowCapture(Microsoft.CodeAnalysis.FlowAnalysis.IFlowCaptureOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFlowCaptureReference(Microsoft.CodeAnalysis.FlowAnalysis.IFlowCaptureReferenceOperation operation) -> void -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFromEndIndexOperation(Microsoft.CodeAnalysis.Operations.IFromEndIndexOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitIsNull(Microsoft.CodeAnalysis.FlowAnalysis.IIsNullOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitRangeOperation(Microsoft.CodeAnalysis.Operations.IRangeOperation operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitReDim(Microsoft.CodeAnalysis.Operations.IReDimOperation operation) -> void @@ -228,7 +222,6 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.V virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFlowAnonymousFunction(Microsoft.CodeAnalysis.FlowAnalysis.IFlowAnonymousFunctionOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFlowCapture(Microsoft.CodeAnalysis.FlowAnalysis.IFlowCaptureOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFlowCaptureReference(Microsoft.CodeAnalysis.FlowAnalysis.IFlowCaptureReferenceOperation operation, TArgument argument) -> TResult -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitFromEndIndexOperation(Microsoft.CodeAnalysis.Operations.IFromEndIndexOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitIsNull(Microsoft.CodeAnalysis.FlowAnalysis.IIsNullOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitRangeOperation(Microsoft.CodeAnalysis.Operations.IRangeOperation operation, TArgument argument) -> TResult virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitReDim(Microsoft.CodeAnalysis.Operations.IReDimOperation operation, TArgument argument) -> TResult diff --git a/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs b/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs index 880b31ecc1a7b..9c27c687b91fc 100644 --- a/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs @@ -1800,7 +1800,6 @@ propertyReference.Parent is ISimpleAssignmentOperation simpleAssignment && case OperationKind.Discard: case OperationKind.ReDim: case OperationKind.ReDimClause: - case OperationKind.FromEndIndex: case OperationKind.Range: case OperationKind.RecursivePattern: case OperationKind.DiscardPattern: diff --git a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs index c6d42196b6cd1..7f3953dd2c407 100644 --- a/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/OperationTreeVerifier.cs @@ -1878,7 +1878,7 @@ public override void VisitStaticLocalInitializationSemaphore(IStaticLocalInitial LogCommonPropertiesAndNewLine(operation); } - public override void VisitFromEndIndexOperation(IFromEndIndexOperation operation) + internal override void VisitFromEndIndexOperation(IFromEndIndexOperation operation) { LogString(nameof(IFromEndIndexOperation)); diff --git a/src/Test/Utilities/Portable/Compilation/TestOperationVisitor.cs b/src/Test/Utilities/Portable/Compilation/TestOperationVisitor.cs index 29767a450c1be..0f9aa18d5e015 100644 --- a/src/Test/Utilities/Portable/Compilation/TestOperationVisitor.cs +++ b/src/Test/Utilities/Portable/Compilation/TestOperationVisitor.cs @@ -1421,9 +1421,9 @@ public override void VisitStaticLocalInitializationSemaphore(IStaticLocalInitial Assert.True(operation.Local.IsStatic); } - public override void VisitFromEndIndexOperation(IFromEndIndexOperation operation) + internal override void VisitFromEndIndexOperation(IFromEndIndexOperation operation) { - Assert.Equal(OperationKind.FromEndIndex, operation.Kind); + Assert.Equal(OperationKind.None, operation.Kind); Assert.Same(operation.Operand, operation.Children.Single()); }