未验证 提交 60d89c91 编写于 作者: J Julien Couvreur 提交者: GitHub

IntroduceVariable on target-typed new (#48076)

上级 fd27fc7f
......@@ -7775,6 +7775,42 @@ public void M(string s)
string {|Rename:v|} = $"""";
s.Bar(v);
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsIntroduceVariable)]
[WorkItem(44656, "https://github.com/dotnet/roslyn/issues/44656")]
public async Task ImplicitObjectCreation()
{
await TestInRegularAndScriptAsync(@"
class A
{
public void Create(A a, B b)
{
}
}
class B
{
void M()
{
new A().Create(new A(), [|new(1)|]);
}
}", @"
class A
{
public void Create(A a, B b)
{
}
}
class B
{
void M()
{
B {|Rename:b|} = new(1);
new A().Create(new A(), b);
}
}");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册