dotnet/roslyn
Move static members to another type does not use the correct visibility
开放
#58,502 创建于 2021年12月27日
Area-IDEBughelp wanted
仓库指标
- 星标
- (20,414 个星标)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 256 个 PR)
描述
Related to https://github.com/dotnet/roslyn/issues/55127
Version Used: Version 17.1.0 Preview 1.1
Steps to Reproduce:
- Create a new class library, paste the following code in:
class Test
{
private const string TestConstant = "";
void M()
{
_ = TestConstant;
}
}
- Ctrl+. on TestConstant, select "Move static members to another type..."
- 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.