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:
+15
-5
@@ -39,13 +39,23 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:6: Expected `(` after `if`.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:6: Expected `(` after `if`.
|
||||
// CHECK:STDERR: if a {}
|
||||
// CHECK:STDERR: ^
|
||||
if a {}
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:7: Expected expression.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:7: Expected expression.
|
||||
// CHECK:STDERR: if () {}
|
||||
// CHECK:STDERR: ^
|
||||
if () {}
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:9: Unexpected tokens before `)`.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:9: Unexpected tokens before `)`.
|
||||
// CHECK:STDERR: if (b c) {}
|
||||
// CHECK:STDERR: ^
|
||||
if (b c) {}
|
||||
if (d)
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:1: Expected braced code block.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+1]]:1: Expected expression.
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+6]]:1: Expected braced code block.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:1: Expected expression.
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user