Add parameters in scope in nameof in certain attributes#60642
Add parameters in scope in nameof in certain attributes#60642jcouv merged 7 commits intodotnet:features/nameof-parameterfrom
Conversation
|
|
||
| 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.
📝 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.
📝 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. |
| 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), |
| VerifyTParameter(comp, 0, "void local<TParameter>(System.Int32 TParameter)"); | ||
| VerifyTParameter(comp, 1, "void C.M2<TParameter>(System.Int32 TParameter)"); | ||
|
|
||
| source = @" |
|
|
||
| VerifyTParameter(comp, 0, "MyDelegate<TParameter>"); | ||
|
|
||
| source = @" |
There was a problem hiding this comment.
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.
Correction: I can share the same source with a minor tweak to VerifyParameter to configure the name of the parameter.
Made a corresponding change to speclet: dotnet/csharplang#5995
Test plan #40524