diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index 1852cb18e881..efc0293e6bcc 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -11,7 +11,7 @@ class Incomplete; // CHECK:STDERR: ^ // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: Class was forward declared here. // CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ var a: [Incomplete; 1]; // CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+3]]:27: ERROR: Cannot implicitly convert from `*` to `Incomplete*`. diff --git a/toolchain/check/testdata/array/fail_type_mismatch.carbon b/toolchain/check/testdata/array/fail_type_mismatch.carbon index 171c6cd6e6f7..a87ea517c990 100644 --- a/toolchain/check/testdata/array/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/array/fail_type_mismatch.carbon @@ -12,7 +12,7 @@ var a: [i32; 3] = (1, "Hello", "World"); var t1: (i32, String, String); // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:19: ERROR: Cannot implicitly convert from `String` to `i32`. // CHECK:STDERR: var b: [i32; 3] = t1; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ var b: [i32; 3] = t1; // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:24: ERROR: Cannot initialize array of 3 element(s) from 2 initializer(s). @@ -23,7 +23,7 @@ var c: [i32; 3] = (1, 2); var t2: (i32, i32); // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:19: ERROR: Cannot initialize array of 3 element(s) from tuple with 2 element(s). // CHECK:STDERR: var d: [i32; 3] = t2; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ var d: [i32; 3] = t2; // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/as/fail_no_conversion.carbon b/toolchain/check/testdata/as/fail_no_conversion.carbon index c03d39a9d4a9..60398d1c20a7 100644 --- a/toolchain/check/testdata/as/fail_no_conversion.carbon +++ b/toolchain/check/testdata/as/fail_no_conversion.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:23: ERROR: Cannot convert from `i32` to `(i32, i32) as type` with `as`. // CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/basics/fail_bad_run.carbon b/toolchain/check/testdata/basics/fail_bad_run.carbon index be38d442f2b2..69df107357ec 100644 --- a/toolchain/check/testdata/basics/fail_bad_run.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_bad_run.carbon:[[@LINE+6]]:1: ERROR: Invalid signature for `Main.Run` function. Expected `fn ()` or `fn () -> i32`. // CHECK:STDERR: fn Run() -> String {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ // CHECK:STDERR: fail_bad_run.carbon:[[@LINE+3]]:21: ERROR: Missing `return` at end of function with declared return type. // CHECK:STDERR: fn Run() -> String {} // CHECK:STDERR: ^ diff --git a/toolchain/check/testdata/basics/fail_bad_run_2.carbon b/toolchain/check/testdata/basics/fail_bad_run_2.carbon index 81f25d0bd504..d8f6bbbd4032 100644 --- a/toolchain/check/testdata/basics/fail_bad_run_2.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run_2.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for `Main.Run` function. Expected `fn ()` or `fn () -> i32`. // CHECK:STDERR: fn Run(n: i32) {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ fn Run(n: i32) {} // CHECK:STDOUT: file "fail_bad_run_2.carbon" { diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon index bac9a6f4c26c..bd03f5ef2832 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -7,12 +7,12 @@ class Class { // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: ERROR: `addr` can only be applied to a `self` parameter. // CHECK:STDERR: fn F[addr a: Class*](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ fn F[addr a: Class*](); // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: ERROR: `addr` can only be applied to a `self` parameter. // CHECK:STDERR: fn G(addr b: Class*); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ fn G(addr b: Class*); } diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index c9a7b2df6a44..6a53723f8283 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -15,7 +15,7 @@ fn F(c: Class, p: Class*) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_addr_self.carbon:[[@LINE-8]]:13: Initializing `addr self` parameter of method declared here. // CHECK:STDERR: fn F[addr self: Class*](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ c.F(); // CHECK:STDERR: fail_addr_self.carbon:[[@LINE+6]]:6: ERROR: `addr self` method cannot be invoked on a value. @@ -23,7 +23,7 @@ fn F(c: Class, p: Class*) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_addr_self.carbon:[[@LINE-15]]:13: Initializing `addr self` parameter of method declared here. // CHECK:STDERR: fn G[addr self: Class](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ c.G(); // This call is OK. @@ -34,7 +34,7 @@ fn F(c: Class, p: Class*) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_addr_self.carbon:[[@LINE-26]]:13: Initializing `addr self` parameter of method declared here. // CHECK:STDERR: fn G[addr self: Class](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ (*p).G(); } diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index fa1943ee42e1..4d3c1a206c86 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -8,36 +8,36 @@ class Class; // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:4: ERROR: Cannot declare a member of incomplete class `Class`. // CHECK:STDERR: fn Class.Function() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-5]]:1: Class was forward declared here. // CHECK:STDERR: class Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn Class.Function() {} fn CallClassFunction() { // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:3: ERROR: Member access into incomplete class `Class`. // CHECK:STDERR: Class.Function(); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-14]]:1: Class was forward declared here. // CHECK:STDERR: class Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ Class.Function(); } // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:17: ERROR: Variable has incomplete type `Class`. // CHECK:STDERR: var global_var: Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-23]]:1: Class was forward declared here. // CHECK:STDERR: class Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ var global_var: Class; // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:24: ERROR: Function returns incomplete type `Class`. // CHECK:STDERR: fn ConvertFromStruct() -> Class { return {}; } -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-31]]:1: Class was forward declared here. // CHECK:STDERR: class Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn ConvertFromStruct() -> Class { return {}; } // TODO: Once the `->` operator is supported: @@ -51,16 +51,16 @@ fn MemberAccess(p: Class*) -> i32 { // CHECK:STDERR: ^ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-45]]:1: Class was forward declared here. // CHECK:STDERR: class Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ return (*p).n; } // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:20: ERROR: Function returns incomplete type `Class`. // CHECK:STDERR: fn Copy(p: Class*) -> Class { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-54]]:1: Class was forward declared here. // CHECK:STDERR: class Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn Copy(p: Class*) -> Class { return *p; } @@ -68,10 +68,10 @@ fn Copy(p: Class*) -> Class { fn Let(p: Class*) { // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:10: ERROR: `let` binding has incomplete type `Class`. // CHECK:STDERR: let c: Class = *p; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-65]]:1: Class was forward declared here. // CHECK:STDERR: class Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ let c: Class = *p; } @@ -81,10 +81,10 @@ fn TakeIncomplete(c: Class); // // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+6]]:23: ERROR: Function returns incomplete type `Class`. // CHECK:STDERR: fn ReturnIncomplete() -> Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-78]]:1: Class was forward declared here. // CHECK:STDERR: class Class; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn ReturnIncomplete() -> Class; fn CallTakeIncomplete(p: Class*) { @@ -93,10 +93,10 @@ fn CallTakeIncomplete(p: Class*) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-87]]:1: Class was forward declared here. // CHECK:STDERR: class Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-19]]:1: Initializing parameter 1 of function declared here. // CHECK:STDERR: fn TakeIncomplete(c: Class); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ TakeIncomplete(*p); // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+9]]:17: ERROR: Forming value of incomplete type `Class`. @@ -104,10 +104,10 @@ fn CallTakeIncomplete(p: Class*) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-98]]:1: Class was forward declared here. // CHECK:STDERR: class Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-30]]:1: Initializing parameter 1 of function declared here. // CHECK:STDERR: fn TakeIncomplete(c: Class); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ TakeIncomplete({}); } diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index 2199ffea2d26..82891d149c25 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -19,7 +19,7 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-12]]:13: Initializing `addr self` parameter of method declared here. // CHECK:STDERR: fn F[addr self: A*](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ s.a.F(); // `b` has an object representation for `A`, but this is still invalid for @@ -29,7 +29,7 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-22]]:13: Initializing `addr self` parameter of method declared here. // CHECK:STDERR: fn F[addr self: A*](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ b.a.F(); } diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index 2e52733d2caf..3ef16fb18bbd 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -19,14 +19,14 @@ fn F(c: Class) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_method.carbon:[[@LINE-11]]:3: Calling function declared here. // CHECK:STDERR: fn WithSelf[self: Class](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ Class.WithSelf(); // CHECK:STDERR: fail_method.carbon:[[@LINE+6]]:17: ERROR: 1 argument(s) passed to function expecting 0 argument(s). // CHECK:STDERR: Class.WithSelf(c); // CHECK:STDERR: ^ // CHECK:STDERR: fail_method.carbon:[[@LINE-18]]:3: Calling function declared here. // CHECK:STDERR: fn WithSelf[self: Class](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ Class.WithSelf(c); } diff --git a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon index 26e1a93e45c9..1bc58930f3fe 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon @@ -7,71 +7,71 @@ class A; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: base class A {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: class A; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ base class A {} class B; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: abstract class B {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: class B; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ abstract class B {} base class C; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: class C {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: base class C; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ class C {} base class D; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: abstract class D {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: base class D; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ abstract class D {} abstract class E; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: class E {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: abstract class E; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ class E {} abstract class F; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: base class F {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: abstract class F; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ base class F {} class G {} // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: abstract class G; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here. // CHECK:STDERR: class G {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ abstract class G; // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind. // CHECK:STDERR: base class G; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-11]]:1: Previously declared here. // CHECK:STDERR: class G {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ base class G; // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index cd9dea83b836..77193e460008 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -14,7 +14,7 @@ class Class { // CHECK:STDERR: ^ // CHECK:STDERR: fail_redefinition.carbon:[[@LINE-8]]:1: Previous definition was here. // CHECK:STDERR: class Class { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ class Class { fn G(); fn H(); diff --git a/toolchain/check/testdata/class/fail_reorder.carbon b/toolchain/check/testdata/class/fail_reorder.carbon index d4203e7bd1ce..de9d6c692700 100644 --- a/toolchain/check/testdata/class/fail_reorder.carbon +++ b/toolchain/check/testdata/class/fail_reorder.carbon @@ -10,10 +10,10 @@ class Class { // later. // CHECK:STDERR: fail_reorder.carbon:[[@LINE+9]]:12: ERROR: Member access into incomplete class `Class`. // CHECK:STDERR: return Class.F(); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_reorder.carbon:[[@LINE-7]]:1: Class is incomplete within its definition. // CHECK:STDERR: class Class { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_reorder.carbon:[[@LINE+3]]:17: ERROR: Name `F` not found. // CHECK:STDERR: return Class.F(); // CHECK:STDERR: ^ diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index c652ca586d3e..e2416bf583de 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -12,10 +12,10 @@ class Class { // CHECK:STDERR: fail_self.carbon:[[@LINE+6]]:10: ERROR: Function returns incomplete type `Class`. // CHECK:STDERR: fn G() -> Class; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ // CHECK:STDERR: fail_self.carbon:[[@LINE-9]]:1: Class is incomplete within its definition. // CHECK:STDERR: class Class { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ fn G() -> Class; } @@ -32,7 +32,7 @@ fn Class.G() -> Class { var self: Class; // CHECK:STDERR: fail_self.carbon:[[@LINE+3]]:10: ERROR: Name `self` not found. // CHECK:STDERR: return self; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ return self; } @@ -46,7 +46,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_self.carbon:[[@LINE-7]]:8: Initializing `self` parameter of method declared here. // CHECK:STDERR: fn F[self: Class](); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ ws.F(); } diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index fe71d8fbd297..5494a860a42f 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -9,7 +9,7 @@ class Class { fn F() -> i32 { // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+3]]:12: ERROR: Expression cannot be used as a value. // CHECK:STDERR: return field; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ return field; } } diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 1a80d1880727..a0689b292b75 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -7,7 +7,7 @@ // OK, `const (const i32)` is the same type as `const i32`. // CHECK:STDERR: collapse.carbon:[[@LINE+3]]:25: `const` applied repeatedly to the same type has no additional effect. // CHECK:STDERR: fn F(p: const i32**) -> const (const i32)** { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn F(p: const i32**) -> const (const i32)** { return p; } diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index 9be204089a3f..d958f48eebe2 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_collapse.carbon:[[@LINE+3]]:9: `const` applied repeatedly to the same type has no additional effect. // CHECK:STDERR: fn G(p: const (const i32)**) -> i32** { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn G(p: const (const i32)**) -> i32** { // CHECK:STDERR: fail_collapse.carbon:[[@LINE+3]]:11: ERROR: Cannot implicitly convert from `const i32**` to `i32**`. // CHECK:STDERR: return p; diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 2d7a9fa854e6..c8ea4468926d 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -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]]:7: 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]]:7: 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]]:7: 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]]:7: 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]]:7: 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); } diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index 566e2d168bd9..745aa337d0c1 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -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); } diff --git a/toolchain/check/testdata/if_expression/fail_not_in_function.carbon b/toolchain/check/testdata/if_expression/fail_not_in_function.carbon index 249b491589d2..8980fee5bf05 100644 --- a/toolchain/check/testdata/if_expression/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expression/fail_not_in_function.carbon @@ -7,29 +7,29 @@ // TODO: Should work with compile-time evaluation. // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+9]]:14: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: let x: i32 = if true then 1 else 0; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+6]]:22: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: let x: i32 = if true then 1 else 0; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+3]]:29: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: let x: i32 = if true then 1 else 0; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ let x: i32 = if true then 1 else 0; class C { // TODO: Should work with compile-time evaluation. // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+12]]:10: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: var n: if true then i32 else f64; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+9]]:18: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: var n: if true then i32 else f64; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+6]]:27: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: var n: if true then i32 else f64; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+3]]:27: ERROR: Cannot evaluate type expression. // CHECK:STDERR: var n: if true then i32 else f64; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ var n: if true then i32 else f64; } diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index ff595156d664..39f52f4dd8c2 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -7,7 +7,7 @@ var a: [i32; 1] = (12,); // CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+3]]:16: ERROR: Cannot implicitly convert from `f64` to `i32`. // CHECK:STDERR: var b: i32 = a[2.6]; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ var b: i32 = a[2.6]; // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/index/fail_tuple_index_error.carbon b/toolchain/check/testdata/index/fail_tuple_index_error.carbon index 9a7d0d40eaed..2fdbf131a38c 100644 --- a/toolchain/check/testdata/index/fail_tuple_index_error.carbon +++ b/toolchain/check/testdata/index/fail_tuple_index_error.carbon @@ -7,7 +7,7 @@ var a: (i32, i32) = (12, 6); // CHECK:STDERR: fail_tuple_index_error.carbon:[[@LINE+3]]:16: ERROR: Name `oops` not found. // CHECK:STDERR: var b: i32 = a[oops]; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ var b: i32 = a[oops]; // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 939aa612d3bc..9db2d341831b 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -14,7 +14,7 @@ fn Foo.Baz() { // CHECK:STDERR: ^ // CHECK:STDERR: fail_duplicate.carbon:[[@LINE-6]]:1: Previous definition was here. // CHECK:STDERR: fn Foo.Baz() { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ fn Foo.Baz() { } diff --git a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon index 0284091cd763..280f9ab0e7fc 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_unresolved_scope.carbon:[[@LINE+3]]:4: ERROR: Name `Foo` not found. // CHECK:STDERR: fn Foo.Baz() { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ fn Foo.Baz() { } diff --git a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon index 640eff739221..230646ba1eab 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon @@ -7,11 +7,11 @@ fn Main() { // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+3]]:3: ERROR: Name `undeclared` not found. // CHECK:STDERR: undeclared = 42; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~ undeclared = 42; // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+3]]:4: ERROR: Name `also_undeclared` not found. // CHECK:STDERR: *also_undeclared = 42; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~~~~~~ *also_undeclared = 42; } diff --git a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon index aa9f3cbddc2c..5a2e86f5fbf7 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon @@ -26,7 +26,7 @@ fn Main() { (n, n) = (1, 2); // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+3]]:3: ERROR: Expression is not assignable. // CHECK:STDERR: i32 = i32*; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~ i32 = i32*; // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+3]]:18: ERROR: Expression is not assignable. // CHECK:STDERR: {.x = 1, .y = 2} = {.x = 3, .y = 4}; diff --git a/toolchain/check/testdata/packages/fail_api_not_found.carbon b/toolchain/check/testdata/packages/fail_api_not_found.carbon index 41fb6ae3cb12..1c80f34b3177 100644 --- a/toolchain/check/testdata/packages/fail_api_not_found.carbon +++ b/toolchain/check/testdata/packages/fail_api_not_found.carbon @@ -8,21 +8,21 @@ // CHECK:STDERR: no_api.impl.carbon:[[@LINE+3]]:1: ERROR: Corresponding API not found. // CHECK:STDERR: package Foo impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Foo impl; // --- no_api_lib.impl.carbon // CHECK:STDERR: no_api_lib.impl.carbon:[[@LINE+3]]:1: ERROR: Corresponding API not found. // CHECK:STDERR: package Foo library "Bar" impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Foo library "Bar" impl; // --- no_api_main_lib.impl.carbon // CHECK:STDERR: no_api_main_lib.impl.carbon:[[@LINE+3]]:1: ERROR: Corresponding API not found. // CHECK:STDERR: library "Bar" impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ library "Bar" impl; // CHECK:STDOUT: file "no_api.impl.carbon" { diff --git a/toolchain/check/testdata/packages/fail_cycle.carbon b/toolchain/check/testdata/packages/fail_cycle.carbon index 9b6a9e0036d5..a151e6d70666 100644 --- a/toolchain/check/testdata/packages/fail_cycle.carbon +++ b/toolchain/check/testdata/packages/fail_cycle.carbon @@ -10,7 +10,7 @@ package A api; // CHECK:STDERR: a.carbon:[[@LINE+3]]:1: ERROR: Import cannot be used due to a cycle. Cycle must be fixed to import. // CHECK:STDERR: import B; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import B; // --- b.carbon @@ -19,7 +19,7 @@ package B api; // CHECK:STDERR: b.carbon:[[@LINE+3]]:1: ERROR: Import cannot be used due to a cycle. Cycle must be fixed to import. // CHECK:STDERR: import C; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import C; // --- c.carbon @@ -28,14 +28,14 @@ package C api; // CHECK:STDERR: c.carbon:[[@LINE+3]]:1: ERROR: Import cannot be used due to a cycle. Cycle must be fixed to import. // CHECK:STDERR: import A; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import A; // --- c.impl.carbon // CHECK:STDERR: c.impl.carbon:[[@LINE+3]]:1: ERROR: Import cannot be used due to a cycle. Cycle must be fixed to import. // CHECK:STDERR: package C impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package C impl; // --- cycle_child.carbon @@ -44,7 +44,7 @@ package CycleChild api; // CHECK:STDERR: cycle_child.carbon:[[@LINE+3]]:1: ERROR: Import cannot be used due to a cycle. Cycle must be fixed to import. // CHECK:STDERR: import B; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import B; // CHECK:STDOUT: file "a.carbon" { diff --git a/toolchain/check/testdata/packages/fail_duplicate_api.carbon b/toolchain/check/testdata/packages/fail_duplicate_api.carbon index 7bbb27c88cd2..133f48c3a438 100644 --- a/toolchain/check/testdata/packages/fail_duplicate_api.carbon +++ b/toolchain/check/testdata/packages/fail_duplicate_api.carbon @@ -17,7 +17,7 @@ library "lib" api; // CHECK:STDERR: main_lib2.carbon:[[@LINE+3]]:1: ERROR: Library's API previously provided by `main_lib1.carbon`. // CHECK:STDERR: library "lib" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ library "lib" api; // --- package1.carbon @@ -28,7 +28,7 @@ package Package api; // CHECK:STDERR: package2.carbon:[[@LINE+3]]:1: ERROR: Library's API previously provided by `package1.carbon`. // CHECK:STDERR: package Package api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Package api; // --- package_lib1.carbon @@ -39,7 +39,7 @@ package Package library "lib" api; // CHECK:STDERR: package_lib2.carbon:[[@LINE+3]]:1: ERROR: Library's API previously provided by `package_lib1.carbon`. // CHECK:STDERR: package Package library "lib" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Package library "lib" api; // CHECK:STDOUT: file "main1.carbon" { diff --git a/toolchain/check/testdata/packages/fail_extension.carbon b/toolchain/check/testdata/packages/fail_extension.carbon index a89536fae9b4..2cc20f75f727 100644 --- a/toolchain/check/testdata/packages/fail_extension.carbon +++ b/toolchain/check/testdata/packages/fail_extension.carbon @@ -16,49 +16,49 @@ // CHECK:STDERR: main_lib.incorrect:[[@LINE+3]]:1: ERROR: File extension of `.carbon` required for `api`. // CHECK:STDERR: library "lib" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ library "lib" api; // --- main_lib_impl.incorrect // CHECK:STDERR: main_lib_impl.incorrect:[[@LINE+3]]:1: ERROR: File extension of `.impl.carbon` required for `impl`. // CHECK:STDERR: library "lib" impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ library "lib" impl; // --- package.incorrect // CHECK:STDERR: package.incorrect:[[@LINE+3]]:1: ERROR: File extension of `.carbon` required for `api`. // CHECK:STDERR: package Package api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Package api; // --- package_impl.incorrect // CHECK:STDERR: package_impl.incorrect:[[@LINE+3]]:1: ERROR: File extension of `.impl.carbon` required for `impl`. // CHECK:STDERR: package Package impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Package impl; // --- package_lib.incorrect // CHECK:STDERR: package_lib.incorrect:[[@LINE+3]]:1: ERROR: File extension of `.carbon` required for `api`. // CHECK:STDERR: package Package library "lib" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Package library "lib" api; // --- package_lib_impl.incorrect // CHECK:STDERR: package_lib_impl.incorrect:[[@LINE+3]]:1: ERROR: File extension of `.impl.carbon` required for `impl`. // CHECK:STDERR: package Package library "lib" impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Package library "lib" impl; // --- swapped_ext.impl.carbon // CHECK:STDERR: swapped_ext.impl.carbon:[[@LINE+4]]:1: ERROR: File extension of `.carbon` required for `api`. // CHECK:STDERR: package SwappedExt api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: swapped_ext.impl.carbon: File extension of `.impl.carbon` only allowed for `impl`. package SwappedExt api; @@ -66,7 +66,7 @@ package SwappedExt api; // CHECK:STDERR: swapped_ext.carbon:[[@LINE+3]]:1: ERROR: File extension of `.impl.carbon` required for `impl`. // CHECK:STDERR: package SwappedExt impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package SwappedExt impl; diff --git a/toolchain/check/testdata/packages/fail_import_default.carbon b/toolchain/check/testdata/packages/fail_import_default.carbon index 00ba775386e6..b207d034a436 100644 --- a/toolchain/check/testdata/packages/fail_import_default.carbon +++ b/toolchain/check/testdata/packages/fail_import_default.carbon @@ -10,7 +10,7 @@ package A api; // CHECK:STDERR: default_api.carbon:[[@LINE+3]]:1: ERROR: File cannot import itself. // CHECK:STDERR: import library default; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library default; // --- default.impl.carbon @@ -19,14 +19,14 @@ package A impl; // CHECK:STDERR: default.impl.carbon:[[@LINE+3]]:1: ERROR: Explicit import of `api` from `impl` file is redundant with implicit import. // CHECK:STDERR: import library default; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library default; // --- main_import_default.carbon // CHECK:STDERR: main_import_default.carbon:[[@LINE+3]]:1: ERROR: Explicit import of `api` from `impl` file is redundant with implicit import. // CHECK:STDERR: import library default; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library default; // --- main_lib_import_default.carbon @@ -35,7 +35,7 @@ library "lib" api; // CHECK:STDERR: main_lib_import_default.carbon:[[@LINE+3]]:1: ERROR: Cannot import `Main//default`. // CHECK:STDERR: import library default; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library default; // CHECK:STDOUT: file "default_api.carbon" { diff --git a/toolchain/check/testdata/packages/fail_import_invalid.carbon b/toolchain/check/testdata/packages/fail_import_invalid.carbon index b831cc3d6d7e..8ca30280da50 100644 --- a/toolchain/check/testdata/packages/fail_import_invalid.carbon +++ b/toolchain/check/testdata/packages/fail_import_invalid.carbon @@ -8,12 +8,12 @@ // CHECK:STDERR: main.carbon:[[@LINE+3]]:1: ERROR: Imports from the current package must omit the package name. // CHECK:STDERR: import Main; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Main; // CHECK:STDERR: main.carbon:[[@LINE+3]]:1: ERROR: Imports from the current package must omit the package name. // CHECK:STDERR: import Main library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Main library "lib"; // --- not_main.carbon @@ -22,12 +22,12 @@ package NotMain api; // CHECK:STDERR: not_main.carbon:[[@LINE+3]]:1: ERROR: Cannot import `Main` from other packages. // CHECK:STDERR: import Main; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Main; // CHECK:STDERR: not_main.carbon:[[@LINE+3]]:1: ERROR: Cannot import `Main` from other packages. // CHECK:STDERR: import Main library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Main library "lib"; // --- this.carbon @@ -36,7 +36,7 @@ package This api; // CHECK:STDERR: this.carbon:[[@LINE+3]]:1: ERROR: File cannot import itself. // CHECK:STDERR: import This; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import This; // --- this_lib.carbon @@ -45,7 +45,7 @@ package This library "lib" api; // CHECK:STDERR: this_lib.carbon:[[@LINE+3]]:1: ERROR: File cannot import itself. // CHECK:STDERR: import library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library "lib"; // --- implicit_api.carbon @@ -58,7 +58,7 @@ package Implicit impl; // CHECK:STDERR: implicit.impl.carbon:[[@LINE+3]]:1: ERROR: Explicit import of `api` from `impl` file is redundant with implicit import. // CHECK:STDERR: import Implicit; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Implicit; // --- implicit_lib_api.carbon @@ -71,7 +71,7 @@ package Implicit library "lib" impl; // CHECK:STDERR: implicit_lib.impl.carbon:[[@LINE+3]]:1: ERROR: Explicit import of `api` from `impl` file is redundant with implicit import. // CHECK:STDERR: import Implicit library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Implicit library "lib"; // --- not_found.carbon @@ -79,7 +79,7 @@ package NotFound api; // CHECK:STDERR: not_found.carbon:[[@LINE+3]]:1: ERROR: Imported API not found. // CHECK:STDERR: import ImportNotFound; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import ImportNotFound; // CHECK:STDOUT: file "main.carbon" { diff --git a/toolchain/check/testdata/packages/fail_import_repeat.carbon b/toolchain/check/testdata/packages/fail_import_repeat.carbon index 712b2abcd683..98b678a0961c 100644 --- a/toolchain/check/testdata/packages/fail_import_repeat.carbon +++ b/toolchain/check/testdata/packages/fail_import_repeat.carbon @@ -21,28 +21,28 @@ library "lib" api; import Api; // CHECK:STDERR: import.carbon:[[@LINE+6]]:1: ERROR: Library imported more than once. // CHECK:STDERR: import Api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: import.carbon:[[@LINE-4]]:1: First import here. // CHECK:STDERR: import Api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Api; import Api library "lib"; // CHECK:STDERR: import.carbon:[[@LINE+6]]:1: ERROR: Library imported more than once. // CHECK:STDERR: import Api library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: import.carbon:[[@LINE-4]]:1: First import here. // CHECK:STDERR: import Api library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Api library "lib"; import library "lib"; // CHECK:STDERR: import.carbon:[[@LINE+6]]:1: ERROR: Library imported more than once. // CHECK:STDERR: import library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: import.carbon:[[@LINE-4]]:1: First import here. // CHECK:STDERR: import library "lib"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library "lib"; // --- default_import.carbon @@ -52,10 +52,10 @@ package Api library "not_default" api; import library default; // CHECK:STDERR: default_import.carbon:[[@LINE+6]]:1: ERROR: Library imported more than once. // CHECK:STDERR: import library default; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: default_import.carbon:[[@LINE-4]]:1: First import here. // CHECK:STDERR: import library default; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import library default; // CHECK:STDOUT: file "api.carbon" { diff --git a/toolchain/check/testdata/packages/fail_package_main.carbon b/toolchain/check/testdata/packages/fail_package_main.carbon index afb49f7a5b04..3a04430edafa 100644 --- a/toolchain/check/testdata/packages/fail_package_main.carbon +++ b/toolchain/check/testdata/packages/fail_package_main.carbon @@ -8,14 +8,14 @@ // CHECK:STDERR: main.carbon:[[@LINE+3]]:1: ERROR: `Main//default` must omit `package` directive. // CHECK:STDERR: package Main api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Main api; // --- main_impl.carbon // CHECK:STDERR: main_impl.carbon:[[@LINE+3]]:1: ERROR: `Main//default` must omit `package` directive. // CHECK:STDERR: package Main impl; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Main impl; // --- raw_main.carbon @@ -23,14 +23,14 @@ package Main impl; // `Main` isn't a keyword, so this fails the same way. // CHECK:STDERR: raw_main.carbon:[[@LINE+3]]:1: ERROR: `Main//default` must omit `package` directive. // CHECK:STDERR: package r#Main api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package r#Main api; // --- main_lib.carbon // CHECK:STDERR: main_lib.carbon:[[@LINE+3]]:1: ERROR: Use `library` directive in `Main` package libraries. // CHECK:STDERR: package Main library "lib" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package Main library "lib" api; // CHECK:STDOUT: file "main.carbon" { diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index 75cceb010797..0cd38adee158 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -7,14 +7,14 @@ fn Test() { // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+3]]:4: ERROR: Name `undeclared` not found. // CHECK:STDERR: &undeclared; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~ &undeclared; // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+6]]:3: ERROR: Cannot take the address of non-reference expression. // CHECK:STDERR: &(&undeclared); // CHECK:STDERR: ^ // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+3]]:6: ERROR: Name `undeclared` not found. // CHECK:STDERR: &(&undeclared); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~ &(&undeclared); } diff --git a/toolchain/check/testdata/pointer/fail_dereference_error.carbon b/toolchain/check/testdata/pointer/fail_dereference_error.carbon index 5d95dce10a7c..c165b8b13052 100644 --- a/toolchain/check/testdata/pointer/fail_dereference_error.carbon +++ b/toolchain/check/testdata/pointer/fail_dereference_error.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_dereference_error.carbon:[[@LINE+3]]:15: ERROR: Name `undeclared` not found. // CHECK:STDERR: let n: i32 = *undeclared; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~~~ let n: i32 = *undeclared; // CHECK:STDOUT: file "fail_dereference_error.carbon" { diff --git a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon index c813dc525368..b05bef35a870 100644 --- a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon @@ -7,10 +7,10 @@ fn Procedure() { // CHECK:STDERR: fail_returned_var_no_return_type.carbon:[[@LINE+6]]:3: ERROR: Cannot declare a `returned var` in this function. // CHECK:STDERR: returned var v: () = (); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_returned_var_no_return_type.carbon:[[@LINE-4]]:1: There was no return type provided. // CHECK:STDERR: fn Procedure() { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ returned var v: () = (); return; } diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index 952e9ef1f334..7a7b73cbbe24 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -7,10 +7,10 @@ fn Mismatch() -> i32 { // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE+6]]:19: ERROR: Type `f64` of `returned var` does not match return type of enclosing function. // CHECK:STDERR: returned var v: f64 = 0.0; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE-4]]:1: Return type of function is `i32`. // CHECK:STDERR: fn Mismatch() -> i32 { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ returned var v: f64 = 0.0; return var; } diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index b24ffd62f330..fd71dd4b499b 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -10,7 +10,7 @@ fn Main() { // CHECK:STDERR: ^ // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE-4]]:1: There was no return type provided. // CHECK:STDERR: fn Main() { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ return 0; } diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 539a60fbb8a7..b74f750d76ed 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -10,7 +10,7 @@ fn Main() -> i32 { // CHECK:STDERR: ^ // CHECK:STDERR: fail_value_missing.carbon:[[@LINE-4]]:1: Return type of function is `i32`. // CHECK:STDERR: fn Main() -> i32 { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ return; } diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 47f50696c49f..9cd9ef40c2b2 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -6,10 +6,10 @@ // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+6]]:42: ERROR: Duplicated field name `abc` in struct type literal. // CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:22: Field with the same name here. // CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+6]]:19: ERROR: Duplicated field name `a` in struct type literal. @@ -22,10 +22,10 @@ let v: {.a: i32, .a: i32} = {.a = 1}; // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+6]]:26: ERROR: Duplicated field name `def` in struct literal. // CHECK:STDERR: let w: i32 = {.def = 1, .def = 2}.def; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:16: Field with the same name here. // CHECK:STDERR: let w: i32 = {.def = 1, .def = 2}.def; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ let w: i32 = {.def = 1, .def = 2}.def; // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+6]]:30: ERROR: Duplicated field name `a` in struct literal. diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index 13325bccda63..798d94518b80 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -11,7 +11,7 @@ class Incomplete; // CHECK:STDERR: ^ // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-5]]:1: Class was forward declared here. // CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ var s: {.a: Incomplete}; // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:26: ERROR: Cannot implicitly convert from `*` to `Incomplete*`. diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index 95af1cb7ba75..8b6a352db48e 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -11,7 +11,7 @@ class Incomplete; // CHECK:STDERR: ^ // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-5]]:1: Class was forward declared here. // CHECK:STDERR: class Incomplete; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ var t: (i32, Incomplete); // CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:27: ERROR: Cannot implicitly convert from `*` to `Incomplete*`. diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index 96b08a17a3db..b6e9d2d41629 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -12,7 +12,7 @@ fn F(x: X) { // represent them. // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+3]]:19: ERROR: Cannot copy value of type `String`. // CHECK:STDERR: var s: String = "hello"; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~ var s: String = "hello"; // TODO: Decide on rules for when classes are copyable. diff --git a/toolchain/check/testdata/while/fail_break_continue.carbon b/toolchain/check/testdata/while/fail_break_continue.carbon index 2728f0271584..e351580c6b98 100644 --- a/toolchain/check/testdata/while/fail_break_continue.carbon +++ b/toolchain/check/testdata/while/fail_break_continue.carbon @@ -7,11 +7,11 @@ fn While() { // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+3]]:3: ERROR: `continue` can only be used in a loop. // CHECK:STDERR: continue; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~ continue; // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+3]]:3: ERROR: `break` can only be used in a loop. // CHECK:STDERR: break; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ break; while (false) { continue; @@ -19,11 +19,11 @@ fn While() { } // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+3]]:3: ERROR: `continue` can only be used in a loop. // CHECK:STDERR: continue; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~ continue; // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+3]]:3: ERROR: `break` can only be used in a loop. // CHECK:STDERR: break; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ break; } diff --git a/toolchain/diagnostics/BUILD b/toolchain/diagnostics/BUILD index 151ffa69ceac..76018bb6766d 100644 --- a/toolchain/diagnostics/BUILD +++ b/toolchain/diagnostics/BUILD @@ -6,6 +6,11 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") package(default_visibility = ["//visibility:public"]) +filegroup( + name = "testdata", + data = glob(["testdata/**/*.carbon"]), +) + cc_library( name = "diagnostic_emitter", hdrs = ["diagnostic_emitter.h"], diff --git a/toolchain/diagnostics/diagnostic_emitter.h b/toolchain/diagnostics/diagnostic_emitter.h index 87eb6c607743..9e5a06b73300 100644 --- a/toolchain/diagnostics/diagnostic_emitter.h +++ b/toolchain/diagnostics/diagnostic_emitter.h @@ -5,6 +5,8 @@ #ifndef CARBON_TOOLCHAIN_DIAGNOSTICS_DIAGNOSTIC_EMITTER_H_ #define CARBON_TOOLCHAIN_DIAGNOSTICS_DIAGNOSTIC_EMITTER_H_ +#include +#include #include #include #include @@ -58,6 +60,8 @@ struct DiagnosticLocation { int32_t line_number = -1; // 1-based column number. int32_t column_number = -1; + // A location can represent a range of text if set to >1 value. + int32_t length = 1; }; // A message composing a diagnostic. This may be the main message, but can also @@ -345,7 +349,7 @@ class StreamDiagnosticConsumer : public DiagnosticConsumer { : stream_(&stream) {} auto HandleDiagnostic(Diagnostic diagnostic) -> void override { - std::string prefix = ""; + std::string prefix; if (diagnostic.level == DiagnosticLevel::Error) { prefix = "ERROR: "; } @@ -367,7 +371,19 @@ class StreamDiagnosticConsumer : public DiagnosticConsumer { if (message.location.column_number > 0) { *stream_ << message.location.line << "\n"; stream_->indent(message.location.column_number - 1); - *stream_ << "^\n"; + *stream_ << "^"; + int underline_length = std::max(0, message.location.length - 1); + // We want to ensure that we don't underline past the end of the line in + // case of a multiline token. + // TODO: revisit this once we can reference multiple ranges on multiple + // lines in a single diagnostic message. + underline_length = std::min( + underline_length, static_cast(message.location.line.size()) - + message.location.column_number); + for (int i = 0; i < underline_length; ++i) { + *stream_ << "~"; + } + *stream_ << "\n"; } } diff --git a/toolchain/diagnostics/testdata/fail_multiline_token.carbon b/toolchain/diagnostics/testdata/fail_multiline_token.carbon new file mode 100644 index 000000000000..fcc8f0298991 --- /dev/null +++ b/toolchain/diagnostics/testdata/fail_multiline_token.carbon @@ -0,0 +1,14 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// ARGS: compile %s +// +// AUTOUPDATE + +// CHECK:STDERR: fail_multiline_token.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. +// CHECK:STDERR: ''' +// CHECK:STDERR: ^~~ +''' +hello +''' diff --git a/toolchain/driver/testdata/fail_flush_errors.carbon b/toolchain/driver/testdata/fail_flush_errors.carbon index 04539ab6e041..a0fbd80ba7e4 100644 --- a/toolchain/driver/testdata/fail_flush_errors.carbon +++ b/toolchain/driver/testdata/fail_flush_errors.carbon @@ -11,7 +11,7 @@ fn F() { // of the string table. // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+3]]:3: ERROR: Name `undeclared1` not found. // CHECK:STDERR: undeclared1; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~~ undeclared1; // Add the name into the string table from the tokenized buffer's string @@ -20,13 +20,13 @@ fn F() { "undec\x6Cared2"; // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+3]]:3: ERROR: Name `undeclared2` not found. // CHECK:STDERR: undeclared2; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~~ undeclared2; // Add the name into the string table via a declaration rather than an expression. if (true) { var undeclared3: i32 = 0; } // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+3]]:3: ERROR: Name `undeclared3` not found. // CHECK:STDERR: undeclared3; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~~~~ undeclared3; } diff --git a/toolchain/lex/tokenized_buffer.cpp b/toolchain/lex/tokenized_buffer.cpp index 19159b14906b..55040b7a2e8e 100644 --- a/toolchain/lex/tokenized_buffer.cpp +++ b/toolchain/lex/tokenized_buffer.cpp @@ -12,6 +12,7 @@ #include "llvm/Support/Format.h" #include "llvm/Support/FormatVariadic.h" #include "toolchain/base/value_store.h" +#include "toolchain/diagnostics/diagnostic_emitter.h" #include "toolchain/lex/character_set.h" #include "toolchain/lex/numeric_literal.h" #include "toolchain/lex/string_literal.h" @@ -377,8 +378,11 @@ auto TokenLocationTranslator::GetLocation(Token token) -> DiagnosticLocation { // Find the corresponding file location. // TODO: Should we somehow indicate in the diagnostic location if this token // is a recovery token that doesn't correspond to the original source? - return TokenizedBuffer::SourceBufferLocationTranslator(buffer_).GetLocation( - token_start); + DiagnosticLocation loc = + TokenizedBuffer::SourceBufferLocationTranslator(buffer_).GetLocation( + token_start); + loc.length = buffer_->GetTokenText(token).size(); + return loc; } } // namespace Carbon::Lex diff --git a/toolchain/parse/testdata/basics/fail_invalid_designators.carbon b/toolchain/parse/testdata/basics/fail_invalid_designators.carbon index f936a10c5429..3c1b52e3595f 100644 --- a/toolchain/parse/testdata/basics/fail_invalid_designators.carbon +++ b/toolchain/parse/testdata/basics/fail_invalid_designators.carbon @@ -12,11 +12,11 @@ fn F() { a.; // CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+3]]:5: ERROR: Expected identifier after `.`. // CHECK:STDERR: a.fn; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ a.fn; // CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+3]]:5: ERROR: Expected identifier after `.`. // CHECK:STDERR: a.42; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ a.42; } diff --git a/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon b/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon index 0f9f2815b7c8..53423060559b 100644 --- a/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_no_intro_with_semi.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: foo; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ foo; // CHECK:STDOUT: - filename: fail_no_intro_with_semi.carbon diff --git a/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon b/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon index ca11c7cc5788..f46642c222c0 100644 --- a/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_no_intro_without_semi.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: foo bar baz -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ foo bar baz // CHECK:STDOUT: - filename: fail_no_intro_without_semi.carbon diff --git a/toolchain/parse/testdata/class/fail_introducer.carbon b/toolchain/parse/testdata/class/fail_introducer.carbon index a5b5d934c7cc..1ae8041b1cbf 100644 --- a/toolchain/parse/testdata/class/fail_introducer.carbon +++ b/toolchain/parse/testdata/class/fail_introducer.carbon @@ -8,17 +8,17 @@ // used on an `interface`. // CHECK:STDERR: fail_introducer.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: abstract interface I; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ abstract interface I; // CHECK:STDERR: fail_introducer.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: base fn F(); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ base fn F(); // CHECK:STDERR: fail_introducer.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: abstract base class C; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ abstract base class C; // CHECK:STDOUT: - filename: fail_introducer.carbon diff --git a/toolchain/parse/testdata/for/fail_returned_var.carbon b/toolchain/parse/testdata/for/fail_returned_var.carbon index 9f47c2a46a5e..e2911c0a2141 100644 --- a/toolchain/parse/testdata/for/fail_returned_var.carbon +++ b/toolchain/parse/testdata/for/fail_returned_var.carbon @@ -8,7 +8,7 @@ fn foo() -> i32 { // TODO: Should we allow this? // CHECK:STDERR: fail_returned_var.carbon:[[@LINE+3]]:8: ERROR: Expected `var` declaration. // CHECK:STDERR: for (returned var x: i32 in y) { - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~~~~ for (returned var x: i32 in y) { return var; } diff --git a/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon b/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon index c241b37817cf..fc34c5332d60 100644 --- a/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+3]]:8: ERROR: `fn` requires a `(` for parameters. // CHECK:STDERR: fn foo bar; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ fn foo bar; // CHECK:STDOUT: - filename: fail_identifier_instead_of_sig.carbon diff --git a/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon index 2151c74fb048..74f8f44e7528 100644 --- a/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_repeated_fn_and_semi.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn fn; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ fn fn; // CHECK:STDOUT: - filename: fail_repeated_fn_and_semi.carbon diff --git a/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon b/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon index e73470f92ea2..a8696fb138c0 100644 --- a/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: struct X { fn () } -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ struct X { fn () } fn F(); diff --git a/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon b/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon index 017b3c24475d..8a51288b5ed0 100644 --- a/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+3]]:15: ERROR: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition. // CHECK:STDERR: interface Bar Baz {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ interface Bar Baz {} interface Foo diff --git a/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon b/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon index beebc7cbbf4b..40f08fa09dad 100644 --- a/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon @@ -7,12 +7,12 @@ interface Foo { // CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+3]]:13: ERROR: Expected parameter declaration. // CHECK:STDERR: fn Sub[me Self](b: Self) -> Self; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ fn Sub[me Self](b: Self) -> Self; // CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+3]]:10: ERROR: Expected parameter declaration. // CHECK:STDERR: fn Mul[Self](b: Self) -> Self; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ fn Mul[Self](b: Self) -> Self; } diff --git a/toolchain/parse/testdata/if/fail_else_unbraced.carbon b/toolchain/parse/testdata/if/fail_else_unbraced.carbon index 5b803e3c1097..574341dc5279 100644 --- a/toolchain/parse/testdata/if/fail_else_unbraced.carbon +++ b/toolchain/parse/testdata/if/fail_else_unbraced.carbon @@ -8,7 +8,7 @@ fn F() { if (a) // CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+3]]:5: ERROR: Expected braced code block. // CHECK:STDERR: if (b) - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ if (b) // CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+3]]:7: ERROR: Expected braced code block. // CHECK:STDERR: c; diff --git a/toolchain/parse/testdata/if/fail_unbraced.carbon b/toolchain/parse/testdata/if/fail_unbraced.carbon index 66346deb351f..133da48f8e9f 100644 --- a/toolchain/parse/testdata/if/fail_unbraced.carbon +++ b/toolchain/parse/testdata/if/fail_unbraced.carbon @@ -9,11 +9,11 @@ fn F() { if (a) // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:5: ERROR: Expected braced code block. // CHECK:STDERR: if (b) - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ if (b) // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:7: ERROR: Expected braced code block. // CHECK:STDERR: if (c) - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ if (c) // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:9: ERROR: Expected braced code block. // CHECK:STDERR: d; diff --git a/toolchain/parse/testdata/if_expression/fail_top_level_if.carbon b/toolchain/parse/testdata/if_expression/fail_top_level_if.carbon index 44e60de6202c..b2562a31c01c 100644 --- a/toolchain/parse/testdata/if_expression/fail_top_level_if.carbon +++ b/toolchain/parse/testdata/if_expression/fail_top_level_if.carbon @@ -7,13 +7,13 @@ fn F() { // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+9]]:6: ERROR: Expected `(` after `if`. // CHECK:STDERR: if true then 1 else 2; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+6]]:11: ERROR: Expected braced code block. // CHECK:STDERR: if true then 1 else 2; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+3]]:11: ERROR: Expected expression. // CHECK:STDERR: if true then 1 else 2; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~ if true then 1 else 2; } diff --git a/toolchain/parse/testdata/namespace/fail_arrow.carbon b/toolchain/parse/testdata/namespace/fail_arrow.carbon index 894953a3e477..a36e2a996e60 100644 --- a/toolchain/parse/testdata/namespace/fail_arrow.carbon +++ b/toolchain/parse/testdata/namespace/fail_arrow.carbon @@ -8,7 +8,7 @@ namespace Foo; // CHECK:STDERR: fail_arrow.carbon:[[@LINE+3]]:7: ERROR: `fn` requires a `(` for parameters. // CHECK:STDERR: fn Foo->Bar() {} -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ fn Foo->Bar() {} // CHECK:STDOUT: - filename: fail_arrow.carbon diff --git a/toolchain/parse/testdata/namespace/fail_incomplete.carbon b/toolchain/parse/testdata/namespace/fail_incomplete.carbon index 6455d9b13ef0..4657d7256685 100644 --- a/toolchain/parse/testdata/namespace/fail_incomplete.carbon +++ b/toolchain/parse/testdata/namespace/fail_incomplete.carbon @@ -6,12 +6,12 @@ // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:11: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace 123 -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ namespace 123 // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:11: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace "" -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ namespace "" // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:11: ERROR: `namespace` introducer should be followed by a name. @@ -21,17 +21,17 @@ namespace + // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:11: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace bool -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~ namespace bool // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:11: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace namespace namespace namespace namespace -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~~ namespace namespace namespace namespace namespace // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:1: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~~ namespace // CHECK:STDOUT: - filename: fail_incomplete.carbon diff --git a/toolchain/parse/testdata/operators/fail_invalid_infix.carbon b/toolchain/parse/testdata/operators/fail_invalid_infix.carbon index 97cc5c56968c..91c47e557087 100644 --- a/toolchain/parse/testdata/operators/fail_invalid_infix.carbon +++ b/toolchain/parse/testdata/operators/fail_invalid_infix.carbon @@ -10,11 +10,11 @@ var a: i32 = n == ; // CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+3]]:14: ERROR: Expected expression. // CHECK:STDERR: var b: i32 = == n; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ var b: i32 = == n; // CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+6]]:14: ERROR: Expected expression. // CHECK:STDERR: var c: i32 = == ; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ // CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+3]]:17: ERROR: Expected expression. // CHECK:STDERR: var c: i32 = == ; // CHECK:STDERR: ^ diff --git a/toolchain/parse/testdata/operators/fail_postincrement.carbon b/toolchain/parse/testdata/operators/fail_postincrement.carbon index 6d2f7963e658..9158c84fef9e 100644 --- a/toolchain/parse/testdata/operators/fail_postincrement.carbon +++ b/toolchain/parse/testdata/operators/fail_postincrement.carbon @@ -9,11 +9,11 @@ fn F() { // TODO: It'd be nice to produce a custom diagnostic here. // CHECK:STDERR: fail_postincrement.carbon:[[@LINE+3]]:4: ERROR: Expected `;` after expression statement. // CHECK:STDERR: n++; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ n++; // CHECK:STDERR: fail_postincrement.carbon:[[@LINE+3]]:4: ERROR: Expected `;` after expression statement. // CHECK:STDERR: n--; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ n--; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon b/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon index 3e62356aa2ef..3f2de3881aea 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon @@ -7,7 +7,7 @@ fn F() { // CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+3]]:11: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: a and b or c; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ a and b or c; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_as.carbon b/toolchain/parse/testdata/operators/fail_precedence_as.carbon index 9e245ce03804..8d4676dd100c 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_as.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_as.carbon @@ -8,17 +8,17 @@ fn F(n: i32) { // No ordering between `not` and `as`. // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+3]]:12: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: not true as bool; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ not true as bool; // No ordering between most binary operators and `as`. // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+3]]:9: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: 1 + 1 as i32; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ 1 + 1 as i32; // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+3]]:9: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: 5 % 2 as i32; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ 5 % 2 as i32; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_assign.carbon b/toolchain/parse/testdata/operators/fail_precedence_assign.carbon index 38cf676894ed..15813720dd37 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_assign.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_assign.carbon @@ -14,18 +14,18 @@ fn F() { 1 + (a = 1); // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+6]]:19: ERROR: Expected `else` after `if ... then ...`. // CHECK:STDERR: (if true then a += 1 else a /= 2); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+3]]:19: ERROR: Expected `,` or `)`. // CHECK:STDERR: (if true then a += 1 else a /= 2); - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ (if true then a += 1 else a /= 2); // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+3]]:7: ERROR: Operator `++` can only be used as a complete statement. // CHECK:STDERR: a + ++a; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ a + ++a; // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+3]]:5: ERROR: Parentheses are required around this unary `if` operator. // CHECK:STDERR: ++if c then a else b; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ ++if c then a else b; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon b/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon index b1e5078dbd3d..4f69d35d6162 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon @@ -7,7 +7,7 @@ fn F() { // CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+3]]:10: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: a or b and c; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~ a or b and c; } diff --git a/toolchain/parse/testdata/operators/fail_variety.carbon b/toolchain/parse/testdata/operators/fail_variety.carbon index b893c5bafb0e..effc3e5d92b2 100644 --- a/toolchain/parse/testdata/operators/fail_variety.carbon +++ b/toolchain/parse/testdata/operators/fail_variety.carbon @@ -10,7 +10,7 @@ fn F() { // CHECK:STDERR: ^ // CHECK:STDERR: fail_variety.carbon:[[@LINE+12]]:29: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ // CHECK:STDERR: fail_variety.carbon:[[@LINE+9]]:34: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g; // CHECK:STDERR: ^ @@ -19,7 +19,7 @@ fn F() { // CHECK:STDERR: ^ // CHECK:STDERR: fail_variety.carbon:[[@LINE+3]]:40: ERROR: Parentheses are required around this unary `not` operator. // CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~ n = a * b + c * d = d * d << e & f - not g; } diff --git a/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon b/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon index c457f276b986..0b219ea47f71 100644 --- a/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon +++ b/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: recover_prefix_repeat.carbon:[[@LINE+3]]:17: ERROR: Parentheses are required around this unary `const` operator. // CHECK:STDERR: fn F() -> const const i32* { -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ fn F() -> const const i32* { } diff --git a/toolchain/parse/testdata/packages/import/fail_after_decl.carbon b/toolchain/parse/testdata/packages/import/fail_after_decl.carbon index 4ee55b272ada..f486561e0e04 100644 --- a/toolchain/parse/testdata/packages/import/fail_after_decl.carbon +++ b/toolchain/parse/testdata/packages/import/fail_after_decl.carbon @@ -8,10 +8,10 @@ fn A(); // CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: ERROR: `import` directives must come after the `package` directive (if present) and before any other entities in the file. // CHECK:STDERR: import B; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: First declaration is here. // CHECK:STDERR: fn A(); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ import B; // CHECK:STDOUT: - filename: fail_after_decl.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon b/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon index 92aa0ab0badf..e194bcb461c9 100644 --- a/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon +++ b/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon @@ -8,30 +8,30 @@ fn A(); // CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+6]]:1: ERROR: `import` directives must come after the `package` directive (if present) and before any other entities in the file. // CHECK:STDERR: import B; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-5]]:1: First declaration is here. // CHECK:STDERR: fn A(); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ import B; // Note this is still invalid, but doesn't warn because it's sequential. import C; // CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+6]]:1: ERROR: The `package` directive must be the first non-comment line. // CHECK:STDERR: package D; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-15]]:1: First non-comment line is here. // CHECK:STDERR: fn A(); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ package D; fn E(); // CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+6]]:1: ERROR: `import` directives must come after the `package` directive (if present) and before any other entities in the file. // CHECK:STDERR: import F; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-25]]:1: First declaration is here. // CHECK:STDERR: fn A(); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ import F; // Note this is still invalid, but doesn't warn because it's sequential. import G; diff --git a/toolchain/parse/testdata/packages/import/fail_extra_string.carbon b/toolchain/parse/testdata/packages/import/fail_extra_string.carbon index b58173ac77d4..0de449dcb3de 100644 --- a/toolchain/parse/testdata/packages/import/fail_extra_string.carbon +++ b/toolchain/parse/testdata/packages/import/fail_extra_string.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:26: ERROR: `import` declarations must end with a `;`. // CHECK:STDERR: import Foo library "bar" "baz"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ import Foo library "bar" "baz"; // CHECK:STDOUT: - filename: fail_extra_string.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon b/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon index 911a3a43a50c..2854b12a8c3b 100644 --- a/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon +++ b/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:25: ERROR: Expected a string literal to specify the library name. // CHECK:STDERR: import Geometry library Shapes; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ import Geometry library Shapes; // CHECK:STDOUT: - filename: fail_library_is_identifier.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon b/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon index bc17d80201a6..1ce58a3a5cba 100644 --- a/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon +++ b/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:8: ERROR: Expected identifier or `library` after `import`. // CHECK:STDERR: import fn; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ import fn; // CHECK:STDOUT: - filename: fail_name_is_keyword.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon b/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon index 1fea016b2f3a..06ed503bac3b 100644 --- a/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon +++ b/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:17: ERROR: Missing `library` keyword. // CHECK:STDERR: import Geometry "Shapes"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ import Geometry "Shapes"; // CHECK:STDOUT: - filename: fail_omit_library_keyword.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_type.carbon b/toolchain/parse/testdata/packages/import/fail_type.carbon index 4b9f180cd299..fd0718b4d527 100644 --- a/toolchain/parse/testdata/packages/import/fail_type.carbon +++ b/toolchain/parse/testdata/packages/import/fail_type.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_type.carbon:[[@LINE+3]]:17: ERROR: `import` declarations must end with a `;`. // CHECK:STDERR: import Geometry api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ import Geometry api; // CHECK:STDOUT: - filename: fail_type.carbon diff --git a/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon b/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon index 6739686812f1..b00a2198fbee 100644 --- a/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon +++ b/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon @@ -8,14 +8,14 @@ // CHECK:STDERR: identifier.carbon:[[@LINE+3]]:9: ERROR: Expected `default` or a string literal to specify the library name. // CHECK:STDERR: library Shapes api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ library Shapes api; // --- raw_identifier.carbon // CHECK:STDERR: raw_identifier.carbon:[[@LINE+3]]:9: ERROR: Expected `default` or a string literal to specify the library name. // CHECK:STDERR: library r#default api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ library r#default api; // --- missing.carbon @@ -29,7 +29,7 @@ library; // CHECK:STDERR: missing_with_api.carbon:[[@LINE+3]]:9: ERROR: Expected `default` or a string literal to specify the library name. // CHECK:STDERR: library api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ library api; // --- no_semi.carbon diff --git a/toolchain/parse/testdata/packages/library/fail_too_late.carbon b/toolchain/parse/testdata/packages/library/fail_too_late.carbon index 54ea670b4f97..118e366fb2e7 100644 --- a/toolchain/parse/testdata/packages/library/fail_too_late.carbon +++ b/toolchain/parse/testdata/packages/library/fail_too_late.carbon @@ -8,10 +8,10 @@ import Geometry; // CHECK:STDERR: fail_too_late.carbon:[[@LINE+6]]:1: ERROR: The `library` directive must be the first non-comment line. // CHECK:STDERR: library "Shapes" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fail_too_late.carbon:[[@LINE-5]]:1: First non-comment line is here. // CHECK:STDERR: import Geometry; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ library "Shapes" api; // CHECK:STDOUT: - filename: fail_too_late.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_after_decl.carbon b/toolchain/parse/testdata/packages/package/fail_after_decl.carbon index 69ebfbd945a0..c409c6e9d2ab 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_decl.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_decl.carbon @@ -8,10 +8,10 @@ fn A(); // CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: ERROR: The `package` directive must be the first non-comment line. // CHECK:STDERR: package B api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: First non-comment line is here. // CHECK:STDERR: fn A(); -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ package B api; // CHECK:STDOUT: - filename: fail_after_decl.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_after_import.carbon b/toolchain/parse/testdata/packages/package/fail_after_import.carbon index bb3b1e20407d..909691b2dafd 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_import.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_import.carbon @@ -8,10 +8,10 @@ import A; // CHECK:STDERR: fail_after_import.carbon:[[@LINE+6]]:1: ERROR: The `package` directive must be the first non-comment line. // CHECK:STDERR: package B api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fail_after_import.carbon:[[@LINE-5]]:1: First non-comment line is here. // CHECK:STDERR: import A; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ package B api; // CHECK:STDOUT: - filename: fail_after_import.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_after_package.carbon b/toolchain/parse/testdata/packages/package/fail_after_package.carbon index a9e4fdecd434..f13f84a40c78 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_package.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_package.carbon @@ -7,10 +7,10 @@ package A api; // CHECK:STDERR: fail_after_package.carbon:[[@LINE+6]]:1: ERROR: The `package` directive must be the first non-comment line. // CHECK:STDERR: package B api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fail_after_package.carbon:[[@LINE-4]]:1: First non-comment line is here. // CHECK:STDERR: package A api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package B api; // CHECK:STDOUT: - filename: fail_after_package.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_extra_string.carbon b/toolchain/parse/testdata/packages/package/fail_extra_string.carbon index 0de4de74db94..80f3418b48bf 100644 --- a/toolchain/parse/testdata/packages/package/fail_extra_string.carbon +++ b/toolchain/parse/testdata/packages/package/fail_extra_string.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:27: ERROR: Expected `api` or `impl`. // CHECK:STDERR: package Foo library "bar" "baz"; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~ package Foo library "bar" "baz"; // CHECK:STDOUT: - filename: fail_extra_string.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon b/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon index 501c5c532b82..650602c56db4 100644 --- a/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon +++ b/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:26: ERROR: Expected a string literal to specify the library name. // CHECK:STDERR: package Geometry library Shapes api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ package Geometry library Shapes api; // CHECK:STDOUT: - filename: fail_library_is_identifier.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon b/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon index f8b4f5275b4a..3993fd729427 100644 --- a/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon +++ b/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+3]]:9: ERROR: Expected identifier after `package`. // CHECK:STDERR: package library "Shapes" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ package library "Shapes" api; // CHECK:STDOUT: - filename: fail_library_skips_name.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon b/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon index 93730f2cf11d..9efaaf64c7a8 100644 --- a/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon +++ b/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:9: ERROR: Expected identifier after `package`. // CHECK:STDERR: package fn; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~ package fn; // CHECK:STDOUT: - filename: fail_name_is_keyword.carbon diff --git a/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon b/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon index a2035a7befa4..479b7e97251e 100644 --- a/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon +++ b/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:18: ERROR: Missing `library` keyword. // CHECK:STDERR: package Geometry "Shapes" api; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~~ package Geometry "Shapes" api; // CHECK:STDOUT: - filename: fail_omit_library_keyword.carbon diff --git a/toolchain/parse/testdata/return/fail_returned_no_var.carbon b/toolchain/parse/testdata/return/fail_returned_no_var.carbon index e582f31283ca..4eea4e0349e0 100644 --- a/toolchain/parse/testdata/return/fail_returned_no_var.carbon +++ b/toolchain/parse/testdata/return/fail_returned_no_var.carbon @@ -7,7 +7,7 @@ fn F() -> String { // CHECK:STDERR: fail_returned_no_var.carbon:[[@LINE+3]]:12: ERROR: Expected `var` after `returned`. // CHECK:STDERR: returned fn G() -> i32; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~ returned fn G() -> i32; } diff --git a/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon b/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon index bcda34c30c40..becdad2d0315 100644 --- a/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon +++ b/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`. // CHECK:STDERR: var x: {."hello": i32, .y: i32} = {}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ var x: {."hello": i32, .y: i32} = {}; // CHECK:STDOUT: - filename: fail_dot_string_colon.carbon diff --git a/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon b/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon index c2a597762af9..1fad97d1a4f8 100644 --- a/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_dot_string_equals.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`. // CHECK:STDERR: var x: {."hello" = 0, .y = 4} = {}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~~ var x: {."hello" = 0, .y = 4} = {}; // CHECK:STDOUT: - filename: fail_dot_string_equals.carbon diff --git a/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon b/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon index c3bc7f3cf9dd..a2a7641be3d6 100644 --- a/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon +++ b/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_extra_token_in_type.carbon:[[@LINE+3]]:17: ERROR: Expected `,` or `}`. // CHECK:STDERR: var x: {.a: i32 banana} = {.a = 0}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ var x: {.a: i32 banana} = {.a = 0}; // CHECK:STDOUT: - filename: fail_extra_token_in_type.carbon diff --git a/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon b/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon index e6a487da7fea..b0369f6989f3 100644 --- a/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon +++ b/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_extra_token_in_value.carbon:[[@LINE+3]]:28: ERROR: Expected `,` or `}`. // CHECK:STDERR: var x: {.a: i32} = {.a = 0 banana}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~~~~ var x: {.a: i32} = {.a = 0 banana}; // CHECK:STDOUT: - filename: fail_extra_token_in_value.carbon diff --git a/toolchain/parse/testdata/struct/fail_type_no_designator.carbon b/toolchain/parse/testdata/struct/fail_type_no_designator.carbon index bd4b89739f2f..f7eba4d0fe33 100644 --- a/toolchain/parse/testdata/struct/fail_type_no_designator.carbon +++ b/toolchain/parse/testdata/struct/fail_type_no_designator.carbon @@ -6,7 +6,7 @@ // CHECK:STDERR: fail_type_no_designator.carbon:[[@LINE+3]]:9: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {i32} = {}; -// CHECK:STDERR: ^ +// CHECK:STDERR: ^~~ var x: {i32} = {}; // CHECK:STDOUT: - filename: fail_type_no_designator.carbon diff --git a/toolchain/parse/testdata/while/fail_unbraced.carbon b/toolchain/parse/testdata/while/fail_unbraced.carbon index 34b6f4fa371a..2300d15f919c 100644 --- a/toolchain/parse/testdata/while/fail_unbraced.carbon +++ b/toolchain/parse/testdata/while/fail_unbraced.carbon @@ -9,7 +9,7 @@ fn F() { while (a) // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:5: ERROR: Expected braced code block. // CHECK:STDERR: break; - // CHECK:STDERR: ^ + // CHECK:STDERR: ^~~~~ break; } diff --git a/toolchain/testing/BUILD b/toolchain/testing/BUILD index 349616a110b4..c010f4e1b229 100644 --- a/toolchain/testing/BUILD +++ b/toolchain/testing/BUILD @@ -14,6 +14,7 @@ file_test( tests = [ "//toolchain/check:testdata", "//toolchain/codegen:testdata", + "//toolchain/diagnostics:testdata", "//toolchain/driver:testdata", "//toolchain/lex:testdata", "//toolchain/lower:testdata",