Underline the complete declaration in diagnostics (#3508)

Builds upon @domisterwoozy 's excellent #3442 . Removes the need to
store the first node of a declaration in the declaration state stack.
This commit is contained in:
josh11b authored and GitHub committed 2023-12-14 19:18:17 +00:00
1 parent 8282595bf8
commit 23c7d7dd99
33 files changed
+103 -119

No files matched your search

@@ -14,14 +14,14 @@ fn Main() {
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-8]]:1: Calling function declared here.
// CHECK:STDERR: fn Run0() {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~
Run0(1);
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+6]]:3: ERROR: 2 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: Run0(0, 1);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-15]]:1: Calling function declared here.
// CHECK:STDERR: fn Run0() {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~
Run0(0, 1);
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+6]]:3: ERROR: 0 argument(s) passed to function expecting 1 argument(s).
@@ -29,14 +29,14 @@ fn Main() {
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-22]]:1: Calling function declared here.
// CHECK:STDERR: fn Run1(a: i32) {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
Run1();
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+6]]:3: ERROR: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: Run1(0, 1);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-29]]:1: Calling function declared here.
// CHECK:STDERR: fn Run1(a: i32) {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
Run1(0, 1);
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+6]]:3: ERROR: 0 argument(s) passed to function expecting 2 argument(s).
@@ -44,14 +44,14 @@ fn Main() {
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-36]]:1: Calling function declared here.
// CHECK:STDERR: fn Run2(a: i32, b: i32) {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
Run2();
// CHECK:STDERR: fail_param_count.carbon:[[@LINE+6]]:3: ERROR: 1 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: Run2(0);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_param_count.carbon:[[@LINE-43]]:1: Calling function declared here.
// CHECK:STDERR: fn Run2(a: i32, b: i32) {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
Run2(0);
}
@@ -12,7 +12,7 @@ fn F() {
// CHECK:STDERR: ^~
// CHECK:STDERR: fail_param_type.carbon:[[@LINE-6]]:1: Initializing parameter 1 of function declared here.
// CHECK:STDERR: fn G(a: i32) {}
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~~~~~~~~~~~~
G(1.0);
}