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:
@@ -12,5 +12,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+1]]:27: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:27: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: package Foo library "bar" "baz";
|
||||
// CHECK:STDERR: ^
|
||||
package Foo library "bar" "baz";
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+1]]:26: Expected a string literal to specify the library name.
|
||||
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:26: Expected a string literal to specify the library name.
|
||||
// CHECK:STDERR: package Geometry library Shapes api;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry library Shapes api;
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+3]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: package library "Shapes" api;
|
||||
// CHECK:STDERR: ^
|
||||
package library "Shapes" api;
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+1]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:9: Expected identifier after `package`.
|
||||
// CHECK:STDERR: package fn;
|
||||
// CHECK:STDERR: ^
|
||||
package fn;
|
||||
|
||||
+3
-1
@@ -9,5 +9,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+1]]:8: Expected identifier after `package`.
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:8: Expected identifier after `package`.
|
||||
// CHECK:STDERR: package;
|
||||
// CHECK:STDERR: ^
|
||||
package;
|
||||
|
||||
+3
-1
@@ -11,5 +11,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+1]]:21: `package` declarations must end with a `;`.
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:21: `package` declarations must end with a `;`.
|
||||
// CHECK:STDERR: package Geometry api
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry api
|
||||
|
||||
+3
-1
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_no_type.carbon:[[@LINE+1]]:17: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: fail_no_type.carbon:[[@LINE+3]]:17: Expected a `api` or `impl`.
|
||||
// CHECK:STDERR: package Geometry;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry;
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+1]]:18: Missing `library` keyword.
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:18: Missing `library` keyword.
|
||||
// CHECK:STDERR: package Geometry "Shapes" api;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry "Shapes" api;
|
||||
|
||||
Reference in New Issue
Block a user