mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add line output to diagnostics to help identify error locations. (#3010)
This also makes the filename a reference to the buffer since the line seems better to have as a reference (versus copying a string per error). Most tests now have different line deltas due to the extra output, but the actual errors should overall stay the same. Some of the error locations look like they could be improved, but this change is only making it clear where they were before.
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+1]]:11: `interface` introducer should be followed by a name.
|
||||
// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+3]]:11: `interface` introducer should be followed by a name.
|
||||
// CHECK:STDERR: interface {
|
||||
// CHECK:STDERR: ^
|
||||
interface {
|
||||
}
|
||||
|
||||
+6
-2
@@ -13,8 +13,12 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+1]]:15: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+3]]:15: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: interface Bar Baz {}
|
||||
// CHECK:STDERR: ^
|
||||
interface Bar Baz {}
|
||||
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+1]]:14: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+3]]:14: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition.
|
||||
// CHECK:STDERR: interface Foo
|
||||
// CHECK:STDERR: ^
|
||||
interface Foo
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
interface Foo {
|
||||
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+1]]:39: Method implementations are not allowed in interfaces.
|
||||
// CHECK:STDERR: fail_no_impl_allowed.carbon:[[@LINE+3]]:39: Method implementations are not allowed in interfaces.
|
||||
// CHECK:STDERR: fn Add[self: Self](b: Self) -> Self {
|
||||
// CHECK:STDERR: ^
|
||||
fn Add[self: Self](b: Self) -> Self {
|
||||
print("You can't do that.");
|
||||
}
|
||||
|
||||
@@ -42,9 +42,13 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
interface Foo {
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+1]]:13: Expected parameter declaration.
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+3]]:13: Expected parameter declaration.
|
||||
// CHECK:STDERR: fn Sub[me Self](b: Self) -> Self;
|
||||
// CHECK:STDERR: ^
|
||||
fn Sub[me Self](b: Self) -> Self;
|
||||
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+1]]:10: Expected parameter declaration.
|
||||
// CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+3]]:10: Expected parameter declaration.
|
||||
// CHECK:STDERR: fn Mul[Self](b: Self) -> Self;
|
||||
// CHECK:STDERR: ^
|
||||
fn Mul[Self](b: Self) -> Self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user