Move diagnostic kind name to the end of the diagnostic. (#4437)

Also surround it in square brackets rather than parentheses. This
matches the format used by Clang and GCC, and means diagnostics will
still match the `file:line:col: error: ` pattern used by some IDE tools.

Before:
```console
fail_builtins.carbon:11:11: error(AliasRequiresNameRef): alias initializer must be a name reference
```

After:
```console
fail_builtins.carbon:11:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
```

Also tighten up test regex to only match on `STDERR` lines that list a
file name.
This commit is contained in:
Richard Smith
2024-10-23 16:56:23 +00:00
committed by GitHub
parent f206072216
commit 2e63da1a40
528 changed files with 1929 additions and 1928 deletions
+15 -15
View File
@@ -47,20 +47,20 @@ library "[[@TEST_NAME]]";
import library "fns";
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+8]]:1: error(RedeclRedundant): redeclaration of `fn A` is redundant
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+8]]:1: error: redeclaration of `fn A` is redundant [RedeclRedundant]
// CHECK:STDERR: fn A() {};
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE-5]]:1(InImport): in import
// CHECK:STDERR: fns.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE-5]]:1: in import [InImport]
// CHECK:STDERR: fns.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn A() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
fn A() {};
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+8]]:1: error(RedeclRedundant): redeclaration of `fn B` is redundant
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+8]]:1: error: redeclaration of `fn B` is redundant [RedeclRedundant]
// CHECK:STDERR: fn B(b: i32) -> i32;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE-14]]:1(InImport): in import
// CHECK:STDERR: fns.carbon:5:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE-14]]:1: in import [InImport]
// CHECK:STDERR: fns.carbon:5:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn B(b: i32) -> i32 { return b; }
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -72,21 +72,21 @@ library "[[@TEST_NAME]]";
import library "extern";
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+8]]:1: error(RedeclExternMismatch): redeclarations of `fn A` must match use of `extern`
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: fn A();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE-5]]:1(InImport): in import
// CHECK:STDERR: extern.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE-5]]:1: in import [InImport]
// CHECK:STDERR: extern.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn A();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
fn A();
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+8]]:1: error(RedeclExternMismatch): redeclarations of `fn A` must match use of `extern`
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: fn A() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE-15]]:1(InImport): in import
// CHECK:STDERR: extern.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE-15]]:1: in import [InImport]
// CHECK:STDERR: extern.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn A();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -98,11 +98,11 @@ library "[[@TEST_NAME]]";
import library "fns";
// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE+7]]:1: error(RedeclExternMismatch): redeclarations of `fn D` must match use of `extern`
// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE+7]]:1: error: redeclarations of `fn D` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: extern fn D();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE-5]]:1(InImport): in import
// CHECK:STDERR: fns.carbon:7:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE-5]]:1: in import [InImport]
// CHECK:STDERR: fns.carbon:7:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn D();
// CHECK:STDERR: ^~~~~~~
extern fn D();
@@ -48,7 +48,7 @@ package Test library "[[@TEST_NAME]]";
import library "def";
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:13: error(NameNotFound): name `Def` not found
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:13: error: name `Def` not found [NameNotFound]
// CHECK:STDERR: var f: () = Def();
// CHECK:STDERR: ^~~
// CHECK:STDERR:
@@ -60,7 +60,7 @@ package Other library "[[@TEST_NAME]]";
import Test library "def";
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:13: error(NameNotFound): name `Def` not found
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+4]]:13: error: name `Def` not found [NameNotFound]
// CHECK:STDERR: var f: () = Test.Def();
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
@@ -78,7 +78,7 @@ package Test library "[[@TEST_NAME]]";
import library "forward_with_def";
// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+4]]:13: error(NameNotFound): name `ForwardWithDef` not found
// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+4]]:13: error: name `ForwardWithDef` not found [NameNotFound]
// CHECK:STDERR: var f: () = ForwardWithDef();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -90,7 +90,7 @@ package Other library "[[@TEST_NAME]]";
import Test library "forward_with_def";
// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+4]]:13: error(NameNotFound): name `ForwardWithDef` not found
// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+4]]:13: error: name `ForwardWithDef` not found [NameNotFound]
// CHECK:STDERR: var f: () = Test.ForwardWithDef();
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -110,7 +110,7 @@ package Test library "[[@TEST_NAME]]";
import library "forward";
// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+4]]:13: error(NameNotFound): name `Forward` not found
// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+4]]:13: error: name `Forward` not found [NameNotFound]
// CHECK:STDERR: var f: () = Forward();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -122,7 +122,7 @@ package Other library "[[@TEST_NAME]]";
import Test library "forward";
// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+3]]:13: error(NameNotFound): name `Forward` not found
// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+3]]:13: error: name `Forward` not found [NameNotFound]
// CHECK:STDERR: var f: () = Test.Forward();
// CHECK:STDERR: ^~~~~~~~~~~~
var f: () = Test.Forward();
@@ -38,10 +38,10 @@ extern fn F() {}
library "[[@TEST_NAME]]";
extern fn F();
// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE+7]]:1: error(RedeclExternMismatch): redeclarations of `fn F` must match use of `extern`
// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE+7]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: fn F() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE-4]]:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn F();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -52,10 +52,10 @@ fn F() {}
library "[[@TEST_NAME]]";
fn F();
// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE+7]]:1: error(RedeclExternMismatch): redeclarations of `fn F` must match use of `extern`
// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE+7]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: extern fn F() {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE-4]]:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn F();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -66,18 +66,18 @@ extern fn F() {}
library "[[@TEST_NAME]]";
extern fn F();
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+7]]:1: error(RedeclRedundant): redeclaration of `fn F` is redundant
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+7]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant]
// CHECK:STDERR: fn F();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-4]]:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn F();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
fn F();
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+7]]:1: error(RedeclExternMismatch): redeclarations of `fn F` must match use of `extern`
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+7]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: fn F() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-12]]:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-12]]:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn F();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -88,10 +88,10 @@ fn F() {}
library "[[@TEST_NAME]]";
fn F() {}
// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE+7]]:1: error(RedeclRedundant): redeclaration of `fn F` is redundant
// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE+7]]:1: error: redeclaration of `fn F` is redundant [RedeclRedundant]
// CHECK:STDERR: extern fn F();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE-4]]:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE-4]]:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn F() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
@@ -105,7 +105,7 @@ library "[[@TEST_NAME]]";
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+3]]:1: error(ExternRequiresDeclInApiFile): `extern` entities must have a declaration in the API file
// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+3]]:1: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile]
// CHECK:STDERR: extern fn F() {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
extern fn F() {}
@@ -54,11 +54,11 @@ extern fn F();
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE+8]]:1: error(RedeclExternMismatch): redeclarations of `fn F` must match use of `extern`
// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: fn F() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE-5]]:6(InImport): in import
// CHECK:STDERR: two_file_impl_mismatch.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE-5]]:6: in import [InImport]
// CHECK:STDERR: two_file_impl_mismatch.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn F();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -80,7 +80,7 @@ import library "indirect_two_file_extern";
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_indirect_two_file.impl.carbon:[[@LINE+4]]:1: error(ExternRequiresDeclInApiFile): `extern` entities must have a declaration in the API file
// CHECK:STDERR: fail_indirect_two_file.impl.carbon:[[@LINE+4]]:1: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile]
// CHECK:STDERR: extern fn F() {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -102,7 +102,7 @@ impl library "[[@TEST_NAME]]";
import library "in_impl_extern";
// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+3]]:1: error(ExternRequiresDeclInApiFile): `extern` entities must have a declaration in the API file
// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+3]]:1: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile]
// CHECK:STDERR: extern fn F() {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
extern fn F() {}
@@ -9,57 +9,57 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon
fn F();
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error(RedeclParamCountDiffers): redeclaration differs because of parameter count of 1
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers]
// CHECK:STDERR: fn F(x: ()) {}
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note(RedeclParamCountPrevious): previously declared with parameter count of 0
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 0 [RedeclParamCountPrevious]
// CHECK:STDERR: fn F();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
fn F(x: ()) {}
fn G(x: ());
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error(RedeclParamCountDiffers): redeclaration differs because of parameter count of 0
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers]
// CHECK:STDERR: fn G() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note(RedeclParamCountPrevious): previously declared with parameter count of 1
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
// CHECK:STDERR: fn G(x: ());
// CHECK:STDERR: ^~~~~~~~~~~~
// CHECK:STDERR:
fn G() {}
fn H(x: ());
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+4]]:9: error(CoreNotFound): package `Core` implicitly referenced here, but not found
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+4]]:9: error: package `Core` implicitly referenced here, but not found [CoreNotFound]
// CHECK:STDERR: fn H(x: bool) {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
fn H(x: bool) {}
fn I();
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error(FunctionRedeclReturnTypeDiffers): function redeclaration differs because return type is `()`
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers]
// CHECK:STDERR: fn I() -> () { return (); }
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note(FunctionRedeclReturnTypePreviousNoReturn): previously declared with no return type
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn]
// CHECK:STDERR: fn I();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
fn I() -> () { return (); }
fn J() -> ();
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error(FunctionRedeclReturnTypeDiffersNoReturn): function redeclaration differs because no return type is provided
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: error: function redeclaration differs because no return type is provided [FunctionRedeclReturnTypeDiffersNoReturn]
// CHECK:STDERR: fn J() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note(FunctionRedeclReturnTypePrevious): previously declared with return type `()`
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious]
// CHECK:STDERR: fn J() -> ();
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
fn J() {}
fn K() -> ();
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+6]]:1: error(FunctionRedeclReturnTypeDiffers): function redeclaration differs because return type is `{}`
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+6]]:1: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers]
// CHECK:STDERR: fn K() -> {} { return {}; }
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note(FunctionRedeclReturnTypePrevious): previously declared with return type `()`
// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-4]]:1: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious]
// CHECK:STDERR: fn K() -> ();
// CHECK:STDERR: ^~~~~~~~~~~~~
fn K() -> {} { return {}; }
@@ -9,10 +9,10 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon
fn F() {}
// CHECK:STDERR: fail_redef.carbon:[[@LINE+6]]:1: error(RedeclRedef): redefinition of `fn F`
// CHECK:STDERR: fail_redef.carbon:[[@LINE+6]]:1: error: redefinition of `fn F` [RedeclRedef]
// CHECK:STDERR: fn F() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_redef.carbon:[[@LINE-4]]:1: note(RedeclPrevDef): previously defined here
// CHECK:STDERR: fail_redef.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef]
// CHECK:STDERR: fn F() {}
// CHECK:STDERR: ^~~~~~~~
fn F() {}
@@ -30,11 +30,11 @@ extern fn A();
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+8]]:1: error(RedeclExternMismatch): redeclarations of `fn A` must match use of `extern`
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: fn A() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE-5]]:6(InImport): in import
// CHECK:STDERR: extern_api.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE-5]]:6: in import [InImport]
// CHECK:STDERR: extern_api.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: extern fn A();
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -50,11 +50,11 @@ fn A();
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+8]]:1: error(RedeclExternMismatch): redeclarations of `fn A` must match use of `extern`
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch]
// CHECK:STDERR: extern fn A() {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE-5]]:6(InImport): in import
// CHECK:STDERR: extern_impl.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE-5]]:6: in import [InImport]
// CHECK:STDERR: extern_impl.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn A();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -70,11 +70,11 @@ fn A() {}
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+8]]:1: error(RedeclRedundant): redeclaration of `fn A` is redundant
// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+8]]:1: error: redeclaration of `fn A` is redundant [RedeclRedundant]
// CHECK:STDERR: fn A();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE-5]]:6(InImport): in import
// CHECK:STDERR: redecl_after_def.carbon:4:1: note(RedeclPrevDecl): previously declared here
// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE-5]]:6: in import [InImport]
// CHECK:STDERR: redecl_after_def.carbon:4:1: note: previously declared here [RedeclPrevDecl]
// CHECK:STDERR: fn A() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
@@ -90,11 +90,11 @@ fn A() {}
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+8]]:1: error(RedeclRedef): redefinition of `fn A`
// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+8]]:1: error: redefinition of `fn A` [RedeclRedef]
// CHECK:STDERR: fn A() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE-5]]:6(InImport): in import
// CHECK:STDERR: redef_after_def.carbon:4:1: note(RedeclPrevDef): previously defined here
// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE-5]]:6: in import [InImport]
// CHECK:STDERR: redef_after_def.carbon:4:1: note: previously defined here [RedeclPrevDef]
// CHECK:STDERR: fn A() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
@@ -111,11 +111,11 @@ alias B = A;
impl library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+7]]:1: error(NameDeclDuplicate): duplicate name being declared in the same scope
// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+7]]:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
// CHECK:STDERR: fn B() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE-5]]:6(InImport): in import
// CHECK:STDERR: def_alias.carbon:5:7: note(NameDeclPrevious): name is previously declared here
// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE-5]]:6: in import [InImport]
// CHECK:STDERR: def_alias.carbon:5:7: note: name is previously declared here [NameDeclPrevious]
// CHECK:STDERR: alias B = A;
// CHECK:STDERR: ^
fn B() {}
@@ -37,10 +37,10 @@ library "[[@TEST_NAME]]";
class C {}
fn Foo(a: C);
// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:11: error(RedeclParamSyntaxDiffers): redeclaration syntax differs here
// CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
// CHECK:STDERR: fn Foo(a: (C)) {}
// CHECK:STDERR: ^
// CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:11: note(RedeclParamSyntaxPrevious): comparing with previous declaration here
// CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
// CHECK:STDERR: fn Foo(a: C);
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -80,10 +80,10 @@ class C {}
alias D = C;
fn Foo(a: C);
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:8: error(RedeclParamDiffers): redeclaration differs at parameter 1
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:8: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
// CHECK:STDERR: fn Foo(b: D) {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:8: note(RedeclParamPrevious): previous declaration's corresponding parameter here
// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:8: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
// CHECK:STDERR: fn Foo(a: C);
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -97,10 +97,10 @@ class C {}
alias D = C;
fn Foo(a: C);
// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:11: error(RedeclParamSyntaxDiffers): redeclaration syntax differs here
// CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
// CHECK:STDERR: fn Foo(a: D) {}
// CHECK:STDERR: ^
// CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:11: note(RedeclParamSyntaxPrevious): comparing with previous declaration here
// CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
// CHECK:STDERR: fn Foo(a: C);
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -114,10 +114,10 @@ class C {}
alias D = C;
fn Foo[a:! C]();
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:12: error(RedeclParamSyntaxDiffers): redeclaration syntax differs here
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:12: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
// CHECK:STDERR: fn Foo[a:! D]() {}
// CHECK:STDERR: ^
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:12: note(RedeclParamSyntaxPrevious): comparing with previous declaration here
// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:12: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
// CHECK:STDERR: fn Foo[a:! C]();
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -156,14 +156,14 @@ library "[[@TEST_NAME]]";
class C {}
fn Foo(a: const C);
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+10]]:11: warning(RepeatedConst): `const` applied repeatedly to the same type has no additional effect
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+10]]:11: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst]
// CHECK:STDERR: fn Foo(a: const (const C)) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+6]]:17: error(RedeclParamSyntaxDiffers): redeclaration syntax differs here
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+6]]:17: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
// CHECK:STDERR: fn Foo(a: const (const C)) {}
// CHECK:STDERR: ^
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:17: note(RedeclParamSyntaxPrevious): comparing with previous declaration here
// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
// CHECK:STDERR: fn Foo(a: const C);
// CHECK:STDERR: ^
fn Foo(a: const (const C)) {}