From d4a955d5f2f036f6d1f1e696db8fe2f07cede90c Mon Sep 17 00:00:00 2001 From: Neal Gafter Date: Fri, 26 Feb 2016 01:36:16 -0800 Subject: [PATCH 1/2] Implement SymbolInfo for the property name of a property pattern Fixes #9072 #9073 #9079 #9080 --- .../CSharp/Portable/Binder/Binder_Patterns.cs | 43 +++++---- .../CSharp/Portable/BoundTree/BoundNodes.xml | 12 ++- .../CSharp/Portable/CSharpExtensions.cs | 27 +++++- .../Compilation/CSharpSemanticModel.cs | 17 ++++ .../Compilation/MemberSemanticModel.cs | 20 ++++- .../Compilation/SyntaxTreeSemanticModel.cs | 7 ++ .../Portable/FlowAnalysis/DataFlowPass.cs | 8 +- .../PreciseAbstractFlowPass_Switch.cs | 7 +- .../LocalRewriter/LocalRewriter_Patterns.cs | 6 +- .../CSharp/Portable/PublicAPI.Unshipped.txt | 87 ++++++++++--------- .../CSharp/Portable/Syntax/SyntaxFactory.cs | 7 ++ .../Semantics/PatternMatchingTests.cs | 33 +++++++ 12 files changed, 197 insertions(+), 77 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs index 253d2d0a3e087..970ccbd61863d 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs @@ -120,7 +120,12 @@ private BoundPattern BindRecursivePattern(RecursivePatternSyntax node, BoundExpr // use a dedicated bound node for that form. var properties = correspondingMembers; var boundPatterns = BindRecursiveSubPropertyPatterns(node, properties, type, diagnostics); - return new BoundPropertyPattern(node, type, boundPatterns, properties, hasErrors: hasErrors); + var builder = ArrayBuilder.GetInstance(); + for (int i = 0; i < properties.Length; i++) + { + builder.Add(new BoundSubPropertyPattern(node.PatternList.SubPatterns[i], properties[i].GetTypeOrReturnType(), properties[i], LookupResultKind.Empty, boundPatterns[i], hasErrors)); + } + return new BoundPropertyPattern(node, type, builder.ToImmutableAndFree(), hasErrors: hasErrors); } private ImmutableArray BindRecursiveSubPropertyPatterns(RecursivePatternSyntax node, ImmutableArray properties, NamedTypeSymbol type, DiagnosticBag diagnostics) @@ -162,21 +167,20 @@ private BoundPattern BindPropertyPattern(PropertyPatternSyntax node, BoundExpres { var type = (NamedTypeSymbol)this.BindType(node.Type, diagnostics); hasErrors = hasErrors || CheckValidPatternType(node.Type, operand, operandType, type, false, diagnostics); - var properties = ArrayBuilder.GetInstance(); - var boundPatterns = BindSubPropertyPatterns(node, properties, type, diagnostics); - hasErrors |= properties.Count != boundPatterns.Length; - return new BoundPropertyPattern(node, type, boundPatterns, properties.ToImmutableAndFree(), hasErrors: hasErrors); + var boundPatterns = BindSubPropertyPatterns(node, type, diagnostics); + return new BoundPropertyPattern(node, type, boundPatterns, hasErrors: hasErrors); } - private ImmutableArray BindSubPropertyPatterns(PropertyPatternSyntax node, ArrayBuilder properties, TypeSymbol type, DiagnosticBag diagnostics) + private ImmutableArray BindSubPropertyPatterns(PropertyPatternSyntax node, TypeSymbol type, DiagnosticBag diagnostics) { - var boundPatternsBuilder = ArrayBuilder.GetInstance(); + var result = ArrayBuilder.GetInstance(); foreach (var syntax in node.PatternList.SubPatterns) { var propName = syntax.Left; BoundPattern pattern; HashSet useSiteDiagnostics = null; - Symbol property = FindPropertyByName(type, propName, ref useSiteDiagnostics); + LookupResultKind resultKind; + Symbol property = FindPropertyByName(type, propName, out resultKind, ref useSiteDiagnostics); if ((object)property != null) { bool hasErrors = false; @@ -190,30 +194,31 @@ private ImmutableArray BindSubPropertyPatterns(PropertyPatternSynt diagnostics.Add(node, useSiteDiagnostics); } - properties.Add(property); - pattern = this.BindPattern(syntax.Pattern, null, property.GetTypeOrReturnType(), hasErrors, diagnostics); + var propertyType = property.GetTypeOrReturnType(); + pattern = this.BindPattern(syntax.Pattern, null, propertyType, hasErrors, diagnostics); + result.Add(new BoundSubPropertyPattern(syntax, propertyType, property, resultKind, pattern, hasErrors)); } else { Error(diagnostics, ErrorCode.ERR_NoSuchMember, propName, type, propName.Identifier.ValueText); pattern = new BoundWildcardPattern(node, hasErrors: true); + result.Add(new BoundSubPropertyPattern(syntax, CreateErrorType(), null, resultKind, pattern, true)); } - - boundPatternsBuilder.Add(pattern); } - return boundPatternsBuilder.ToImmutableAndFree(); + return result.ToImmutableAndFree(); } - private Symbol FindPropertyByName(TypeSymbol type, IdentifierNameSyntax name, ref HashSet useSiteDiagnostics) + private Symbol FindPropertyByName(TypeSymbol type, IdentifierNameSyntax name, out LookupResultKind resultKind, ref HashSet useSiteDiagnostics) { var symbols = ArrayBuilder.GetInstance(); - var result = LookupResult.GetInstance(); - this.LookupMembersWithFallback(result, type, name.Identifier.ValueText, arity: 0, useSiteDiagnostics: ref useSiteDiagnostics); + var lookupResult = LookupResult.GetInstance(); + this.LookupMembersWithFallback(lookupResult, type, name.Identifier.ValueText, arity: 0, useSiteDiagnostics: ref useSiteDiagnostics); + resultKind = lookupResult.Kind; - if (result.IsMultiViable) + if (lookupResult.IsMultiViable) { - foreach (var symbol in result.Symbols) + foreach (var symbol in lookupResult.Symbols) { if (symbol.Kind == SymbolKind.Property || symbol.Kind == SymbolKind.Field) { @@ -222,6 +227,8 @@ private Symbol FindPropertyByName(TypeSymbol type, IdentifierNameSyntax name, re } } + resultKind = lookupResult.Kind; + lookupResult.Free(); return null; } diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml b/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml index 726a6b59e5e76..a41aeaf75d730 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml @@ -1446,10 +1446,16 @@ - - + - + + + + + + + + diff --git a/src/Compilers/CSharp/Portable/CSharpExtensions.cs b/src/Compilers/CSharp/Portable/CSharpExtensions.cs index d26d4f49fb39e..2f78150faef71 100644 --- a/src/Compilers/CSharp/Portable/CSharpExtensions.cs +++ b/src/Compilers/CSharp/Portable/CSharpExtensions.cs @@ -430,6 +430,22 @@ public static Conversion ClassifyConversion(this Compilation compilation, ITypeS } } + /// + /// Gets the symbol information for the property of a sub-property pattern. + /// + public static SymbolInfo GetSymbolInfo(this SemanticModel semanticModel, SubPropertyPatternSyntax node, CancellationToken cancellationToken = default(CancellationToken)) + { + var csmodel = semanticModel as CSharpSemanticModel; + if (csmodel != null) + { + return csmodel.GetSymbolInfo(node, cancellationToken); + } + else + { + return SymbolInfo.None; + } + } + /// /// Returns what symbol(s), if any, the given expression syntax bound to in the program. /// @@ -446,7 +462,16 @@ public static Conversion ClassifyConversion(this Compilation compilation, ITypeS var csmodel = semanticModel as CSharpSemanticModel; if (csmodel != null) { - return csmodel.GetSymbolInfo(expression, cancellationToken); + // Because it is a Identifier, the left-hand-side of a sub-property pattern appears to be an expression, but really is not an expression. + var possibleParentOfProperty = expression.Parent as SubPropertyPatternSyntax; + if (possibleParentOfProperty?.Left == expression) + { + return csmodel.GetSymbolInfo(possibleParentOfProperty, cancellationToken); + } + else + { + return csmodel.GetSymbolInfo(expression, cancellationToken); + } } else { diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs index bee5bc9af9dba..0a970e96b49eb 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs @@ -495,6 +495,11 @@ internal virtual IOperation GetOperationWorker(CSharpSyntaxNode node, GetOperati /// public abstract SymbolInfo GetSymbolInfo(SelectOrGroupClauseSyntax node, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the symbol information for the property of a sub-property pattern. + /// + public abstract SymbolInfo GetSymbolInfo(SubPropertyPatternSyntax node, CancellationToken cancellationToken); + /// /// Returns what symbol(s), if any, the given expression syntax bound to in the program. /// @@ -4310,6 +4315,12 @@ private SymbolInfo GetSymbolInfoFromNode(SyntaxNode node, CancellationToken canc throw new ArgumentNullException(nameof(node)); } + var subPropertyPattern = node.Parent as SubPropertyPatternSyntax; + if (subPropertyPattern != null && subPropertyPattern.Left == node) + { + return this.GetSymbolInfo(subPropertyPattern, cancellationToken); + } + var expression = node as ExpressionSyntax; if (expression != null) { @@ -4346,6 +4357,12 @@ private SymbolInfo GetSymbolInfoFromNode(SyntaxNode node, CancellationToken canc return this.GetSymbolInfo(orderingSyntax, cancellationToken); } + subPropertyPattern = node as SubPropertyPatternSyntax; + if (subPropertyPattern != null) + { + return this.GetSymbolInfo(subPropertyPattern, cancellationToken); + } + return SymbolInfo.None; } diff --git a/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs index dfe1dc614c8f4..7dcba4182cb9a 100644 --- a/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs @@ -937,6 +937,23 @@ internal override Optional GetConstantValueWorker(CSharpSyntaxNode node, return GetTypeInfoForQuery(bound); } + /// + /// Gets the symbol information for the property of a sub-property pattern. + /// + public override SymbolInfo GetSymbolInfo(SubPropertyPatternSyntax node, CancellationToken cancellationToken) + { + var boundNode = GetLowerBoundNode(node) as BoundSubPropertyPattern; + if (boundNode != null) + { + var property = boundNode.Property; + return new SymbolInfo(property, boundNode.ResultKind == LookupResultKind.Viable ? CandidateReason.None : boundNode.ResultKind.ToCandidateReason()); + } + else + { + return default(SymbolInfo); + } + } + private void GetBoundNodes(CSharpSyntaxNode node, out CSharpSyntaxNode bindableNode, out BoundNode lowestBoundNode, out BoundNode highestBoundNode, out BoundNode boundParent) { bindableNode = this.GetBindableSyntaxNode(node); @@ -1609,7 +1626,8 @@ internal protected virtual CSharpSyntaxNode GetBindableSyntaxNode(CSharpSyntaxNo !(node is OrderingSyntax) && !(node is JoinIntoClauseSyntax) && !(node is QueryContinuationSyntax) && - !(node is ArrowExpressionClauseSyntax)) + !(node is ArrowExpressionClauseSyntax) && + !(node is SubPropertyPatternSyntax)) { return GetBindableSyntaxNode(parent); } diff --git a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs index 4fd3d08bdb327..b254dafaba1b0 100644 --- a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs @@ -423,6 +423,13 @@ internal override Optional GetConstantValueWorker(CSharpSyntaxNode node, return (model == null) ? default(TypeInfo) : model.GetTypeInfo(node, cancellationToken); } + public override SymbolInfo GetSymbolInfo(SubPropertyPatternSyntax node, CancellationToken cancellationToken) + { + CheckSyntaxNode(node); + var model = this.GetMemberModel(node); + return (model == null) ? default(SymbolInfo) : model.GetSymbolInfo(node, cancellationToken); + } + public override IPropertySymbol GetDeclaredSymbol(AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) { CheckSyntaxNode(declaratorSyntax); diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs index cb663b4a6e658..112d68f99e23f 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs @@ -1332,9 +1332,9 @@ private void AssignPatternVariables(BoundPattern pattern) case BoundKind.PropertyPattern: { var pat = (BoundPropertyPattern)pattern; - foreach (var prop in pat.Patterns) + foreach (var prop in pat.Subpatterns) { - AssignPatternVariables(prop); + AssignPatternVariables(prop.Pattern); } break; } @@ -1407,9 +1407,9 @@ private void CreateSlots(BoundPattern pattern) case BoundKind.PropertyPattern: { var pat = (BoundPropertyPattern)pattern; - foreach (var prop in pat.Patterns) + foreach (var prop in pat.Subpatterns) { - CreateSlots(prop); + CreateSlots(prop.Pattern); } break; } diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass_Switch.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass_Switch.cs index 4a676309dffb4..1f7a691b29660 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass_Switch.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass_Switch.cs @@ -270,12 +270,11 @@ public virtual void VisitPattern(BoundExpression expression, BoundPattern patter { // so far so good: the expression is known to match the *type* of the property pattern. // Now check if each subpattern is irrefutable. - Debug.Assert(propPattern.Properties.Length == propPattern.Patterns.Length); - int n = propPattern.Properties.Length; + int n = propPattern.Subpatterns.Length; for (int i = 0; i < n; i++) { - var prop = propPattern.Properties[i]; - var pat = propPattern.Patterns[i]; + var prop = propPattern.Subpatterns[i].Property; + var pat = propPattern.Subpatterns[i].Pattern; BoundExpression subExpr; switch (prop.Kind) { diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs index 57b781ae63287..190d9ed8083f3 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs @@ -46,10 +46,10 @@ BoundExpression TranslatePattern(BoundExpression input, BoundPattern pattern) var temp = _factory.SynthesizedLocal(pat.Type); var matched = DeclPattern(syntax, input, temp); input = _factory.Local(temp); - for (int i = 0; i < pat.Patterns.Length; i++) + for (int i = 0; i < pat.Subpatterns.Length; i++) { - var subProperty = pat.Properties[i]; - var subPattern = pat.Patterns[i]; + var subProperty = pat.Subpatterns[i].Property; + var subPattern = pat.Subpatterns[i].Pattern; var subExpression = subProperty.Kind == SymbolKind.Field ? (BoundExpression)_factory.Field(input, (FieldSymbol)subProperty) diff --git a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt index c5f850e5562f0..843e1e207cdb9 100644 --- a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt @@ -5,24 +5,6 @@ Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions.WithPublicSign(bool publi Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken delegateKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken equalsToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax value) -> Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken forKeyword, Microsoft.CodeAnalysis.SyntaxToken openParenToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SeparatedSyntaxList initializers, Microsoft.CodeAnalysis.SyntaxToken firstSemicolonToken, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax condition, Microsoft.CodeAnalysis.SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.SeparatedSyntaxList incrementors, Microsoft.CodeAnalysis.SyntaxToken closeParenToken, Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax statement) -> Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken thisKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.BracketedParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax.Update(Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax.Pattern.get -> Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.SyntaxToken colonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax @@ -41,6 +23,21 @@ Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax.Type.get -> Micros Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax.Update(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.SyntaxToken identifier) -> Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax.WithIdentifier(Microsoft.CodeAnalysis.SyntaxToken identifier) -> Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax.WithType(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken delegateKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken equalsToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax value) -> Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken forKeyword, Microsoft.CodeAnalysis.SyntaxToken openParenToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SeparatedSyntaxList initializers, Microsoft.CodeAnalysis.SyntaxToken firstSemicolonToken, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax condition, Microsoft.CodeAnalysis.SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.SeparatedSyntaxList incrementors, Microsoft.CodeAnalysis.SyntaxToken closeParenToken, Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax statement) -> Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken thisKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.BracketedParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax Microsoft.CodeAnalysis.CSharp.Syntax.IsPatternExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.IsPatternExpressionSyntax.Expression.get -> Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.IsPatternExpressionSyntax.IsKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken @@ -67,6 +64,9 @@ Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax.WithLetKeyword(Microsoft Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax.WithPattern(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax.WithSemicolonToken(Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax.WithWhenClause(Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause) -> Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax.Update(Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.AddBodyStatements(params Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax[] items) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.AddConstraintClauses(params Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterConstraintClauseSyntax[] items) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax @@ -94,21 +94,6 @@ Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.WithRefKeyword Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.WithReturnType(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.WithSemicolonToken(Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.WithTypeParameterList(Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax body, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax initializer, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken returnKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax parameter, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax.AddSections(params Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax[] items) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax.CloseParenToken.get -> Microsoft.CodeAnalysis.SyntaxToken @@ -134,7 +119,16 @@ Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax.WithColonToken(Microsoft Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax.WithExpression(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax.WithPattern(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax.WithWhenClause(Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax body, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.Update(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax initializer, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternSyntax.AddPatternListSubPatterns(params Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax[] items) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternSyntax.PatternList.get -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax @@ -149,6 +143,12 @@ Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax.Type.get -> Microsof Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax.Update(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax patternList) -> Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax.WithPatternList(Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax patternList) -> Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax.WithType(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken returnKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax.RefKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax parameter, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax.WithRefKeyword(Microsoft.CodeAnalysis.SyntaxToken refKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax.AddSubPatterns(params Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax[] items) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax.CloseBraceToken.get -> Microsoft.CodeAnalysis.SyntaxToken @@ -246,10 +246,6 @@ override Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax.Accept(Microsof override Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> TResult override Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> void override Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> TResult -static Microsoft.CodeAnalysis.CSharp.SyntaxExtensions.Update(this Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax syntax, Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken thisKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.BracketedParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxExtensions.Update(this Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax syntax, Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax block, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ArrowExpressionClause(Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.DelegateDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken delegateKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax override Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> void override Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> TResult override Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> void @@ -274,41 +270,46 @@ override Microsoft.CodeAnalysis.CSharp.Syntax.WildcardPatternSyntax.Accept(Micro override Microsoft.CodeAnalysis.CSharp.Syntax.WildcardPatternSyntax.Accept(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor visitor) -> TResult static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol +static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetSymbolInfo(this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.SymbolInfo +static Microsoft.CodeAnalysis.CSharp.SyntaxExtensions.Update(this Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax syntax, Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken thisKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.BracketedParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxExtensions.Update(this Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax syntax, Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax block, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ArrowExpressionClause(Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CasePatternSwitchLabel(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.SyntaxToken colonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CasePatternSwitchLabel(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.SyntaxToken colonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CasePatternSwitchLabel(Microsoft.CodeAnalysis.SyntaxToken keyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.SyntaxToken colonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ConstantPattern(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.ConstantPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.DeclarationPattern(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.SyntaxToken identifier) -> Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.DelegateDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken delegateKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.DocumentationComment(params Microsoft.CodeAnalysis.CSharp.Syntax.XmlNodeSyntax[] content) -> Microsoft.CodeAnalysis.CSharp.Syntax.DocumentationCommentTriviaSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.EqualsValueClause(Microsoft.CodeAnalysis.SyntaxToken equalsToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax value) -> Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ForStatement(Microsoft.CodeAnalysis.SyntaxToken forKeyword, Microsoft.CodeAnalysis.SyntaxToken openParenToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SeparatedSyntaxList initializers, Microsoft.CodeAnalysis.SyntaxToken firstSemicolonToken, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax condition, Microsoft.CodeAnalysis.SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.SeparatedSyntaxList incrementors, Microsoft.CodeAnalysis.SyntaxToken closeParenToken, Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax statement) -> Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.IncompleteMember(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.IndexerDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken thisKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.BracketedParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LocalDeclarationStatement(Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.IsPatternExpression(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.IsPatternExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.IsPatternExpression(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken isKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.IsPatternExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LetStatement(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LetStatement(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.CSharp.Syntax.ElseClauseSyntax elseClause) -> Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LetStatement(Microsoft.CodeAnalysis.SyntaxToken letKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.SyntaxToken equalsToken, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.CSharp.Syntax.ElseClauseSyntax elseClause, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LetStatementSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LocalDeclarationStatement(Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LocalFunctionStatement(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LocalFunctionStatement(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, string identifier) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LocalFunctionStatement(Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax body, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.LocalFunctionStatement(Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax body, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MethodDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax body, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.PropertyDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax initializer, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ReturnStatement(Microsoft.CodeAnalysis.SyntaxToken returnKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SimpleLambdaExpression(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax parameter, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MatchExpression(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax left) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MatchExpression(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax left, Microsoft.CodeAnalysis.SyntaxList sections) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MatchExpression(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax left, Microsoft.CodeAnalysis.SyntaxToken matchToken, Microsoft.CodeAnalysis.SyntaxToken openParenToken, Microsoft.CodeAnalysis.SyntaxList sections, Microsoft.CodeAnalysis.SyntaxToken closeParenToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MatchSection(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MatchSection(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MatchSection(Microsoft.CodeAnalysis.SyntaxToken caseKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern, Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax whenClause, Microsoft.CodeAnalysis.SyntaxToken colonToken, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) -> Microsoft.CodeAnalysis.CSharp.Syntax.MatchSectionSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.MethodDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax returnType, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameterList, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxList constraintClauses, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax body, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.PropertyDeclaration(Microsoft.CodeAnalysis.SyntaxList attributeLists, Microsoft.CodeAnalysis.SyntaxTokenList modifiers, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax accessorList, Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax expressionBody, Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax initializer, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.PropertyPattern(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.PropertyPattern(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax patternList) -> Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.RecursivePattern(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type) -> Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.RecursivePattern(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax patternList) -> Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ReturnStatement(Microsoft.CodeAnalysis.SyntaxToken returnKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SimpleLambdaExpression(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax parameter, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax left, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax left, Microsoft.CodeAnalysis.SyntaxToken isKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(string left, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax diff --git a/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs b/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs index f332b0bab35f4..9b5eadad24214 100644 --- a/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs +++ b/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs @@ -2148,6 +2148,13 @@ internal static CSharpSyntaxNode GetStandaloneNode(CSharpSyntaxNode node) switch (parent.Kind()) { + case SyntaxKind.SubPropertyPattern: + if (((SubPropertyPatternSyntax)parent).Left == node) + { + return parent; + } + + break; case SyntaxKind.QualifiedName: if (((QualifiedNameSyntax)parent).Right == node) { diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs index 7d971922ecb46..9df131a848826 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs @@ -1029,6 +1029,39 @@ void Test12() VerifyNotInScope(model, x12Ref[1]); } + [Fact] + public void PropertyNamedInComplexPattern() + { + var source = +@" +using System; +public class Program +{ + public static void Main() + { + object o = nameof(Main); + Console.WriteLine(o is string { Length is 4 }); + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + + compilation.VerifyDiagnostics(); + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + var propPats = tree.GetRoot().DescendantNodes().OfType().ToArray(); + foreach (var p in propPats) + { + var si = model.GetSymbolInfo(p); + Assert.NotNull(si.Symbol); + Assert.Equal("Length", si.Symbol.Name); + si = model.GetSymbolInfo(p.Left); + Assert.NotNull(si.Symbol); + Assert.Equal("Length", si.Symbol.Name); + } + + } + private static void VerifyModelForDeclarationPattern(SemanticModel model, DeclarationPatternSyntax decl, params IdentifierNameSyntax[] references) { var symbol = model.GetDeclaredSymbol(decl); From 75aaa92b150b47c454b55182121f1a94c9a24797 Mon Sep 17 00:00:00 2001 From: Neal Gafter Date: Fri, 26 Feb 2016 20:23:41 -0800 Subject: [PATCH 2/2] Pattern-matching changes suggested by code reivew --- .../CSharp/Portable/Binder/Binder_Patterns.cs | 26 +++++++++++----- .../CSharp/Portable/CSharpExtensions.cs | 11 +------ .../Compilation/CSharpSemanticModel.cs | 10 ++---- .../Parser/LanguageParser_Patterns.cs | 2 +- .../CSharp/Portable/PublicAPI.Unshipped.txt | 10 +++--- .../CSharp/Portable/Syntax/Syntax.xml | 4 ++- .../CSharp/Portable/Syntax/SyntaxFactory.cs | 7 ----- .../Semantics/PatternMatchingTests.cs | 31 ++++++++++++------- 8 files changed, 50 insertions(+), 51 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs index 970ccbd61863d..2bd20be8accca 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs @@ -120,11 +120,12 @@ private BoundPattern BindRecursivePattern(RecursivePatternSyntax node, BoundExpr // use a dedicated bound node for that form. var properties = correspondingMembers; var boundPatterns = BindRecursiveSubPropertyPatterns(node, properties, type, diagnostics); - var builder = ArrayBuilder.GetInstance(); + var builder = ArrayBuilder.GetInstance(properties.Length); for (int i = 0; i < properties.Length; i++) { builder.Add(new BoundSubPropertyPattern(node.PatternList.SubPatterns[i], properties[i].GetTypeOrReturnType(), properties[i], LookupResultKind.Empty, boundPatterns[i], hasErrors)); } + return new BoundPropertyPattern(node, type, builder.ToImmutableAndFree(), hasErrors: hasErrors); } @@ -180,7 +181,7 @@ private ImmutableArray BindSubPropertyPatterns(Property BoundPattern pattern; HashSet useSiteDiagnostics = null; LookupResultKind resultKind; - Symbol property = FindPropertyByName(type, propName, out resultKind, ref useSiteDiagnostics); + Symbol property = FindPropertyOrFieldByName(type, propName, out resultKind, ref useSiteDiagnostics); if ((object)property != null) { bool hasErrors = false; @@ -200,7 +201,7 @@ private ImmutableArray BindSubPropertyPatterns(Property } else { - Error(diagnostics, ErrorCode.ERR_NoSuchMember, propName, type, propName.Identifier.ValueText); + Error(diagnostics, ErrorCode.ERR_NoSuchMember, propName, type, propName.ValueText); pattern = new BoundWildcardPattern(node, hasErrors: true); result.Add(new BoundSubPropertyPattern(syntax, CreateErrorType(), null, resultKind, pattern, true)); } @@ -209,12 +210,13 @@ private ImmutableArray BindSubPropertyPatterns(Property return result.ToImmutableAndFree(); } - private Symbol FindPropertyByName(TypeSymbol type, IdentifierNameSyntax name, out LookupResultKind resultKind, ref HashSet useSiteDiagnostics) + private Symbol FindPropertyOrFieldByName(TypeSymbol type, SyntaxToken name, out LookupResultKind resultKind, ref HashSet useSiteDiagnostics) { var symbols = ArrayBuilder.GetInstance(); var lookupResult = LookupResult.GetInstance(); - this.LookupMembersWithFallback(lookupResult, type, name.Identifier.ValueText, arity: 0, useSiteDiagnostics: ref useSiteDiagnostics); + this.LookupMembersWithFallback(lookupResult, type, name.ValueText, arity: 0, useSiteDiagnostics: ref useSiteDiagnostics); resultKind = lookupResult.Kind; + Symbol result = null; if (lookupResult.IsMultiViable) { @@ -222,14 +224,22 @@ private Symbol FindPropertyByName(TypeSymbol type, IdentifierNameSyntax name, ou { if (symbol.Kind == SymbolKind.Property || symbol.Kind == SymbolKind.Field) { - return symbol; + if (result != null && symbol != result) + { + resultKind = LookupResultKind.Ambiguous; + result = null; + break; + } + else + { + result = symbol; + } } } } - resultKind = lookupResult.Kind; lookupResult.Free(); - return null; + return result; } private BoundPattern BindConstantPattern(ConstantPatternSyntax node, BoundExpression operand, TypeSymbol operandType, bool hasErrors, DiagnosticBag diagnostics) diff --git a/src/Compilers/CSharp/Portable/CSharpExtensions.cs b/src/Compilers/CSharp/Portable/CSharpExtensions.cs index 2f78150faef71..bc3c4c4300579 100644 --- a/src/Compilers/CSharp/Portable/CSharpExtensions.cs +++ b/src/Compilers/CSharp/Portable/CSharpExtensions.cs @@ -462,16 +462,7 @@ public static Conversion ClassifyConversion(this Compilation compilation, ITypeS var csmodel = semanticModel as CSharpSemanticModel; if (csmodel != null) { - // Because it is a Identifier, the left-hand-side of a sub-property pattern appears to be an expression, but really is not an expression. - var possibleParentOfProperty = expression.Parent as SubPropertyPatternSyntax; - if (possibleParentOfProperty?.Left == expression) - { - return csmodel.GetSymbolInfo(possibleParentOfProperty, cancellationToken); - } - else - { - return csmodel.GetSymbolInfo(expression, cancellationToken); - } + return csmodel.GetSymbolInfo(expression, cancellationToken); } else { diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs index 0a970e96b49eb..df85a18477e17 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpSemanticModel.cs @@ -498,7 +498,7 @@ internal virtual IOperation GetOperationWorker(CSharpSyntaxNode node, GetOperati /// /// Gets the symbol information for the property of a sub-property pattern. /// - public abstract SymbolInfo GetSymbolInfo(SubPropertyPatternSyntax node, CancellationToken cancellationToken); + public abstract SymbolInfo GetSymbolInfo(SubPropertyPatternSyntax node, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns what symbol(s), if any, the given expression syntax bound to in the program. @@ -4315,12 +4315,6 @@ private SymbolInfo GetSymbolInfoFromNode(SyntaxNode node, CancellationToken canc throw new ArgumentNullException(nameof(node)); } - var subPropertyPattern = node.Parent as SubPropertyPatternSyntax; - if (subPropertyPattern != null && subPropertyPattern.Left == node) - { - return this.GetSymbolInfo(subPropertyPattern, cancellationToken); - } - var expression = node as ExpressionSyntax; if (expression != null) { @@ -4357,7 +4351,7 @@ private SymbolInfo GetSymbolInfoFromNode(SyntaxNode node, CancellationToken canc return this.GetSymbolInfo(orderingSyntax, cancellationToken); } - subPropertyPattern = node as SubPropertyPatternSyntax; + var subPropertyPattern = node as SubPropertyPatternSyntax; if (subPropertyPattern != null) { return this.GetSymbolInfo(subPropertyPattern, cancellationToken); diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs index 3153344c58eef..e45380d017f9f 100644 --- a/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs @@ -343,7 +343,7 @@ private bool IsPossibleSubPropertyPattern() private SubPropertyPatternSyntax ParseSubPropertyPattern() { - var name = this.ParseIdentifierName(); + var name = this.EatToken(SyntaxKind.IdentifierToken); var operandToken = this.EatToken(SyntaxKind.IsKeyword); PatternSyntax pattern = this.CurrentToken.Kind == SyntaxKind.CommaToken ? diff --git a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt index 843e1e207cdb9..f616f6e845609 100644 --- a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt @@ -160,11 +160,11 @@ Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax.WithOpenBraceT Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax.WithSubPatterns(Microsoft.CodeAnalysis.SeparatedSyntaxList subPatterns) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.IsKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.Left.get -> Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.Left.get -> Microsoft.CodeAnalysis.SyntaxToken Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.Pattern.get -> Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.Update(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax left, Microsoft.CodeAnalysis.SyntaxToken isKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken left, Microsoft.CodeAnalysis.SyntaxToken isKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.WithIsKeyword(Microsoft.CodeAnalysis.SyntaxToken isKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax -Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.WithLeft(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax left) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.WithLeft(Microsoft.CodeAnalysis.SyntaxToken left) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax.WithPattern(Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax.AddSubPatterns(params Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternSyntax[] items) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax @@ -310,8 +310,8 @@ static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.RecursivePattern(Microsoft.Co static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.RecursivePattern(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax type, Microsoft.CodeAnalysis.CSharp.Syntax.SubRecursivePatternListSyntax patternList) -> Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ReturnStatement(Microsoft.CodeAnalysis.SyntaxToken returnKeyword, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SimpleLambdaExpression(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax parameter, Microsoft.CodeAnalysis.SyntaxToken arrowToken, Microsoft.CodeAnalysis.SyntaxToken refKeyword, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax left, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax left, Microsoft.CodeAnalysis.SyntaxToken isKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(Microsoft.CodeAnalysis.SyntaxToken left, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(Microsoft.CodeAnalysis.SyntaxToken left, Microsoft.CodeAnalysis.SyntaxToken isKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPattern(string left, Microsoft.CodeAnalysis.CSharp.Syntax.PatternSyntax pattern) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPatternList(Microsoft.CodeAnalysis.SeparatedSyntaxList subPatterns = default(Microsoft.CodeAnalysis.SeparatedSyntaxList)) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.SubPropertyPatternList(Microsoft.CodeAnalysis.SyntaxToken openBraceToken, Microsoft.CodeAnalysis.SeparatedSyntaxList subPatterns, Microsoft.CodeAnalysis.SyntaxToken closeBraceToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.SubPropertyPatternListSyntax diff --git a/src/Compilers/CSharp/Portable/Syntax/Syntax.xml b/src/Compilers/CSharp/Portable/Syntax/Syntax.xml index 9da2c1fed1f4b..3499be8770d11 100644 --- a/src/Compilers/CSharp/Portable/Syntax/Syntax.xml +++ b/src/Compilers/CSharp/Portable/Syntax/Syntax.xml @@ -1736,7 +1736,9 @@ - + + + diff --git a/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs b/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs index 9b5eadad24214..f332b0bab35f4 100644 --- a/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs +++ b/src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs @@ -2148,13 +2148,6 @@ internal static CSharpSyntaxNode GetStandaloneNode(CSharpSyntaxNode node) switch (parent.Kind()) { - case SyntaxKind.SubPropertyPattern: - if (((SubPropertyPatternSyntax)parent).Left == node) - { - return parent; - } - - break; case SyntaxKind.QualifiedName: if (((QualifiedNameSyntax)parent).Right == node) { diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs index 9df131a848826..7b89ca7e367f3 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs @@ -1041,25 +1041,34 @@ public static void Main() { object o = nameof(Main); Console.WriteLine(o is string { Length is 4 }); + Console.WriteLine(o is string { NotFound is 4 }); } } "; var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); - compilation.VerifyDiagnostics(); + compilation.VerifyDiagnostics( + // (9,41): error CS0117: 'string' does not contain a definition for 'NotFound' + // Console.WriteLine(o is string { NotFound is 4 }); + Diagnostic(ErrorCode.ERR_NoSuchMember, "NotFound").WithArguments("string", "NotFound").WithLocation(9, 41) + ); var tree = compilation.SyntaxTrees.Single(); var model = compilation.GetSemanticModel(tree); var propPats = tree.GetRoot().DescendantNodes().OfType().ToArray(); - foreach (var p in propPats) - { - var si = model.GetSymbolInfo(p); - Assert.NotNull(si.Symbol); - Assert.Equal("Length", si.Symbol.Name); - si = model.GetSymbolInfo(p.Left); - Assert.NotNull(si.Symbol); - Assert.Equal("Length", si.Symbol.Name); - } - + Assert.Equal(2, propPats.Length); + + var p = propPats[0]; // Length is 4 + var si = model.GetSymbolInfo(p); + Assert.NotNull(si.Symbol); + Assert.Equal("Length", si.Symbol.Name); + Assert.Equal(CandidateReason.None, si.CandidateReason); + Assert.True(si.CandidateSymbols.IsDefaultOrEmpty); + + p = propPats[1]; // NotFound is 4 + si = model.GetSymbolInfo(p); + Assert.Null(si.Symbol); + Assert.Equal(CandidateReason.None, si.CandidateReason); + Assert.True(si.CandidateSymbols.IsDefaultOrEmpty); } private static void VerifyModelForDeclarationPattern(SemanticModel model, DeclarationPatternSyntax decl, params IdentifierNameSyntax[] references)