From a102b6cefc56fcc9ee8f307f460ff3b931dbacb5 Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Sat, 7 Jan 2023 16:26:51 -0800 Subject: [PATCH] PR feedback --- src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs | 6 +++--- src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs | 2 +- .../Synthesized/Records/SynthesizedRecordConstructor.cs | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index 57cdc3ba9c264..70294f9642ea1 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -1924,7 +1924,7 @@ private BoundExpression BindNonMethod(SimpleNameSyntax node, Symbol symbol, Bind if (primaryCtor is not null && (!IsInDeclaringTypeInstanceMember(primaryCtor) || - (this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } contaningMember && (object)contaningMember != primaryCtor)) && // We are in a non-primary instance constructor + (this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor !IsInsideNameof) { Error(diagnostics, ErrorCode.ERR_InvalidPrimaryConstructorParameterReference, node, parameter); @@ -2039,8 +2039,8 @@ private bool IsInDeclaringTypeInstanceMember(SynthesizedPrimaryConstructor prima { return !(InParameterDefaultValue || InAttributeArgument || - this.ContainingMember() is not { Kind: not SymbolKind.NamedType, IsStatic: false } contaningMember || // We are not in an instance member - (object)contaningMember.ContainingSymbol != primaryCtor.ContainingSymbol); // The member doesn't belong to our type, i.e. from nested type + this.ContainingMember() is not { Kind: not SymbolKind.NamedType, IsStatic: false } containingMember || // We are not in an instance member + (object)containingMember.ContainingSymbol != primaryCtor.ContainingSymbol); // The member doesn't belong to our type, i.e. from nested type } private bool ReportSimpleProgramLocalReferencedOutsideOfTopLevelStatement(SimpleNameSyntax node, Symbol symbol, BindingDiagnosticBag diagnostics) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs index 8aa78154ac4ff..48cd366f069b6 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs @@ -1564,7 +1564,7 @@ private BoundExpression ReplaceTypeOrValueReceiver(BoundExpression receiver, boo } } - private BoundExpression GetValueExpressionIfTypeOrValueReceiver(BoundExpression receiver) + private static BoundExpression GetValueExpressionIfTypeOrValueReceiver(BoundExpression receiver) { if ((object)receiver == null) { diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordConstructor.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordConstructor.cs index 338fe09669bf8..352eccfe68cc5 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordConstructor.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordConstructor.cs @@ -467,6 +467,7 @@ bool treatAsInstanceMemberAccess( return treatAsInstanceMemberAccess; } + // Follows the logic of BindQuery bool checkQuery(QueryExpressionSyntax query, Binder enclosingBinder) { if (checkParameterReferencesInNode(query.FromClause.Expression, enclosingBinder))