dotnet / dotnet/csharpstandard
CallerMemberNameAttribute on parameter of attribute constructor referenced by a local function or its type parameter
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
(I'll reformat this to match the issue template next weekend, if not sooner.)
```csharp
using System;
using System.Runtime.CompilerServices;
public class MAttribute : Attribute {
public MAttribute(
[CallerMemberName]string? name = null) {
}
}
class C {
void Fun1() {
void Fun2<[M]T>(){}
}
}
```
SharpLab shows this being lowered to `void Fun2<[M("Fun2")]T>(){}` but the draft seems to require `void Fun2<[M("Fun1")]T>(){}` because Fun2 as a local function is not a function member. Now is that a compiler bug or a spec bug?
_Originally posted by @KalleOlaviNiemitalo in https://github.com/dotnet/csharpstandard/pull/1548#issuecomment-3794804052_
Contributor guide
Assessment
This issue has not been assessed yet.