Skip to content

Commit

Permalink
Fixup tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Jul 27, 2017
1 parent 88a0372 commit bbae3c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1953,9 +1953,6 @@ void M()
Assert.Equal(SymbolKind.Local, symbolInfo.Symbol.Kind);

compilation.VerifyDiagnostics(
// (11,15): error CS0822: Implicitly-typed variables cannot be constant
// const var E = E.A;
Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableCannotBeConst, "var E = E.A").WithLocation(11, 15),
// (11,23): error CS0841: Cannot use local variable 'E' before it is declared
// const var E = E.A;
Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "E").WithArguments("E").WithLocation(11, 23)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11537,12 +11537,9 @@ public static void Main()

var comp = CreateStandardCompilation(text);
comp.VerifyDiagnostics(
// (6,15): error CS0822: Implicitly-typed variables cannot be constant
// const var x = 0; // CS0822.cs
Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableCannotBeConst, "var x = 0").WithLocation(6, 15),
// (7,15): error CS0822: Implicitly-typed variables cannot be constant
// (7,23): error CS0133: The expression being assigned to 'y' must be constant
// const var y = (int?)null + x;
Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableCannotBeConst, "var y = (int?)null + x").WithLocation(7, 15),
Diagnostic(ErrorCode.ERR_NotConstantExpression, "(int?)null + x").WithArguments("y").WithLocation(7, 23),
// (7,23): warning CS0458: The result of the expression is always 'null' of type 'int?'
// const var y = (int?)null + x;
Diagnostic(ErrorCode.WRN_AlwaysNull, "(int?)null + x").WithArguments("int?").WithLocation(7, 23)
Expand All @@ -11552,11 +11549,10 @@ public static void Main()
[Fact]
public void CS0822ERR_ImplicitlyTypedVariableCannotBeConst_Fields()
{
// This is now legal.
CreateCompilationWithMscorlib45(@"
const var x = 0; // CS0822.cs
", parseOptions: TestOptions.Script).VerifyDiagnostics(
// (2,7): error CS0822: Implicitly-typed variables cannot be constant
Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableCannotBeConst, "var"));
", parseOptions: TestOptions.Script).VerifyDiagnostics();
}

[Fact]
Expand Down

0 comments on commit bbae3c0

Please sign in to comment.