提交 5ed0ddb2 编写于 作者: C Cyrus Najmabadi

Use WithLocation

上级 4d48b66c
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license. // The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle;
...@@ -135,15 +136,15 @@ public async Task TestNotWithErrorTypes() ...@@ -135,15 +136,15 @@ public async Task TestNotWithErrorTypes()
@" @"
class C class C
{ {
E c = new E(); {|#0:E|} c = new {|#1:E|}();
}" }"
}, },
ExpectedDiagnostics = ExpectedDiagnostics =
{ {
// /0/Test0.cs(4,5): error CS0246: The type or namespace name 'E' could not be found (are you missing a using directive or an assembly reference?) // /0/Test0.cs(4,5): error CS0246: The type or namespace name 'E' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(4, 5, 4, 6).WithArguments("E"), DiagnosticResult.CompilerError("CS0246").WithLocation(0).WithArguments("E"),
// /0/Test0.cs(4,15): error CS0246: The type or namespace name 'E' could not be found (are you missing a using directive or an assembly reference?) // /0/Test0.cs(4,15): error CS0246: The type or namespace name 'E' could not be found (are you missing a using directive or an assembly reference?)
DiagnosticResult.CompilerError("CS0246").WithSpan(4, 15, 4, 16).WithArguments("E"), DiagnosticResult.CompilerError("CS0246").WithLocation(1).WithArguments("E"),
} }
}, },
LanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp9, LanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp9,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册