Skip to content
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 Support for Name shadowing #608

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

RexJaeschke
Copy link
Contributor

@RexJaeschke RexJaeschke commented Aug 8, 2022

@RexJaeschke RexJaeschke added this to the C# 8.0 milestone Aug 8, 2022
@RexJaeschke RexJaeschke marked this pull request as draft August 8, 2022 13:43
@BillWagner BillWagner force-pushed the Name-Shadowing branch 2 times, most recently from 3305913 to 2526b97 Compare February 6, 2023 13:35
@RexJaeschke RexJaeschke added the type: feature This issue describes a new feature label Jul 22, 2023
@BillWagner
Copy link
Member

rebased on 09/26/2023

@RexJaeschke Oddly enough, additional changes in basic-concepts.md appeared after rebasing. Let me know if we need to revert some of those changes.

@RexJaeschke
Copy link
Contributor Author

My latest commit is intended to address @BillWagner's comment. It probably also addresses @KalleOlaviNiemitalo 's comment.

@RexJaeschke RexJaeschke added the Review: pending Proposal is available for review label Oct 13, 2023
@RexJaeschke RexJaeschke marked this pull request as ready for review January 11, 2024 14:12
@jskeet jskeet added the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Apr 30, 2024
@BillWagner BillWagner self-assigned this Apr 30, 2024
@sequestor sequestor bot added seQUESTered and removed reQUEST labels May 1, 2024
Copy link
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

I'm concerned that we need to be careful not to remove more restrictions than we want. My understanding is that shadowing is only permitted in a very few situations - you still can't write:

public void M()
{
    int x = 10;
    if (x == 10)
    {
        int x = 5;
        Console.WriteLine(x);
    }
}

... right? That may already be covered - I'll try to check before the meeting - but we need to make sure that it is still covered.

Copy link
Contributor

@Nigel-Ecma Nigel-Ecma left a comment

Choose a reason for hiding this comment

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

Kalle's observation on nameof is either a bug or special case handling of nameof in declarations which is probably not clear in the Standard. If the former it has no impact here, if the latter it also has no impact here as it is the wrong place to describe it so an issue should be raised to deal with it.

Apart from that this looks good

@jskeet
Copy link
Contributor

jskeet commented May 15, 2024

That may already be covered - I'll try to check before the meeting - but we need to make sure that it is still covered.

Nigel's pretty convinced that this isn't a problem - the onus is on me to convince myself too.

@BillWagner
Copy link
Member

closing and reopening for a fresh CI build (test examples should pass now)

@BillWagner BillWagner closed this May 30, 2024
@BillWagner BillWagner reopened this May 30, 2024
@Nigel-Ecma Nigel-Ecma self-requested a review June 12, 2024 18:06
Copy link
Contributor

@Nigel-Ecma Nigel-Ecma left a comment

Choose a reason for hiding this comment

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

Triggered in error, my last review stands – approved!

@jskeet
Copy link
Contributor

jskeet commented Jun 12, 2024

Closed and reopened to check the test again... then we can merge on green. (I've created #1131 to check my earlier concern.)

@jskeet
Copy link
Contributor

jskeet commented Jun 12, 2024

Tests are still failing - leaving assigned to @BillWagner to check up on. (Feel free to assign it back to me Bill.)

@BillWagner BillWagner merged commit 3202f19 into dotnet:draft-v8 Jun 24, 2024
7 checks passed
@BillWagner BillWagner deleted the Name-Shadowing branch June 24, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meeting: discuss This issue should be discussed at the next TC49-TG2 meeting Review: pending Proposal is available for review type: feature This issue describes a new feature
Projects
No open projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

5 participants