提交 49eeef6b 编写于 作者: C Cyrus Najmabadi

Do not qualify local functions whne complexifying them.

上级 a6f8496f
......@@ -4848,6 +4848,39 @@ void Test()
}
object Helper(CancellationToken ct) { return null; }
}");
}
[WorkItem(8716, "https://github.com/dotnet/roslyn/issues/8716")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTemporary)]
public async Task DoNotQualifyInlinedLocalFunction()
{
await TestInRegularAndScriptAsync(@"
using System;
class C
{
void Main()
{
void LocalFunc()
{
Console.Write(2);
}
var [||]local = new Action(LocalFunc);
local();
}
}",
@"
using System;
class C
{
void Main()
{
void LocalFunc()
{
Console.Write(2);
}
new Action(LocalFunc)();
}
}");
}
}
......
......@@ -692,7 +692,8 @@ SyntaxToken GetNewIdentifier(SyntaxToken _identifier)
}
else
{
if (!IsPropertyNameOfObjectInitializer(originalSimpleName))
if (!IsPropertyNameOfObjectInitializer(originalSimpleName) &&
!symbol.IsLocalFunction())
{
ExpressionSyntax left;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册