Skip to content

CallerMemberNameAttribute on parameter of attribute constructor referenced by a local function or its type parameter #1553

Description

@KalleOlaviNiemitalo

(I'll reformat this to match the issue template next weekend, if not sooner.)

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 #1548 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions