-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parameters in scope in nameof in certain attributes #60642
Conversation
@@ -49,14 +51,42 @@ private bool IsNameofOperator | |||
|
|||
internal override void LookupSymbolsInSingleBinder(LookupResult result, string name, int arity, ConsList<TypeSymbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) | |||
{ | |||
bool foundParameter = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 See LookupSymbolsInternal
for context on this change #Resolved
@AlekseyTs @RikkiGibson @dotnet/roslyn-compiler for review. Thanks |
@AlekseyTs @RikkiGibson for review. Thanks |
src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs
Outdated
Show resolved
Hide resolved
Updated following decision from email thread. Thanks @RikkiGibson |
comp = CreateCompilation(source); | ||
comp.VerifyDiagnostics(); | ||
|
||
VerifyParameter(comp, 0, "System.Int32 C.this[System.Int32 parameter].get"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 I don't have a strong opinion on whether the indexer parameter or the accessor parameter should be found. I went with accessor parameter because that seems more consistent with methods and other targets. #Resolved
@AlekseyTs @RikkiGibson This is ready for another look. Thanks |
@RikkiGibson I'll let you take the first pass at the latest changes. |
Done with review pass (commit 5) |
Sorry, it looks like I missed the comment this morning. 😓 |
"; | ||
comp = CreateCompilation(source, parseOptions: TestOptions.RegularNext); | ||
comp.VerifyDiagnostics( | ||
// (2,49): warning CS8981: The type name 'parameter' only contains lower-cased ascii characters. Such names may become reserved for the language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comp.VerifyDiagnostics( | ||
// (8,20): warning CS8981: The type name 'parameter' only contains lower-cased ascii characters. Such names may become reserved for the language. | ||
// void local<parameter>([My(nameof(parameter))] int parameter) => throw null; | ||
Diagnostic(ErrorCode.WRN_LowerCaseTypeName, "parameter").WithArguments("parameter").WithLocation(8, 20), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VerifyTParameter(comp, 0, "void local<TParameter>(System.Int32 TParameter)"); | ||
VerifyTParameter(comp, 1, "void C.M2<TParameter>(System.Int32 TParameter)"); | ||
|
||
source = @" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
VerifyTParameter(comp, 0, "MyDelegate<TParameter>"); | ||
|
||
source = @" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is. There's some differences between VerifyParameter and VerifyTParameter, for instance around SymbolKind check and LookupSymbols expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: I can share the same source with a minor tweak to VerifyParameter to configure the name of the parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 6)
Made a corresponding change to speclet: dotnet/csharplang#5995
Test plan #40524