Skip to content

Restore CallerMemberName example#1548

Merged
BillWagner merged 1 commit into
v9-attribute-locationsfrom
Rex-restore-CallerMemberName-example
Jan 29, 2026
Merged

Restore CallerMemberName example#1548
BillWagner merged 1 commit into
v9-attribute-locationsfrom
Rex-restore-CallerMemberName-example

Conversation

@RexJaeschke

Copy link
Copy Markdown
Contributor

Jon, this addresses your comment.

@KalleOlaviNiemitalo

KalleOlaviNiemitalo commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Filed #1549. But also:

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?

@jskeet

jskeet commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

@KalleOlaviNiemitalo That looks like a compiler bug to me, if the spec change here is otherwise correct. Please could you file another issue for that? And thanks for #1549 - I think we've previously discussed that and decided not to specify the behavior, but I could be wrong, and it's fine for us to discuss it in a meeting.

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM as well.

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM

@BillWagner
BillWagner merged commit 655d59b into v9-attribute-locations Jan 29, 2026
9 checks passed
@BillWagner
BillWagner deleted the Rex-restore-CallerMemberName-example branch January 29, 2026 15:38
BillWagner pushed a commit that referenced this pull request Jan 29, 2026
BillWagner pushed a commit that referenced this pull request Apr 10, 2026
BillWagner pushed a commit that referenced this pull request May 12, 2026
BillWagner pushed a commit that referenced this pull request Jun 24, 2026
jskeet pushed a commit that referenced this pull request Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants