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

Move static members to another type does not use the correct visibility #58502

Open
333fred opened this issue Dec 27, 2021 · 0 comments
Open
Assignees
Labels
Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@333fred
Copy link
Member

333fred commented Dec 27, 2021

Related to #55127

Version Used: Version 17.1.0 Preview 1.1

Steps to Reproduce:

  1. Create a new class library, paste the following code in:
class Test
{
    private const string TestConstant = "";

    void M()
    {
        _ = TestConstant;
    }
}
  1. Ctrl+. on TestConstant, select "Move static members to another type..."
  2. Hit enter to accept the refactoring

Expected Behavior:

Generated code visibility allows for Test to see the constant.

Actual Behavior:

The following code is generated:

internal static class TestHelpers
{
    private const string TestConstant = "";
}

The constant is private, and compilation errors result as the original location cannot see the moved constant.

@333fred 333fred added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 27, 2021
@jinujoseph jinujoseph added Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 4, 2022
@jinujoseph jinujoseph added this to the 17.2 milestone Jan 4, 2022
@jinujoseph jinujoseph modified the milestones: 17.2, 17.3 May 5, 2022
@arunchndr arunchndr modified the milestones: 17.3, 17.6 P2 Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

No branches or pull requests

4 participants