提交 2b433bec 编写于 作者: B BattleRush

Fixing broken tests

上级 b0b90053
......@@ -7133,10 +7133,15 @@ static void F()
generation0,
ImmutableArray.Create(new SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables: true)));
// TODO: better error code
// TODO: better error code https://github.com/dotnet/roslyn/issues/11512
string expectedMessage = string.Format(CodeAnalysisResources.UnableToReadDebugInfo,
"C.F()",
"06000001",
"PdbReadingErrorsAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
diff1.EmitResult.Diagnostics.Verify(
// (6,14): error CS7038: Failed to emit module 'Unable to read debug information of method 'C.F()' (token 0x06000001) from assembly 'PdbReadingErrorsAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null''.
Diagnostic(ErrorCode.ERR_ModuleEmitFailure, "F").WithArguments("Unable to read debug information of method 'C.F()' (token 0x06000001) from assembly 'PdbReadingErrorsAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'").WithLocation(6, 14));
Diagnostic(ErrorCode.ERR_ModuleEmitFailure, "F").WithArguments(expectedMessage).WithLocation(6, 14));
}
[Fact]
......
......@@ -2598,9 +2598,9 @@ static void Main()
// (6,26): error CS1525: Invalid expression term '='
// const var (x, y) = (1, 2);
Diagnostic(ErrorCode.ERR_InvalidExprTerm, "=").WithArguments("=").WithLocation(6, 26),
// (6,19): error CS0501: '(x, y)' must declare a body because it is not marked abstract, extern, or partial
// (6,19): error CS8111: '(x, y)' is a local function and must therefore always have a body.
// const var (x, y) = (1, 2);
Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "").WithArguments("(x, y)").WithLocation(6, 19),
Diagnostic(ErrorCode.ERR_LocalFunctionMissingBody, "").WithArguments("(x, y)").WithLocation(6, 19),
// (6,20): error CS0246: The type or namespace name 'x' could not be found (are you missing a using directive or an assembly reference?)
// const var (x, y) = (1, 2);
Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "x").WithArguments("x").WithLocation(6, 20),
......
......@@ -1438,10 +1438,10 @@ static void Main(string[] args)
}
}";
VerifyDiagnostics(source,
// (6,14): error CS0501: 'Local(int)' must declare a body because it is not marked abstract, extern, or partial
// void Local(int x);
Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "Local").WithArguments("Local(int)").WithLocation(6, 14)
);
// (6,14): error CS8111: 'Local(int)' is a local function and must therefore always have a body.
// void Local(int x);
Diagnostic(ErrorCode.ERR_LocalFunctionMissingBody, "Local").WithArguments("Local(int)").WithLocation(6, 14)
);
}
[Fact]
......
......@@ -19281,9 +19281,9 @@ public static void Main()
// (10,28): error CS1003: Syntax error, ']' expected
// int d, e(out var x4); // parsed as a broken bracketed argument list on the declarator
Diagnostic(ErrorCode.ERR_SyntaxError, ")").WithArguments("]", ")").WithLocation(10, 28),
// (7,13): error CS0501: 'b(out var)' must declare a body because it is not marked abstract, extern, or partial
// (7,13): error CS08111: 'b(out var)' is a local function and must therefore always have a body.
// int b(out var x2) = null; // parsed as a local function with syntax error
Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "b").WithArguments("b(out var)").WithLocation(7, 13),
Diagnostic(ErrorCode.ERR_LocalFunctionMissingBody, "b").WithArguments("b(out var)").WithLocation(7, 13),
// (7,19): error CS0825: The contextual keyword 'var' may only appear within a local variable declaration or in script code
// int b(out var x2) = null; // parsed as a local function with syntax error
Diagnostic(ErrorCode.ERR_TypeVarNotFound, "var").WithLocation(7, 19),
......@@ -233,7 +233,7 @@ internal VariableSlotAllocator TryCreateVariableSlotAllocator(EmitBaseline basel
}
catch (InvalidDataException)
{
string message = string.Format(CodeAnalysisResources.AbsolutePathExpected,
string message = string.Format(CodeAnalysisResources.UnableToReadDebugInfo,
MessageProvider.GetErrorDisplayString(method),
MetadataTokens.GetToken(previousHandle).ToString("X8"),
MessageProvider.GetErrorDisplayString(method.ContainingAssembly));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册