提交 14fb96d6 编写于 作者: A Andrew Hall (METAL)

Only ignore on compiler errors

上级 0ab9da32
......@@ -3507,6 +3507,45 @@ string S()
return null;
}
void Method<T>(Func<T, string> o)
{
}
}");
}
[WorkItem(29793, "https://github.com/dotnet/roslyn/issues/29793")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestWithDeclarationWarning()
{
await TestInRegularAndScript1Async(
@"using System;
class C
{
void M()
{
#warning Declaration Warning
Func<int, string> [||]f = _ => null;
Method(f);
}
void Method<T>(Func<T, string> o)
{
}
}",
@"using System;
class C
{
void M()
{
#warning Declaration Warning
string f(int _) => null;
Method((Func<int, string>)f);
}
void Method<T>(Func<T, string> o)
{
}
......
......@@ -106,10 +106,10 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext, INamedTyp
return;
}
// If there are compiler diagnostics on the declaration we can't reliably
// If there are compiler error on the declaration we can't reliably
// tell that the refactoring will be accurate, so don't provide any
// code diagnostics
if (localDeclaration.GetDiagnostics().Any())
if (localDeclaration.GetDiagnostics().Any(d => d.Severity == DiagnosticSeverity.Error))
{
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册