diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIsPatternExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIsPatternExpression.cs index cf8debed3aafd..8fc78740b221e 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIsPatternExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIsPatternExpression.cs @@ -732,7 +732,7 @@ void M((int X, int Y)? x, bool b) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') IDiscardPatternOperation (OperationKind.DiscardPattern, Type: null) (Syntax: '_') (InputType: System.Int32) PropertySubpatterns (1): - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Item1: var z') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Item1: var z') Member: IFieldReferenceOperation: System.Int32 (System.Int32 X, System.Int32 Y).Item1 (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Item1') Instance Receiver: @@ -771,7 +771,7 @@ void M((int X, int Y)? x, bool b) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') IDiscardPatternOperation (OperationKind.DiscardPattern, Type: null) (Syntax: '_') (InputType: System.Int32) PropertySubpatterns (1): - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Item1: var z') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Item1: var z') Member: IFieldReferenceOperation: System.Int32 (System.Int32 X, System.Int32 Y).Item1 (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Item1') Instance Receiver: @@ -830,14 +830,14 @@ void M((int X, (int Y, int Z))? tuple, bool b) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') IDiscardPatternOperation (OperationKind.DiscardPattern, Type: null) (Syntax: '_') (InputType: (System.Int32 Y, System.Int32 Z)) PropertySubpatterns (2): - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Item1: var x') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Item1: var x') Member: IFieldReferenceOperation: System.Int32 (System.Int32 X, (System.Int32 Y, System.Int32 Z)).Item1 (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Item1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: PatternInput) (OperationKind.InstanceReference, Type: (System.Int32 X, (System.Int32 Y, System.Int32 Z)), IsImplicit) (Syntax: 'Item1') Pattern: IDeclarationPatternOperation (OperationKind.DeclarationPattern, Type: null) (Syntax: 'var x') (InputType: System.Int32, DeclaredSymbol: System.Int32 x, MatchesNull: True) - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Item2: { Y: ... Z: var z }') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Item2: { Y: ... Z: var z }') Member: IFieldReferenceOperation: (System.Int32 Y, System.Int32 Z) (System.Int32 X, (System.Int32 Y, System.Int32 Z)).Item2 (OperationKind.FieldReference, Type: (System.Int32 Y, System.Int32 Z)) (Syntax: 'Item2') Instance Receiver: @@ -846,7 +846,7 @@ void M((int X, (int Y, int Z))? tuple, bool b) IRecursivePatternOperation (OperationKind.RecursivePattern, Type: null) (Syntax: '{ Y: 1, Z: var z }') (InputType: (System.Int32 Y, System.Int32 Z), DeclaredSymbol: null, MatchedType: (System.Int32 Y, System.Int32 Z), DeconstructSymbol: null) DeconstructionSubpatterns (0) PropertySubpatterns (2): - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Y: 1') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Y: 1') Member: IFieldReferenceOperation: System.Int32 (System.Int32 Y, System.Int32 Z).Y (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Y') Instance Receiver: @@ -855,7 +855,7 @@ void M((int X, (int Y, int Z))? tuple, bool b) IConstantPatternOperation (OperationKind.ConstantPattern, Type: null) (Syntax: '1') (InputType: System.Int32) Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Z: var z') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Z: var z') Member: IFieldReferenceOperation: System.Int32 (System.Int32 Y, System.Int32 Z).Z (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Z') Instance Receiver: @@ -1002,7 +1002,7 @@ void M((int X, int Y) tuple, bool b) Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') PropertySubpatterns (1): - IPropertySubpatternOperation (OperationKind.None, Type: null) (Syntax: 'Item1: int x') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null) (Syntax: 'Item1: int x') Member: IFieldReferenceOperation: System.Int32 (System.Int32 X, System.Int32 Y).Item1 (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Item1') Instance Receiver: @@ -1042,7 +1042,7 @@ void M((int X, int Y) tuple, bool b) Value: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') PropertySubpatterns (1): - IPropertySubpatternOperation (OperationKind.None, Type: null, IsInvalid) (Syntax: 'NotFound: int x') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null, IsInvalid) (Syntax: 'NotFound: int x') Member: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: 'NotFound') Children(0) @@ -1108,7 +1108,7 @@ void M1(object o, bool b) IRecursivePatternOperation (OperationKind.RecursivePattern, Type: null, IsInvalid) (Syntax: 'C1 { Prop[1]: var x }') (InputType: System.Object, DeclaredSymbol: null, MatchedType: C1, DeconstructSymbol: null) DeconstructionSubpatterns (0) PropertySubpatterns (2): - IPropertySubpatternOperation (OperationKind.None, Type: null, IsInvalid) (Syntax: 'Prop[1]') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null, IsInvalid) (Syntax: 'Prop[1]') Member: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: 'Prop[1]') Children(0) @@ -1120,7 +1120,7 @@ void M1(object o, bool b) ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: '1') IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'Prop') Children(0) - IPropertySubpatternOperation (OperationKind.None, Type: null, IsInvalid) (Syntax: 'var x') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null, IsInvalid) (Syntax: 'var x') Member: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid, IsImplicit) (Syntax: 'var x') Children(0) @@ -1172,7 +1172,7 @@ void M1(object o, bool b) IRecursivePatternOperation (OperationKind.RecursivePattern, Type: null, IsInvalid) (Syntax: 'C1 { Prop: var x }') (InputType: System.Object, DeclaredSymbol: null, MatchedType: C1, DeconstructSymbol: null) DeconstructionSubpatterns (0) PropertySubpatterns (1): - IPropertySubpatternOperation (OperationKind.None, Type: null, IsInvalid) (Syntax: 'Prop: var x') + IPropertySubpatternOperation (OperationKind.PropertySubpattern, Type: null, IsInvalid) (Syntax: 'Prop: var x') Member: IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: 'Prop') Children(0) diff --git a/src/Compilers/Core/Portable/Operations/IPropertySubpatternOperation.cs b/src/Compilers/Core/Portable/Operations/IPropertySubpatternOperation.cs index c75597830bc3d..5d0fd893aeb58 100644 --- a/src/Compilers/Core/Portable/Operations/IPropertySubpatternOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IPropertySubpatternOperation.cs @@ -10,7 +10,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. /// - internal interface IPropertySubpatternOperation : IOperation + public interface IPropertySubpatternOperation : IOperation { /// /// The member being matched in a property subpattern. This can be a diff --git a/src/Compilers/Core/Portable/Operations/IRecursivePatternOperation.cs b/src/Compilers/Core/Portable/Operations/IRecursivePatternOperation.cs index 60cb1d99dee76..98ccdea858ac0 100644 --- a/src/Compilers/Core/Portable/Operations/IRecursivePatternOperation.cs +++ b/src/Compilers/Core/Portable/Operations/IRecursivePatternOperation.cs @@ -11,7 +11,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. /// - internal interface IRecursivePatternOperation : IPatternOperation + public interface IRecursivePatternOperation : IPatternOperation { /// /// The type accepted for the recursive pattern. diff --git a/src/Compilers/Core/Portable/Operations/OperationKind.cs b/src/Compilers/Core/Portable/Operations/OperationKind.cs index 49985ee703719..24272e5a51b5b 100644 --- a/src/Compilers/Core/Portable/Operations/OperationKind.cs +++ b/src/Compilers/Core/Portable/Operations/OperationKind.cs @@ -241,6 +241,8 @@ public enum OperationKind SwitchExpression = 0x69, /// Indicates an . SwitchExpressionArm = 0x6a, + /// Indicates an + PropertySubpattern = 0x6b, // /// Indicates an . // https://github.com/dotnet/roslyn/issues/21281 diff --git a/src/Compilers/Core/Portable/Operations/OperationNodes.cs b/src/Compilers/Core/Portable/Operations/OperationNodes.cs index 173d6be55523b..192b9d358e10f 100644 --- a/src/Compilers/Core/Portable/Operations/OperationNodes.cs +++ b/src/Compilers/Core/Portable/Operations/OperationNodes.cs @@ -8177,7 +8177,7 @@ public BasePropertySubpatternOperation( SemanticModel semanticModel, SyntaxNode syntax, bool isImplicit) - : base(OperationKind.None, semanticModel, syntax, type: default, constantValue: default, isImplicit) + : base(OperationKind.PropertySubpattern, semanticModel, syntax, type: default, constantValue: default, isImplicit) { } public abstract IOperation Member { get; } diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index 4e72cffd77147..4608427843801 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -55,6 +55,16 @@ Microsoft.CodeAnalysis.SuppressionDescriptor.Justification.get -> Microsoft.Code Microsoft.CodeAnalysis.SuppressionDescriptor.SuppressedDiagnosticId.get -> string Microsoft.CodeAnalysis.SuppressionDescriptor.SuppressionDescriptor(string id, string suppressedDiagnosticId, Microsoft.CodeAnalysis.LocalizableString justification) -> void Microsoft.CodeAnalysis.SuppressionDescriptor.SuppressionDescriptor(string id, string suppressedDiagnosticId, string justification) -> void +Microsoft.CodeAnalysis.OperationKind.PropertySubpattern = 107 -> Microsoft.CodeAnalysis.OperationKind +Microsoft.CodeAnalysis.Operations.IPropertySubpatternOperation +Microsoft.CodeAnalysis.Operations.IPropertySubpatternOperation.Member.get -> Microsoft.CodeAnalysis.IOperation +Microsoft.CodeAnalysis.Operations.IPropertySubpatternOperation.Pattern.get -> Microsoft.CodeAnalysis.Operations.IPatternOperation +Microsoft.CodeAnalysis.Operations.IRecursivePatternOperation +Microsoft.CodeAnalysis.Operations.IRecursivePatternOperation.DeclaredSymbol.get -> Microsoft.CodeAnalysis.ISymbol +Microsoft.CodeAnalysis.Operations.IRecursivePatternOperation.DeconstructSymbol.get -> Microsoft.CodeAnalysis.ISymbol +Microsoft.CodeAnalysis.Operations.IRecursivePatternOperation.DeconstructionSubpatterns.get -> System.Collections.Immutable.ImmutableArray +Microsoft.CodeAnalysis.Operations.IRecursivePatternOperation.MatchedType.get -> Microsoft.CodeAnalysis.ITypeSymbol +Microsoft.CodeAnalysis.Operations.IRecursivePatternOperation.PropertySubpatterns.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.TypeInfo.ConvertedNullability.get -> Microsoft.CodeAnalysis.NullabilityInfo Microsoft.CodeAnalysis.TypeInfo.Nullability.get -> Microsoft.CodeAnalysis.NullabilityInfo abstract Microsoft.CodeAnalysis.Compilation.ClassifyCommonConversion(Microsoft.CodeAnalysis.ITypeSymbol source, Microsoft.CodeAnalysis.ITypeSymbol destination) -> Microsoft.CodeAnalysis.Operations.CommonConversion diff --git a/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs b/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs index 54a5fae7e2c99..33cc261311314 100644 --- a/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs +++ b/src/Test/Utilities/Portable/Compilation/ControlFlowGraphVerifier.cs @@ -1812,6 +1812,7 @@ propertyReference.Parent is ISimpleAssignmentOperation simpleAssignment && case OperationKind.Range: case OperationKind.RecursivePattern: case OperationKind.DiscardPattern: + case OperationKind.PropertySubpattern: return true; }