mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:54:41 +01:00
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:
+11
-11
@@ -28,7 +28,7 @@ export Foo.Bar;
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_expr.carbon:[[@LINE+4]]:8: error(ExpectedDeclName): `export` introducer should be followed by a name
|
||||
// CHECK:STDERR: fail_expr.carbon:[[@LINE+4]]:8: error: `export` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: export ();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -38,7 +38,7 @@ export ();
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_package_in_name.carbon:[[@LINE+4]]:8: error(ExpectedDeclName): `export` introducer should be followed by a name
|
||||
// CHECK:STDERR: fail_package_in_name.carbon:[[@LINE+4]]:8: error: `export` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: export package.Bar;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -48,7 +48,7 @@ export package.Bar;
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_keyword_only:[[@LINE+4]]:1: error(ExpectedDeclName): `export` introducer should be followed by a name
|
||||
// CHECK:STDERR: fail_keyword_only:[[@LINE+4]]:1: error: `export` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: export
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -58,7 +58,7 @@ export
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+4]]:8: error(ExpectedDeclName): `export` introducer should be followed by a name
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+4]]:8: error: `export` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: export ;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -69,7 +69,7 @@ export ;
|
||||
package Pkg;
|
||||
|
||||
export Foo
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+4]]:1: error(ExpectedDeclSemi): `export` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+4]]:1: error: `export` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -78,7 +78,7 @@ export Foo
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_qual_name.carbon:[[@LINE+4]]:12: error(ExpectedDeclNameAfterPeriod): `.` should be followed by a name
|
||||
// CHECK:STDERR: fail_incomplete_qual_name.carbon:[[@LINE+4]]:12: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod]
|
||||
// CHECK:STDERR: export Foo.;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -88,7 +88,7 @@ export Foo.;
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_qual_name2.carbon:[[@LINE+4]]:8: error(ExpectedDeclName): `export` introducer should be followed by a name
|
||||
// CHECK:STDERR: fail_incomplete_qual_name2.carbon:[[@LINE+4]]:8: error: `export` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: export .Bar;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -108,10 +108,10 @@ package Pkg;
|
||||
|
||||
export Foo;
|
||||
|
||||
// CHECK:STDERR: fail_before_import.carbon:[[@LINE+7]]:1: error(ImportTooLate): `import` declarations must come after the `package` declaration (if present) and before any other entities in the file
|
||||
// CHECK:STDERR: fail_before_import.carbon:[[@LINE+7]]:1: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate]
|
||||
// CHECK:STDERR: import library "lib";
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_before_import.carbon:[[@LINE-5]]:1: note(FirstDecl): first declaration is here
|
||||
// CHECK:STDERR: fail_before_import.carbon:[[@LINE-5]]:1: note: first declaration is here [FirstDecl]
|
||||
// CHECK:STDERR: export Foo;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -119,7 +119,7 @@ import library "lib";
|
||||
|
||||
// --- fail_in_default_library.carbon
|
||||
|
||||
// CHECK:STDERR: fail_in_default_library.carbon:[[@LINE+4]]:1: error(ExportFromImpl): `export` is only allowed in API files
|
||||
// CHECK:STDERR: fail_in_default_library.carbon:[[@LINE+4]]:1: error: `export` is only allowed in API files [ExportFromImpl]
|
||||
// CHECK:STDERR: export Foo;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -129,7 +129,7 @@ export Foo;
|
||||
|
||||
impl package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_in_impl.carbon:[[@LINE+3]]:1: error(ExportFromImpl): `export` is only allowed in API files
|
||||
// CHECK:STDERR: fail_in_impl.carbon:[[@LINE+3]]:1: error: `export` is only allowed in API files [ExportFromImpl]
|
||||
// CHECK:STDERR: export Foo;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
export Foo;
|
||||
|
||||
+5
-5
@@ -12,7 +12,7 @@
|
||||
|
||||
package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_package.carbon:[[@LINE+4]]:15: error(ExportImportPackage): `export` cannot be used when importing a package
|
||||
// CHECK:STDERR: fail_package.carbon:[[@LINE+4]]:15: error: `export` cannot be used when importing a package [ExportImportPackage]
|
||||
// CHECK:STDERR: export import Bar;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
@@ -38,10 +38,10 @@ export import library "a";
|
||||
|
||||
class C;
|
||||
|
||||
// CHECK:STDERR: fail_order.carbon:[[@LINE+7]]:1: error(ImportTooLate): `import` declarations must come after the `package` declaration (if present) and before any other entities in the file
|
||||
// CHECK:STDERR: fail_order.carbon:[[@LINE+7]]:1: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate]
|
||||
// CHECK:STDERR: export import library "b";
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_order.carbon:[[@LINE-5]]:1: note(FirstDecl): first declaration is here
|
||||
// CHECK:STDERR: fail_order.carbon:[[@LINE-5]]:1: note: first declaration is here [FirstDecl]
|
||||
// CHECK:STDERR: class C;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -49,7 +49,7 @@ export import library "b";
|
||||
|
||||
// --- fail_in_default_library.carbon
|
||||
|
||||
// CHECK:STDERR: fail_in_default_library.carbon:[[@LINE+4]]:1: error(ExportFromImpl): `export` is only allowed in API files
|
||||
// CHECK:STDERR: fail_in_default_library.carbon:[[@LINE+4]]:1: error: `export` is only allowed in API files [ExportFromImpl]
|
||||
// CHECK:STDERR: export import library "lib";
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -59,7 +59,7 @@ export import library "lib";
|
||||
|
||||
impl package Pkg;
|
||||
|
||||
// CHECK:STDERR: fail_in_impl.carbon:[[@LINE+3]]:1: error(ExportFromImpl): `export` is only allowed in API files
|
||||
// CHECK:STDERR: fail_in_impl.carbon:[[@LINE+3]]:1: error: `export` is only allowed in API files [ExportFromImpl]
|
||||
// CHECK:STDERR: export import library "lib";
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
export import library "lib";
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
fn A();
|
||||
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: error(ImportTooLate): `import` declarations must come after the `package` declaration (if present) and before any other entities in the file
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate]
|
||||
// CHECK:STDERR: import B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: note(FirstDecl): first declaration is here
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: note: first declaration is here [FirstDecl]
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~
|
||||
import B;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
fn A();
|
||||
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+7]]:1: error(ImportTooLate): `import` declarations must come after the `package` declaration (if present) and before any other entities in the file
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+7]]:1: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate]
|
||||
// CHECK:STDERR: import B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-5]]:1: note(FirstDecl): first declaration is here
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-5]]:1: note: first declaration is here [FirstDecl]
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
@@ -21,10 +21,10 @@ 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+7]]:1: error(PackageTooLate): the `package` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+7]]:1: error: the `package` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: package D;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-16]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-16]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
@@ -32,10 +32,10 @@ package D;
|
||||
|
||||
fn E();
|
||||
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+6]]:1: error(ImportTooLate): `import` declarations must come after the `package` declaration (if present) and before any other entities in the file
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+6]]:1: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate]
|
||||
// CHECK:STDERR: import F;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-27]]:1: note(FirstDecl): first declaration is here
|
||||
// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-27]]:1: note: first declaration is here [FirstDecl]
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~
|
||||
import F;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_extra_string.carbon
|
||||
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:26: error(ExpectedDeclSemi): `import` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:26: error: `import` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: import Foo library "bar" "baz";
|
||||
// CHECK:STDERR: ^~~~~
|
||||
import Foo library "bar" "baz";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon
|
||||
|
||||
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:25: error(ExpectedLibraryName): expected a string literal to specify the library name
|
||||
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:25: error: expected a string literal to specify the library name [ExpectedLibraryName]
|
||||
// CHECK:STDERR: import Geometry library Shapes;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
import Geometry library Shapes;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon
|
||||
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:8: error(ExpectedIdentifierAfterImport): expected identifier or `library` after `import`
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:8: error: expected identifier or `library` after `import` [ExpectedIdentifierAfterImport]
|
||||
// CHECK:STDERR: import fn;
|
||||
// CHECK:STDERR: ^~
|
||||
import fn;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_no_name.carbon
|
||||
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:7: error(ExpectedIdentifierAfterImport): expected identifier or `library` after `import`
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:7: error: expected identifier or `library` after `import` [ExpectedIdentifierAfterImport]
|
||||
// CHECK:STDERR: import;
|
||||
// CHECK:STDERR: ^
|
||||
import;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import Geometry
|
||||
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+10]]:21: error(ExpectedDeclSemi): `import` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+10]]:21: error: `import` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: // CHECK:STDOUT: ]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDOUT: - filename: fail_no_semi.carbon
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon
|
||||
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:17: error(MissingLibraryKeyword): missing `library` keyword
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:17: error: missing `library` keyword [MissingLibraryKeyword]
|
||||
// CHECK:STDERR: import Geometry "Shapes";
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
import Geometry "Shapes";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_type.carbon
|
||||
|
||||
// CHECK:STDERR: fail_type.carbon:[[@LINE+3]]:17: error(ExpectedDeclSemi): `import` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_type.carbon:[[@LINE+3]]:17: error: `import` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: import Geometry api;
|
||||
// CHECK:STDERR: ^~~
|
||||
import Geometry api;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
// --- fail_identifier.carbon
|
||||
|
||||
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+4]]:9: error(ExpectedLibraryNameOrDefault): expected `default` or a string literal to specify the library name
|
||||
// CHECK:STDERR: fail_identifier.carbon:[[@LINE+4]]:9: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault]
|
||||
// CHECK:STDERR: library Shapes;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -18,7 +18,7 @@ library Shapes;
|
||||
|
||||
// --- fail_raw_identifier.carbon
|
||||
|
||||
// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+4]]:9: error(ExpectedLibraryNameOrDefault): expected `default` or a string literal to specify the library name
|
||||
// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+4]]:9: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault]
|
||||
// CHECK:STDERR: library r#default;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -26,7 +26,7 @@ library r#default;
|
||||
|
||||
// --- fail_missing.carbon
|
||||
|
||||
// CHECK:STDERR: fail_missing.carbon:[[@LINE+4]]:8: error(ExpectedLibraryNameOrDefault): expected `default` or a string literal to specify the library name
|
||||
// CHECK:STDERR: fail_missing.carbon:[[@LINE+4]]:8: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault]
|
||||
// CHECK:STDERR: library;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -34,7 +34,7 @@ library;
|
||||
|
||||
// --- fail_missing_with_api.carbon
|
||||
|
||||
// CHECK:STDERR: fail_missing_with_api.carbon:[[@LINE+4]]:8: error(ExpectedLibraryNameOrDefault): expected `default` or a string literal to specify the library name
|
||||
// CHECK:STDERR: fail_missing_with_api.carbon:[[@LINE+4]]:8: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault]
|
||||
// CHECK:STDERR: library;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -42,7 +42,7 @@ library;
|
||||
|
||||
// --- fail_trailing_impl.carbon
|
||||
|
||||
// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+4]]:25: error(ExpectedDeclSemi): `library` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+4]]:25: error: `library` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: library "trailing_impl" impl
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -52,7 +52,7 @@ library "[[@TEST_NAME]]" impl
|
||||
|
||||
library "[[@TEST_NAME]]"
|
||||
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+46]]:21: error(ExpectedDeclSemi): `library` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+46]]:21: error: `library` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: // CHECK:STDOUT: ]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDOUT: - filename: fail_identifier.carbon
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
;
|
||||
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE+6]]:1: error(PackageTooLate): the `library` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE+6]]:1: error: the `library` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: library "semi_before";
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE-5]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE-5]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: ;
|
||||
// CHECK:STDERR: ^
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
import Geometry;
|
||||
|
||||
// CHECK:STDERR: fail_too_late.carbon:[[@LINE+6]]:1: error(PackageTooLate): the `library` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_too_late.carbon:[[@LINE+6]]:1: error: the `library` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: library "too_late";
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_too_late.carbon:[[@LINE-5]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_too_late.carbon:[[@LINE-5]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: import Geometry;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
fn A();
|
||||
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: error(PackageTooLate): the `package` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: error: the `package` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: package B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: fn A();
|
||||
// CHECK:STDERR: ^~
|
||||
package B;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
import A;
|
||||
|
||||
// CHECK:STDERR: fail_after_import.carbon:[[@LINE+6]]:1: error(PackageTooLate): the `package` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_after_import.carbon:[[@LINE+6]]:1: error: the `package` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: package B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_after_import.carbon:[[@LINE-5]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_after_import.carbon:[[@LINE-5]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: import A;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
package B;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_after_package.carbon
|
||||
|
||||
package A;
|
||||
// CHECK:STDERR: fail_after_package.carbon:[[@LINE+6]]:1: error(PackageTooLate): the `package` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_after_package.carbon:[[@LINE+6]]:1: error: the `package` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: package B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_after_package.carbon:[[@LINE-4]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_after_package.carbon:[[@LINE-4]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: package A;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
package B;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_extra_string.carbon
|
||||
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:27: error(ExpectedDeclSemi): `package` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:27: error: `package` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: package Foo library "bar" "baz";
|
||||
// CHECK:STDERR: ^~~~~
|
||||
package Foo library "bar" "baz";
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon
|
||||
|
||||
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:26: error(ExpectedLibraryName): expected a string literal to specify the library name
|
||||
// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:26: error: expected a string literal to specify the library name [ExpectedLibraryName]
|
||||
// CHECK:STDERR: package Geometry library Shapes;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
package Geometry library Shapes;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon
|
||||
|
||||
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+3]]:9: error(ExpectedIdentifierAfterPackage): expected identifier after `package`
|
||||
// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+3]]:9: error: expected identifier after `package` [ExpectedIdentifierAfterPackage]
|
||||
// CHECK:STDERR: package library "Shapes";
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
package library "Shapes";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon
|
||||
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:9: error(ExpectedIdentifierAfterPackage): expected identifier after `package`
|
||||
// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:9: error: expected identifier after `package` [ExpectedIdentifierAfterPackage]
|
||||
// CHECK:STDERR: package fn;
|
||||
// CHECK:STDERR: ^~
|
||||
package fn;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_no_name.carbon
|
||||
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:8: error(ExpectedIdentifierAfterPackage): expected identifier after `package`
|
||||
// CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:8: error: expected identifier after `package` [ExpectedIdentifierAfterPackage]
|
||||
// CHECK:STDERR: package;
|
||||
// CHECK:STDERR: ^
|
||||
package;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
package Geometry
|
||||
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+10]]:21: error(ExpectedDeclSemi): `package` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+10]]:21: error: `package` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: // CHECK:STDOUT: ]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDOUT: - filename: fail_no_semi.carbon
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon
|
||||
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:18: error(MissingLibraryKeyword): missing `library` keyword
|
||||
// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:18: error: missing `library` keyword [MissingLibraryKeyword]
|
||||
// CHECK:STDERR: package Geometry "Shapes";
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
package Geometry "Shapes";
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
;
|
||||
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE+6]]:1: error(PackageTooLate): the `package` declaration must be the first non-comment line
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE+6]]:1: error: the `package` declaration must be the first non-comment line [PackageTooLate]
|
||||
// CHECK:STDERR: package Geometry;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE-5]]:1: note(FirstNonCommentLine): first non-comment line is here
|
||||
// CHECK:STDERR: fail_semi_before.carbon:[[@LINE-5]]:1: note: first non-comment line is here [FirstNonCommentLine]
|
||||
// CHECK:STDERR: ;
|
||||
// CHECK:STDERR: ^
|
||||
package Geometry;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon
|
||||
|
||||
// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+3]]:18: error(ExpectedDeclSemi): `package` declarations must end with a `;`
|
||||
// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+3]]:18: error: `package` declarations must end with a `;` [ExpectedDeclSemi]
|
||||
// CHECK:STDERR: package Geometry impl;
|
||||
// CHECK:STDERR: ^~~~
|
||||
package Geometry impl;
|
||||
|
||||
Reference in New Issue
Block a user