Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic order needs to consider both location and ID #1741

Merged
merged 1 commit into from
Nov 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public async Task TestRegressionMethodGlobalNamespaceAsync(string code, int colu

var expected = new[]
{
this.CSharpDiagnostic().WithLocation(4, column),
new DiagnosticResult
{
Id = "CS0116",
Severity = DiagnosticSeverity.Error,
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 4, column) },
Message = "A namespace cannot directly contain members such as fields or methods"
}
},
this.CSharpDiagnostic().WithLocation(4, column)
};

await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ protected virtual Project CreateProject(string[] sources, string language = Lang
/// </summary>
/// <param name="diagnostics">A collection of <see cref="Diagnostic"/>s to be sorted.</param>
/// <returns>A collection containing the input <paramref name="diagnostics"/>, sorted by
/// <see cref="Diagnostic.Location"/>.</returns>
/// <see cref="Diagnostic.Location"/> and <see cref="Diagnostic.Id"/>.</returns>
private static Diagnostic[] SortDistinctDiagnostics(IEnumerable<Diagnostic> diagnostics)
{
return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ThenBy(d => d.Id).ToArray();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,10 +853,10 @@ public class TestClass /
{
new DiagnosticResult
{
Id = "CS1514",
Id = "CS1022",
Severity = DiagnosticSeverity.Error,
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 3, 28) },
Message = "{ expected"
Message = "Type or namespace definition, or end-of-file expected"
},
new DiagnosticResult
{
Expand All @@ -867,10 +867,10 @@ public class TestClass /
},
new DiagnosticResult
{
Id = "CS1022",
Id = "CS1514",
Severity = DiagnosticSeverity.Error,
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 3, 28) },
Message = "Type or namespace definition, or end-of-file expected"
Message = "{ expected"
},
new DiagnosticResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,16 @@ void Method()
{
new DiagnosticResult
{
Id = "CS1003",
Id = "CS0443",
Severity = DiagnosticSeverity.Error,
Message = "Syntax error, ',' expected",
Message = "Syntax error; value expected",
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 6, 28) }
},
new DiagnosticResult
{
Id = "CS0443",
Id = "CS1003",
Severity = DiagnosticSeverity.Error,
Message = "Syntax error; value expected",
Message = "Syntax error, ',' expected",
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 6, 28) }
},
new DiagnosticResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ void MethodName()
{
new DiagnosticResult()
{
Id = "CS1003",
Message = "Syntax error, ',' expected",
Id = "CS0443",
Message = "Syntax error; value expected",
Severity = DiagnosticSeverity.Error,
},
new DiagnosticResult()
{
Id = "CS0443",
Message = "Syntax error; value expected",
Id = "CS1003",
Message = "Syntax error, ',' expected",
Severity = DiagnosticSeverity.Error,
},
new DiagnosticResult()
Expand Down