mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:51:05 +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:
+1
-1
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_bool_value.carbon
|
||||
|
||||
// CHECK:STDERR: fail_bool_value.carbon:[[@LINE+3]]:11: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_bool_value.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias a = false;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
alias a = false;
|
||||
|
||||
+2
-2
@@ -8,13 +8,13 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_builtins.carbon
|
||||
|
||||
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias a = i32;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
alias a = i32;
|
||||
|
||||
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+3]]:11: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias b = bool;
|
||||
// CHECK:STDERR: ^~~~
|
||||
alias b = bool;
|
||||
|
||||
+3
-3
@@ -8,15 +8,15 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_control_flow.carbon
|
||||
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+11]]:11: error(SemanticsTodo): semantics TODO: `Control flow expressions are currently only supported inside functions.`
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+11]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR: alias a = true or false;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+7]]:11: error(SemanticsTodo): semantics TODO: `Control flow expressions are currently only supported inside functions.`
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+7]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo]
|
||||
// CHECK:STDERR: alias a = true or false;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+3]]:11: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias a = true or false;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
alias a = true or false;
|
||||
|
||||
@@ -53,7 +53,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "export";
|
||||
|
||||
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+3]]:8: error(NameNotFound): name `C` not found
|
||||
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+3]]:8: error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR: var c: C = {};
|
||||
// CHECK:STDERR: ^
|
||||
var c: C = {};
|
||||
|
||||
@@ -14,7 +14,7 @@ class D {}
|
||||
alias c = C;
|
||||
var d: D = {};
|
||||
|
||||
// CHECK:STDERR: fail_aliased_name_in_diag.carbon:[[@LINE+3]]:1: error(CoreNotFound): package `Core` implicitly referenced here, but not found
|
||||
// CHECK:STDERR: fail_aliased_name_in_diag.carbon:[[@LINE+3]]:1: error: package `Core` implicitly referenced here, but not found [CoreNotFound]
|
||||
// CHECK:STDERR: let c_var: c = d;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
let c_var: c = d;
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
namespace NS;
|
||||
|
||||
fn F() -> {} {
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+8]]:9: error(NameNotFound): name `NS` not found
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+8]]:9: error: name `NS` not found [NameNotFound]
|
||||
// CHECK:STDERR: alias NS.a = {};
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:16: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:16: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias NS.a = {};
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
alias NS.a = {};
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+3]]:10: error(NameNotFound): name `a` not found
|
||||
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+3]]:10: error: name `a` not found [NameNotFound]
|
||||
// CHECK:STDERR: return NS.a;
|
||||
// CHECK:STDERR: ^~~~
|
||||
return NS.a;
|
||||
|
||||
@@ -10,40 +10,40 @@
|
||||
|
||||
class Class {}
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:1: error(ModifierNotAllowedOnDeclaration): `abstract` not allowed on `alias` declaration
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:1: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+21]]:10: error(ModifierNotAllowedWith): `base` not allowed on declaration with `abstract`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+21]]:10: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:1: note(ModifierPrevious): `abstract` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:15: error(ModifierNotAllowedWith): `default` not allowed on declaration with `abstract`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:15: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: note(ModifierPrevious): `abstract` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:23: error(ModifierNotAllowedWith): `final` not allowed on declaration with `abstract`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:23: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note(ModifierPrevious): `abstract` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base default final alias A = Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract base default final alias A = Class;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error(ModifierNotAllowedOnDeclaration): `impl` not allowed on `alias` declaration
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: impl alias B = Class;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
impl alias B = Class;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: error(ModifierNotAllowedOnDeclaration): `extern` not allowed on `alias` declaration
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: extern alias C = Class;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
extern alias C = Class;
|
||||
|
||||
@@ -11,20 +11,20 @@
|
||||
class C {}
|
||||
|
||||
alias a = C;
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error(NameDeclDuplicate): duplicate name being declared in the same scope
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error: duplicate name being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: var a: C = {};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: note(NameDeclPrevious): name is previously declared here
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: alias a = C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
var a: C = {};
|
||||
|
||||
var b: C = {};
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+6]]:7: error(NameDeclDuplicate): duplicate name being declared in the same scope
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+6]]:7: error: duplicate name being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: alias b = C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: note(NameDeclPrevious): name is previously declared here
|
||||
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: var b: C = {};
|
||||
// CHECK:STDERR: ^
|
||||
alias b = C;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
fn F() {
|
||||
var a: () = ();
|
||||
var b: ()* = &a;
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:13: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:13: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias c = *b;
|
||||
// CHECK:STDERR: ^~
|
||||
alias c = *b;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_params.carbon
|
||||
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:8: error(UnexpectedDeclNameParams): `alias` declaration cannot have parameters
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:8: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams]
|
||||
// CHECK:STDERR: alias A(T:! type) = T*;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:21: error(AliasRequiresNameRef): alias initializer must be a name reference
|
||||
// CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:21: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias A(T:! type) = T*;
|
||||
// CHECK:STDERR: ^~
|
||||
alias A(T:! type) = T*;
|
||||
|
||||
+2
-2
@@ -58,8 +58,8 @@ var b: () = a_alias;
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_var3.carbon:[[@LINE+4]]:1(InImport): in import
|
||||
// CHECK:STDERR: var2.carbon:8:5: error(SemanticsTodo): semantics TODO: `Non-constant ImportRefLoaded (comes up with var)`
|
||||
// CHECK:STDERR: fail_var3.carbon:[[@LINE+4]]:1: in import [InImport]
|
||||
// CHECK:STDERR: var2.carbon:8:5: error: semantics TODO: `Non-constant ImportRefLoaded (comes up with var)` [SemanticsTodo]
|
||||
// CHECK:STDERR: var b: () = a_alias;
|
||||
// CHECK:STDERR: ^
|
||||
import library "var2";
|
||||
|
||||
@@ -35,7 +35,7 @@ package Test library "[[@TEST_NAME]]";
|
||||
|
||||
import library "def";
|
||||
|
||||
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:11: error(NameNotFound): name `A` not found
|
||||
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:11: error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR: var inst: A = {};
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -47,7 +47,7 @@ package Other library "[[@TEST_NAME]]";
|
||||
|
||||
import Test library "def";
|
||||
|
||||
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+3]]:11: error(NameNotFound): name `A` not found
|
||||
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+3]]:11: error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR: var inst: Test.A = {};
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
var inst: Test.A = {};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
fn Negate(n: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_bound_negative.carbon:[[@LINE+3]]:14: error(ArrayBoundNegative): array bound of -1 is negative
|
||||
// CHECK:STDERR: fail_bound_negative.carbon:[[@LINE+3]]:14: error: array bound of -1 is negative [ArrayBoundNegative]
|
||||
// CHECK:STDERR: var a: [i32; Negate(1)];
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
var a: [i32; Negate(1)];
|
||||
|
||||
@@ -11,20 +11,20 @@
|
||||
// TODO: Once we preserve the full value of integer literals in SemIR, check
|
||||
// that we reject the array bound being too large.
|
||||
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+4]]:14: error(IntLiteralTooLargeForI32): integer literal with value 39999999999999999993 does not fit in i32
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 39999999999999999993 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: var a: [i32; 39999999999999999993];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var a: [i32; 39999999999999999993];
|
||||
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+10]]:9: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+10]]:9: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var b: [1; 39999999999999999993];
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+7]]:9: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+7]]:9: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var b: [1; 39999999999999999993];
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+3]]:12: error(IntLiteralTooLargeForI32): integer literal with value 39999999999999999993 does not fit in i32
|
||||
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+3]]:12: error: integer literal with value 39999999999999999993 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: var b: [1; 39999999999999999993];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
var b: [1; 39999999999999999993];
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
class Incomplete;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+6]]:8: error(IncompleteTypeInVarDecl): variable has incomplete type `[Incomplete; 1]`
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+6]]:8: error: variable has incomplete type `[Incomplete; 1]` [IncompleteTypeInVarDecl]
|
||||
// CHECK:STDERR: var a: [Incomplete; 1];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
var a: [Incomplete; 1];
|
||||
|
||||
+2
-2
@@ -8,10 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_invalid_type.carbon
|
||||
|
||||
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+6]]:9: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+6]]:9: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var a: [1; 1];
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var a: [1; 1];
|
||||
// CHECK:STDERR: ^
|
||||
var a: [1; 1];
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_out_of_bound.carbon
|
||||
|
||||
// CHECK:STDERR: fail_out_of_bound.carbon:[[@LINE+3]]:19: error(ArrayInitFromLiteralArgCountMismatch): cannot initialize array of 1 element from 3 initializers
|
||||
// CHECK:STDERR: fail_out_of_bound.carbon:[[@LINE+3]]:19: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: var a: [i32; 1] = (1, 2, 3);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
var a: [i32; 1] = (1, 2, 3);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon
|
||||
|
||||
var a: [i32; 3] = (1, 2, 3);
|
||||
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+3]]:16: error(ArrayIndexOutOfBounds): array index `3` is past the end of type `[i32; 3]`
|
||||
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+3]]:16: error: array index `3` is past the end of type `[i32; 3]` [ArrayIndexOutOfBounds]
|
||||
// CHECK:STDERR: var b: i32 = a[{.index = 3}.index];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
var b: i32 = a[{.index = 3}.index];
|
||||
|
||||
@@ -8,33 +8,33 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_type_mismatch.carbon
|
||||
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: error(ImplicitAsConversionFailure): cannot implicitly convert from `String` to `i32`
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: error: cannot implicitly convert from `String` to `i32` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var a: [i32; 3] = (1, "Hello", "World");
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: note(MissingImplInMemberAccessNote): type `String` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: note: type `String` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var a: [i32; 3] = (1, "Hello", "World");
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var a: [i32; 3] = (1, "Hello", "World");
|
||||
|
||||
var t1: (i32, String, String);
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: error(ImplicitAsConversionFailure): cannot implicitly convert from `String` to `i32`
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: error: cannot implicitly convert from `String` to `i32` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var b: [i32; 3] = t1;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: note(MissingImplInMemberAccessNote): type `String` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: note: type `String` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var b: [i32; 3] = t1;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
var b: [i32; 3] = t1;
|
||||
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: error(ArrayInitFromLiteralArgCountMismatch): cannot initialize array of 3 elements from 2 initializers
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch]
|
||||
// CHECK:STDERR: var c: [i32; 3] = (1, 2);
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
var c: [i32; 3] = (1, 2);
|
||||
|
||||
var t2: (i32, i32);
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:19: error(ArrayInitFromExprArgCountMismatch): cannot initialize array of 3 elements from tuple with 2 elements
|
||||
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:19: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch]
|
||||
// CHECK:STDERR: var d: [i32; 3] = t2;
|
||||
// CHECK:STDERR: ^~
|
||||
var d: [i32; 3] = t2;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_undefined_bound.carbon
|
||||
|
||||
// CHECK:STDERR: fail_undefined_bound.carbon:[[@LINE+3]]:8: error(SemanticsTodo): semantics TODO: `HandleArrayExprWithoutBounds`
|
||||
// CHECK:STDERR: fail_undefined_bound.carbon:[[@LINE+3]]:8: error: semantics TODO: `HandleArrayExprWithoutBounds` [SemanticsTodo]
|
||||
// CHECK:STDERR: var a: [i32; ];
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
var a: [i32; ];
|
||||
|
||||
+3
-3
@@ -76,7 +76,7 @@ let b_value: B = ({.x = 1, .y = 2} as A) as B;
|
||||
// a copy to perform initialization. It's not clear whether that is the right
|
||||
// behavior.
|
||||
|
||||
// CHECK:STDERR: fail_init_class.carbon:[[@LINE+4]]:17: error(CopyOfUncopyableType): cannot copy value of type `B`
|
||||
// CHECK:STDERR: fail_init_class.carbon:[[@LINE+4]]:17: error: cannot copy value of type `B` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: var b_init: B = ({.x = 1, .y = 2} as A) as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -97,10 +97,10 @@ class B {
|
||||
// We do not try to implicitly convert from the first operand of `as` to the
|
||||
// adapted type of the second operand.
|
||||
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+6]]:12: error(ExplicitAsConversionFailure): cannot convert from `{.x: i32}` to `B` with `as`
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+6]]:12: error: cannot convert from `{.x: i32}` to `B` with `as` [ExplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var b: B = {.x = 1} as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12: note(MissingImplInMemberAccessNote): type `{.x: i32}` does not implement interface `As`
|
||||
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12: note: type `{.x: i32}` does not implement interface `As` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var b: B = {.x = 1} as B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
var b: B = {.x = 1} as B;
|
||||
|
||||
+2
-2
@@ -8,10 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_no_conversion.carbon
|
||||
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:21: error(ExplicitAsConversionFailure): cannot convert from `i32` to `(i32, i32)` with `as`
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:21: error: cannot convert from `i32` to `(i32, i32)` with `as` [ExplicitAsConversionFailure]
|
||||
// CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `As`
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: note: type `i32` does not implement interface `As` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
let n: (i32, i32) = 1 as (i32, i32);
|
||||
|
||||
+2
-2
@@ -8,10 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_not_type.carbon
|
||||
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+6]]:19: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+6]]:19: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: let n: i32 = 1 as 2;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: let n: i32 = 1 as 2;
|
||||
// CHECK:STDERR: ^
|
||||
let n: i32 = 1 as 2;
|
||||
|
||||
+2
-2
@@ -8,11 +8,11 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run.carbon
|
||||
|
||||
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+7]]:1: error(InvalidMainRunSignature): invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32`
|
||||
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+7]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
|
||||
// CHECK:STDERR: fn Run() -> String {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+3]]:21: error(MissingReturnStatement): missing `return` at end of function with declared return type
|
||||
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+3]]:21: error: missing `return` at end of function with declared return type [MissingReturnStatement]
|
||||
// CHECK:STDERR: fn Run() -> String {}
|
||||
// CHECK:STDERR: ^
|
||||
fn Run() -> String {}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon
|
||||
|
||||
// CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+3]]:1: error(InvalidMainRunSignature): invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32`
|
||||
// CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+3]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32` [InvalidMainRunSignature]
|
||||
// CHECK:STDERR: fn Run(n: i32) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
fn Run(n: i32) {}
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon
|
||||
|
||||
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+6]]:1: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var x: type = 42;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var x: type = 42;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
var x: type = 42;
|
||||
|
||||
@@ -8,31 +8,31 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon
|
||||
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error(IntLiteralTooLargeForI32): integer literal with value 39999999999999999993 does not fit in i32
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 39999999999999999993 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: let a: i32 = 39999999999999999993;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = 39999999999999999993;
|
||||
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error(IntLiteralTooLargeForI32): integer literal with value 2147483648 does not fit in i32
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 2147483648 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: let b: i32 = 2_147_483_648;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let b: i32 = 2_147_483_648;
|
||||
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error(IntLiteralTooLargeForI32): integer literal with value 2147483648 does not fit in i32
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 2147483648 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: let c: i32 = 0x8000_0000;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let c: i32 = 0x8000_0000;
|
||||
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error(RealMantissaTooLargeForI64): real mantissa with value 399999999999999999930 does not fit in i64
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: real mantissa with value 399999999999999999930 does not fit in i64 [RealMantissaTooLargeForI64]
|
||||
// CHECK:STDERR: let d: f64 = 39999999999999999993.0e3;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let d: f64 = 39999999999999999993.0e3;
|
||||
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+3]]:14: error(RealExponentTooLargeForI64): real exponent with value 39999999999999999992 does not fit in i64
|
||||
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+3]]:14: error: real exponent with value 39999999999999999992 does not fit in i64 [RealExponentTooLargeForI64]
|
||||
// CHECK:STDERR: let e: f64 = 5.0e39999999999999999993;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let e: f64 = 5.0e39999999999999999993;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon
|
||||
|
||||
var x: i32;
|
||||
// CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:14: error(QualifiedExprUnsupported): type `i32` does not support qualified expressions
|
||||
// CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:14: error: type `i32` does not support qualified expressions [QualifiedExprUnsupported]
|
||||
// CHECK:STDERR: var y: i32 = x.b;
|
||||
// CHECK:STDERR: ^~~
|
||||
var y: i32 = x.b;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon
|
||||
|
||||
fn Main() {
|
||||
// CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+3]]:3: error(NameNotFound): name `x` not found
|
||||
// CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+3]]:3: error: name `x` not found [NameNotFound]
|
||||
// CHECK:STDERR: x;
|
||||
// CHECK:STDERR: ^
|
||||
x;
|
||||
|
||||
+13
-13
@@ -18,28 +18,28 @@ var test_i64: i64;
|
||||
// --- fail_iN_bad_width.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error(NameNotFound): name `i0` not found
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: name `i0` not found [NameNotFound]
|
||||
// CHECK:STDERR: var test_i0: i0;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
var test_i0: i0;
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error(IntWidthNotMultipleOf8): bit width of integer type literal must be a multiple of 8; use `Core.Int(1)` instead
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(1)` instead [IntWidthNotMultipleOf8]
|
||||
// CHECK:STDERR: var test_i1: i1;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
var test_i1: i1;
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:15: error(IntWidthNotMultipleOf8): bit width of integer type literal must be a multiple of 8; use `Core.Int(15)` instead
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(15)` instead [IntWidthNotMultipleOf8]
|
||||
// CHECK:STDERR: var test_i15: i15;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
var test_i15: i15;
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:23: error(IntWidthTooLarge): integer type width of 1000000000 is greater than the maximum supported width of 8388608
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: var test_i1000000000: i1000000000;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var test_i1000000000: i1000000000;
|
||||
// TODO: This diagnostic is not very good.
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:33: error(IntLiteralTooLargeForI32): integer literal with value 10000000000000000000 does not fit in i32
|
||||
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:33: error: integer literal with value 10000000000000000000 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: var test_i10000000000000000000: i10000000000000000000;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -55,28 +55,28 @@ var test_u64: u64;
|
||||
// --- fail_uN_bad_width.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error(NameNotFound): name `u0` not found
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: name `u0` not found [NameNotFound]
|
||||
// CHECK:STDERR: var test_u0: u0;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
var test_u0: u0;
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error(IntWidthNotMultipleOf8): bit width of integer type literal must be a multiple of 8; use `Core.UInt(1)` instead
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(1)` instead [IntWidthNotMultipleOf8]
|
||||
// CHECK:STDERR: var test_u1: u1;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
var test_u1: u1;
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:15: error(IntWidthNotMultipleOf8): bit width of integer type literal must be a multiple of 8; use `Core.UInt(15)` instead
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(15)` instead [IntWidthNotMultipleOf8]
|
||||
// CHECK:STDERR: var test_u15: u15;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
var test_u15: u15;
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:23: error(IntWidthTooLarge): integer type width of 1000000000 is greater than the maximum supported width of 8388608
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: var test_u1000000000: u1000000000;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var test_u1000000000: u1000000000;
|
||||
// TODO: This diagnostic is not very good.
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:33: error(IntLiteralTooLargeForI32): integer literal with value 10000000000000000000 does not fit in i32
|
||||
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:33: error: integer literal with value 10000000000000000000 does not fit in i32 [IntLiteralTooLargeForI32]
|
||||
// CHECK:STDERR: var test_u10000000000000000000: u10000000000000000000;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -85,12 +85,12 @@ var test_u10000000000000000000: u10000000000000000000;
|
||||
// --- fail_fN_bad_width.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error(NameNotFound): name `f0` not found
|
||||
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error: name `f0` not found [NameNotFound]
|
||||
// CHECK:STDERR: var test_f0: f0;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
var test_f0: f0;
|
||||
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error(SemanticsTodo): semantics TODO: `Currently only f64 is allowed`
|
||||
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error: semantics TODO: `Currently only f64 is allowed` [SemanticsTodo]
|
||||
// CHECK:STDERR: var test_f1: f1;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
@@ -104,7 +104,7 @@ var test_f1000000000000: f1000000000000;
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// TODO: Some or all of these should eventually work.
|
||||
// CHECK:STDERR: fail_fN_todo_unsupported.carbon:[[@LINE+3]]:15: error(SemanticsTodo): semantics TODO: `Currently only f64 is allowed`
|
||||
// CHECK:STDERR: fail_fN_todo_unsupported.carbon:[[@LINE+3]]:15: error: semantics TODO: `Currently only f64 is allowed` [SemanticsTodo]
|
||||
// CHECK:STDERR: var test_f16: f16;
|
||||
// CHECK:STDERR: ^~~
|
||||
var test_f16: f16;
|
||||
|
||||
+3
-3
@@ -22,17 +22,17 @@ var x: f64 = Add(2.2, 2.3);
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.add"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.add"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.add"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
|
||||
|
||||
+3
-3
@@ -24,17 +24,17 @@ let c: f64 = Div(0.0, 0.0);
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.div"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.eq"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
|
||||
|
||||
@@ -32,14 +32,14 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+4]]:20: error(CompileTimeFloatBitWidth): bit width must be 64
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+4]]:20: error: bit width must be 64 [CompileTimeFloatBitWidth]
|
||||
// CHECK:STDERR: var invalid_float: Float(32);
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
var invalid_float: Float(32);
|
||||
|
||||
var dyn_size: i32 = 64;
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+3]]:10: error(TypeExprEvaluationFailure): cannot evaluate type expression
|
||||
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+3]]:10: error: cannot evaluate type expression [TypeExprEvaluationFailure]
|
||||
// CHECK:STDERR: var dyn: Float(dyn_size);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
var dyn: Float(dyn_size);
|
||||
|
||||
+3
-3
@@ -22,17 +22,17 @@ var x: f64 = Mul(2.0, 0.5);
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.mul"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
|
||||
|
||||
+9
-9
@@ -22,17 +22,17 @@ let a: f64 = Negate(1.5);
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.negate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> f64 = "float.negate";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.negate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.negate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -40,10 +40,10 @@ fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
fn JustRight(a: f64) -> f64 = "float.negate";
|
||||
|
||||
fn RuntimeCallTooFew(a: f64) -> f64 {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 1 argument passed to function expecting 0 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return TooFew(a);
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-17]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-17]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -51,10 +51,10 @@ fn RuntimeCallTooFew(a: f64) -> f64 {
|
||||
}
|
||||
|
||||
fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 3 arguments passed to function expecting 2 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return TooMany(a, b, c);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-23]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-23]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -62,10 +62,10 @@ fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 {
|
||||
}
|
||||
|
||||
fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error(CallArgCountMismatch): 2 arguments passed to function expecting 1 argument
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return BadReturnType(a, b);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-29]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-29]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
return BadReturnType(a, b);
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.neq"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
|
||||
|
||||
+3
-3
@@ -22,17 +22,17 @@ var x: f64 = Sub(2.0, 0.5);
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.sub"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.sub"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "float.sub"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.eq"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
|
||||
|
||||
+5
-5
@@ -30,12 +30,12 @@ fn Negate(a: i32) -> i32 = "int.snegate";
|
||||
|
||||
// Shift greater than size is disallowed.
|
||||
let size_1: i32 = LeftShift(1, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1 << 32
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 32 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let size_2: i32 = LeftShift(1, 32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let size_2: i32 = LeftShift(1, 32);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1 << 33
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 33 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let size_3: i32 = LeftShift(1, 33);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -43,7 +43,7 @@ let size_3: i32 = LeftShift(1, 33);
|
||||
|
||||
// Overflow is allowed if the shift distance is in bounds.
|
||||
let overflow_1: i32 = LeftShift(1000, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1000 << 32
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance not in range [0, 32) in 1000 << 32 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -51,14 +51,14 @@ let overflow_2: i32 = LeftShift(1000, 32);
|
||||
|
||||
// Oversize shifts aren't allowed even if there's no overflow.
|
||||
let no_overflow_1: i32 = LeftShift(0, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 0 << 32
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance not in range [0, 32) in 0 << 32 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let no_overflow_2: i32 = LeftShift(0, 32);
|
||||
|
||||
// Negative shifts aren't allowed either.
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1 << -1
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 << -1 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1));
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
let negative: i32 = LeftShift(1, Negate(1));
|
||||
|
||||
@@ -38,7 +38,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error(IntWidthNotPositive): integer type width of 0 is not positive
|
||||
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error: integer type width of 0 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: var n: Int(0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -52,7 +52,7 @@ import library "types";
|
||||
|
||||
fn Negate(n: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error(IntWidthNotPositive): integer type width of -1 is not positive
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: var n: Int(Negate(1));
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -64,7 +64,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: error(IntWidthTooLarge): integer type width of 1000000000 is greater than the maximum supported width of 8388608
|
||||
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: var m: Int(1000000000);
|
||||
// CHECK:STDERR: ^~~~
|
||||
var m: Int(1000000000);
|
||||
|
||||
@@ -38,7 +38,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error(IntWidthNotPositive): integer type width of 0 is not positive
|
||||
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error: integer type width of 0 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: var n: UInt(0);
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -52,7 +52,7 @@ import library "types";
|
||||
|
||||
fn Negate(n: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error(IntWidthNotPositive): integer type width of -1 is not positive
|
||||
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive [IntWidthNotPositive]
|
||||
// CHECK:STDERR: var n: UInt(Negate(1));
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -64,7 +64,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "types";
|
||||
|
||||
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: error(IntWidthTooLarge): integer type width of 1000000000 is greater than the maximum supported width of 8388608
|
||||
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge]
|
||||
// CHECK:STDERR: var m: UInt(1000000000);
|
||||
// CHECK:STDERR: ^~~~~
|
||||
var m: UInt(1000000000);
|
||||
|
||||
@@ -47,19 +47,19 @@ fn Negate(a: i32) -> i32 = "int.snegate";
|
||||
|
||||
// Shift greater than size is disallowed.
|
||||
let size_1: i32 = RightShift(1, 31);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1 >> 32
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 32 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let size_2: i32 = RightShift(1, 32);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let size_2: i32 = RightShift(1, 32);
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1 >> 33
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 33 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let size_3: i32 = RightShift(1, 33);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let size_3: i32 = RightShift(1, 33);
|
||||
|
||||
// Negative shifts aren't allowed either.
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error(CompileTimeShiftOutOfRange): shift distance not in range [0, 32) in 1 >> -1
|
||||
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 >> -1 [CompileTimeShiftOutOfRange]
|
||||
// CHECK:STDERR: let negative: i32 = RightShift(1, Negate(1));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
let negative: i32 = RightShift(1, Negate(1));
|
||||
|
||||
+9
-9
@@ -23,43 +23,43 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.sadd"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd";
|
||||
fn JustRight(a: i32, b: i32) -> i32 = "int.sadd";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_few: [i32; TooFew(1)];
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_few: [i32; TooFew(1)];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2, 3)];
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_many: [i32; TooMany(1, 2, 3)];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1, 2)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: [i32; BadReturnType(1, 2)];
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error(CallArgCountMismatch): 3 arguments passed to function expecting 2 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn JustRight(a: i32, b: i32) -> i32 = "int.sadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -84,7 +84,7 @@ package FailOverflow;
|
||||
fn Add(a: i32, b: i32) -> i32 = "int.sadd";
|
||||
|
||||
let a: i32 = Add(0x7FFFFFFF, 0);
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error(CompileTimeIntegerOverflow): integer overflow in calculation 2147483647 + 1
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 2147483647 + 1 [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let b: i32 = Add(0x7FFFFFFF, 1);
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ let a: i32 = Div(Negate(0x7FFF_FFFF), Negate(1));
|
||||
let b: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), 1);
|
||||
|
||||
// -0x8000_0000 / -1 overflows.
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error(CompileTimeIntegerOverflow): integer overflow in calculation -2147483648 / -1
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 / -1 [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -46,13 +46,13 @@ package FailDivByZero;
|
||||
|
||||
fn Div(a: i32, b: i32) -> i32 = "int.sdiv";
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let a: i32 = Div(1, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Div(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let b: i32 = Div(0, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let b: i32 = Div(0, 0);
|
||||
|
||||
+3
-3
@@ -35,7 +35,7 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1);
|
||||
|
||||
// -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though
|
||||
// its result is representable.
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error(CompileTimeIntegerOverflow): integer overflow in calculation -2147483648 % -1
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 % -1 [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -49,13 +49,13 @@ fn Mod(a: i32, b: i32) -> i32 = "int.smod";
|
||||
|
||||
// Remainder of division by zero is not defined.
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let a: i32 = Mod(1, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Mod(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let b: i32 = Mod(0, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let b: i32 = Mod(0, 0);
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ package FailOverflow;
|
||||
fn Mul(a: i32, b: i32) -> i32 = "int.smul";
|
||||
|
||||
let a: i32 = Mul(0x7FFF, 0x10000);
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error(CompileTimeIntegerOverflow): integer overflow in calculation 32768 * 65536
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 32768 * 65536 [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let b: i32 = Mul(0x8000, 0x10000);
|
||||
|
||||
+15
-15
@@ -25,53 +25,53 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.snegate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew() -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.snegate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.snegate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32) -> bool = "int.snegate";
|
||||
fn JustRight(a: i32) -> i32 = "int.snegate";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_few: [i32; TooFew()];
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_few: [i32; TooFew()];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2)];
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_many: [i32; TooMany(1, 2)];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: [i32; BadReturnType(1)];
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error(CallArgCountMismatch): 2 arguments passed to function expecting 1 argument
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn JustRight(a: i32) -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var bad_call: [i32; JustRight(1, 2)];
|
||||
|
||||
fn RuntimeCallTooFew(a: i32) -> i32 {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 1 argument passed to function expecting 0 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return TooFew(a);
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn TooFew() -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -79,10 +79,10 @@ fn RuntimeCallTooFew(a: i32) -> i32 {
|
||||
}
|
||||
|
||||
fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 3 arguments passed to function expecting 2 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return TooMany(a, b, c);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -90,10 +90,10 @@ fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
|
||||
}
|
||||
|
||||
fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 2 arguments passed to function expecting 1 argument
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return BadReturnType(a, b);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -111,7 +111,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
|
||||
let a: i32 = Negate(Negate(0x7FFFFFFF));
|
||||
|
||||
// -(-INT_MAX - 1) is too large for i32.
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error(CompileTimeIntegerNegateOverflow): integer overflow in negation of -2147483648
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow]
|
||||
// CHECK:STDERR: let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
|
||||
|
||||
let a: i32 = Sub(0, 0x7FFFFFFF);
|
||||
let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1);
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error(CompileTimeIntegerOverflow): integer overflow in calculation -2147483647 - 2
|
||||
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation -2147483647 - 2 [CompileTimeIntegerOverflow]
|
||||
// CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
|
||||
|
||||
+8
-8
@@ -23,43 +23,43 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.uadd"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew(a: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.uadd"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.uadd"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd";
|
||||
fn JustRight(a: i32, b: i32) -> i32 = "int.uadd";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_few: [i32; TooFew(1)];
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_few: [i32; TooFew(1)];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2, 3)];
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_many: [i32; TooMany(1, 2, 3)];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1, 2)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: [i32; BadReturnType(1, 2)];
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:21: error(CallArgCountMismatch): 3 arguments passed to function expecting 2 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:21: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn JustRight(a: i32, b: i32) -> i32 = "int.uadd";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var bad_call: [i32; JustRight(1, 2, 3)];
|
||||
|
||||
+2
-2
@@ -42,13 +42,13 @@ package FailDivByZero;
|
||||
|
||||
fn Div(a: i32, b: i32) -> i32 = "int.udiv";
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let a: i32 = Div(1, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Div(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let b: i32 = Div(0, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let b: i32 = Div(0, 0);
|
||||
|
||||
+2
-2
@@ -44,13 +44,13 @@ fn Mod(a: i32, b: i32) -> i32 = "int.umod";
|
||||
|
||||
// Remainder of division by zero is not defined.
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let a: i32 = Mod(1, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
let a: i32 = Mod(1, 0);
|
||||
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error(CompileTimeDivisionByZero): division by zero
|
||||
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero [CompileTimeDivisionByZero]
|
||||
// CHECK:STDERR: let b: i32 = Mod(0, 0);
|
||||
// CHECK:STDERR: ^~~~
|
||||
let b: i32 = Mod(0, 0);
|
||||
|
||||
+14
-14
@@ -25,53 +25,53 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
|
||||
|
||||
package FailBadDecl;
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.unegate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooFew() -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooFew() -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.unegate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn TooMany(a: i32, b: i32) -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error(InvalidBuiltinSignature): invalid signature for builtin function "int.unegate"
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature]
|
||||
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn BadReturnType(a: i32) -> bool = "int.unegate";
|
||||
fn JustRight(a: i32) -> i32 = "int.unegate";
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_few: [i32; TooFew()];
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_few: [i32; TooFew()];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2)];
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var too_many: [i32; TooMany(1, 2)];
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error(InvalidArrayExpr): array bound is not a constant
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var bad_return_type: [i32; BadReturnType(1)];
|
||||
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error(CallArgCountMismatch): 2 arguments passed to function expecting 1 argument
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2)];
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn JustRight(a: i32) -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var bad_call: [i32; JustRight(1, 2)];
|
||||
|
||||
fn RuntimeCallTooFew(a: i32) -> i32 {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 1 argument passed to function expecting 0 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return TooFew(a);
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn TooFew() -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -79,10 +79,10 @@ fn RuntimeCallTooFew(a: i32) -> i32 {
|
||||
}
|
||||
|
||||
fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error(CallArgCountMismatch): 3 arguments passed to function expecting 2 arguments
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return TooMany(a, b, c);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -90,10 +90,10 @@ fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
|
||||
}
|
||||
|
||||
fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool {
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error(CallArgCountMismatch): 2 arguments passed to function expecting 1 argument
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch]
|
||||
// CHECK:STDERR: return BadReturnType(a, b);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.unegate";
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
return BadReturnType(a, b);
|
||||
|
||||
+14
-14
@@ -27,35 +27,35 @@ class Circle {
|
||||
|
||||
fn Run() {
|
||||
let circle: Circle = Circle.Make();
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:21: error(ClassInvalidMemberAccess): cannot access private member `radius` of type `Circle`
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:21: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: let radius: i32 = circle.radius;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-17]]:15: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-17]]:15: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: private var radius: i32;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let radius: i32 = circle.radius;
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error(ClassInvalidMemberAccess): cannot access private member `radius` of type `Circle`
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: circle.radius = 5;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: private var radius: i32;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
circle.radius = 5;
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error(ClassInvalidMemberAccess): cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle`
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: circle.SOME_INTERNAL_CONSTANT;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-32]]:15: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-32]]:15: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: private let SOME_INTERNAL_CONSTANT: i32 = 5;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
circle.SOME_INTERNAL_CONSTANT;
|
||||
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error(ClassInvalidMemberAccess): cannot access private member `SomeInternalFunction` of type `Circle`
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `SomeInternalFunction` of type `Circle` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: circle.SomeInternalFunction();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-39]]:3: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-39]]:3: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: private fn SomeInternalFunction() -> i32 {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -71,10 +71,10 @@ class A {
|
||||
}
|
||||
|
||||
fn Run() {
|
||||
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+7]]:16: error(ClassInvalidMemberAccess): cannot access protected member `x` of type `A`
|
||||
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+7]]:16: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: let x: i32 = A.x;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-7]]:17: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-7]]:17: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: protected var x: i32;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -120,18 +120,18 @@ class A {
|
||||
private let y: i32 = 5;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+7]]:14: error(ClassInvalidMemberAccess): cannot access protected member `x` of type `A`
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+7]]:14: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: let x: i32 = A.x;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-7]]:17: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-7]]:17: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: protected let x: i32 = 5;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
let x: i32 = A.x;
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+6]]:14: error(ClassInvalidMemberAccess): cannot access private member `y` of type `A`
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+6]]:14: error: cannot access private member `y` of type `A` [ClassInvalidMemberAccess]
|
||||
// CHECK:STDERR: let y: i32 = A.y;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-14]]:15: note(ClassMemberDeclaration): declared here
|
||||
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-14]]:15: note: declared here [ClassMemberDeclaration]
|
||||
// CHECK:STDERR: private let y: i32 = 5;
|
||||
// CHECK:STDERR: ^
|
||||
let y: i32 = A.y;
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class AdaptNotExtend {
|
||||
|
||||
fn F(a: AdaptNotExtend) {
|
||||
// `Adapted` is not extended, so lookup for `F` finds nothing.
|
||||
// CHECK:STDERR: fail_not_extend.carbon:[[@LINE+3]]:3: error(NameNotFound): name `F` not found
|
||||
// CHECK:STDERR: fail_not_extend.carbon:[[@LINE+3]]:3: error: name `F` not found [NameNotFound]
|
||||
// CHECK:STDERR: a.F();
|
||||
// CHECK:STDERR: ^~~
|
||||
a.F();
|
||||
|
||||
+13
-13
@@ -48,11 +48,11 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Other library "other_extern";
|
||||
|
||||
// CHECK:STDERR: fail_extern.carbon:[[@LINE+8]]:8: error(IncompleteTypeInVarDecl): variable has incomplete type `C`
|
||||
// CHECK:STDERR: fail_extern.carbon:[[@LINE+8]]:8: error: variable has incomplete type `C` [IncompleteTypeInVarDecl]
|
||||
// CHECK:STDERR: var c: Other.C = {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1(InImport): in import
|
||||
// CHECK:STDERR: other_extern.carbon:4:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other_extern.carbon:4:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: extern class C;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -62,18 +62,18 @@ var c: Other.C = {};
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+8]]:1(InImport): in import
|
||||
// CHECK:STDERR: other_extern.carbon:4:1: error(NameDeclDuplicate): duplicate name being declared in the same scope
|
||||
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+8]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: extern class C;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1(InImport): in import
|
||||
// CHECK:STDERR: other_define.carbon:4:1: note(NameDeclPrevious): name is previously declared here
|
||||
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: class C {}
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
import Other library "other_define";
|
||||
import Other library "other_extern";
|
||||
|
||||
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:8: note(InNameLookup): in name lookup for `C`
|
||||
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:8: note: in name lookup for `C` [InNameLookup]
|
||||
// CHECK:STDERR: var c: Other.C = {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -83,18 +83,18 @@ var c: Other.C = {};
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:1(InImport): in import
|
||||
// CHECK:STDERR: other_conflict.carbon:4:1: error(NameDeclDuplicate): duplicate name being declared in the same scope
|
||||
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
|
||||
// CHECK:STDERR: fn C() {}
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1(InImport): in import
|
||||
// CHECK:STDERR: other_define.carbon:4:1: note(NameDeclPrevious): name is previously declared here
|
||||
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
|
||||
// CHECK:STDERR: class C {}
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
import Other library "other_define";
|
||||
import Other library "other_conflict";
|
||||
|
||||
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:8: note(InNameLookup): in name lookup for `C`
|
||||
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:8: note: in name lookup for `C` [InNameLookup]
|
||||
// CHECK:STDERR: var c: Other.C = {};
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
var c: Other.C = {};
|
||||
|
||||
+6
-6
@@ -48,13 +48,13 @@ class SomeClassAdapter {
|
||||
}
|
||||
|
||||
fn F(a: SomeClassAdapter) {
|
||||
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+10]]:3: error(ImplicitAsConversionFailure): cannot implicitly convert from `SomeClassAdapter` to `SomeClass`
|
||||
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `SomeClassAdapter` to `SomeClass` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: a.F();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+7]]:3: note(MissingImplInMemberAccessNote): type `SomeClassAdapter` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+7]]:3: note: type `SomeClassAdapter` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: a.F();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-14]]:8: note(InCallToFunctionSelf): initializing `self` parameter of method declared here
|
||||
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-14]]:8: note: initializing `self` parameter of method declared here [InCallToFunctionSelf]
|
||||
// CHECK:STDERR: fn F[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -75,10 +75,10 @@ class SomeClassAdapter {
|
||||
}
|
||||
|
||||
fn F(a: SomeClassAdapter) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+7]]:10: error(ImplicitAsConversionFailure): cannot implicitly convert from `SomeClassAdapter` to `SomeClass`
|
||||
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `SomeClassAdapter` to `SomeClass` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: return a.b;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+4]]:10: note(MissingImplInMemberAccessNote): type `SomeClassAdapter` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+4]]:10: note: type `SomeClassAdapter` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: return a.b;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
@@ -90,7 +90,7 @@ fn F(a: SomeClassAdapter) -> i32 {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class StructAdapter {
|
||||
// CHECK:STDERR: fail_todo_adapt_non_class.carbon:[[@LINE+3]]:3: error(SemanticsTodo): semantics TODO: `extending non-class type`
|
||||
// CHECK:STDERR: fail_todo_adapt_non_class.carbon:[[@LINE+3]]:3: error: semantics TODO: `extending non-class type` [SemanticsTodo]
|
||||
// CHECK:STDERR: extend adapt {.a: i32, .b: i32};
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
extend adapt {.a: i32, .b: i32};
|
||||
|
||||
+13
-13
@@ -16,10 +16,10 @@ abstract class Abstract {
|
||||
}
|
||||
|
||||
class Contains {
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+7]]:10: error(AbstractTypeInVarDecl): field has abstract type `Abstract`
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+7]]:10: error: field has abstract type `Abstract` [AbstractTypeInVarDecl]
|
||||
// CHECK:STDERR: var a: Abstract;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-7]]:1: note(ClassAbstractHere): class was declared abstract here
|
||||
// CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -34,10 +34,10 @@ abstract class Abstract {
|
||||
}
|
||||
|
||||
fn Var() {
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+7]]:10: error(AbstractTypeInVarDecl): variable has abstract type `Abstract`
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+7]]:10: error: variable has abstract type `Abstract` [AbstractTypeInVarDecl]
|
||||
// CHECK:STDERR: var v: Abstract;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-7]]:1: note(ClassAbstractHere): class was declared abstract here
|
||||
// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -64,10 +64,10 @@ abstract class Abstract {
|
||||
|
||||
class Adapter {
|
||||
// TODO(#4387): This should probably be valid
|
||||
// CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+7]]:3: error(AbstractTypeInAdaptDecl): adapted type `Abstract` is an abstract type
|
||||
// CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+7]]:3: error: adapted type `Abstract` is an abstract type [AbstractTypeInAdaptDecl]
|
||||
// CHECK:STDERR: adapt Abstract;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-8]]:1: note(ClassAbstractHere): class was declared abstract here
|
||||
// CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-8]]:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -102,10 +102,10 @@ class Derived {
|
||||
|
||||
fn Make() -> Derived {
|
||||
// TODO: This should be valid, and should construct an instance of `partial Abstract` as the base.
|
||||
// CHECK:STDERR: fail_todo_return_nonabstract_derived.carbon:[[@LINE+7]]:10: error(AbstractTypeInInit): initialization of abstract type `Abstract`
|
||||
// CHECK:STDERR: fail_todo_return_nonabstract_derived.carbon:[[@LINE+7]]:10: error: initialization of abstract type `Abstract` [AbstractTypeInInit]
|
||||
// CHECK:STDERR: return {.base = {.a = 1}, .d = 7};
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_return_nonabstract_derived.carbon:[[@LINE-14]]:1: note(ClassAbstractHere): class was declared abstract here
|
||||
// CHECK:STDERR: fail_todo_return_nonabstract_derived.carbon:[[@LINE-14]]:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -127,10 +127,10 @@ class Derived {
|
||||
|
||||
fn Return(a: Abstract) -> Abstract {
|
||||
// FIXME: Seems like this would be better off failing with "function returns abstract type" here instead of this \/
|
||||
// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+7]]:3: error(AbstractTypeInInit): initialization of abstract type `Abstract`
|
||||
// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+7]]:3: error: initialization of abstract type `Abstract` [AbstractTypeInInit]
|
||||
// CHECK:STDERR: return a;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-14]]:1: note(ClassAbstractHere): class was declared abstract here
|
||||
// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-14]]:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -176,13 +176,13 @@ abstract class Abstract {
|
||||
fn ReturnAbstract() -> Abstract;
|
||||
|
||||
fn CallReturnAbstract() {
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+9]]:3: error(AbstractTypeInFunctionReturnType): function returns abstract type `Abstract`
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+9]]:3: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: ReturnAbstract();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:1: note(ClassAbstractHere): class was declared abstract here
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:1: note: class was declared abstract here [ClassAbstractHere]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:21: note(IncompleteReturnTypeHere): return type declared here
|
||||
// CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:21: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fn ReturnAbstract() -> Abstract;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
ReturnAbstract();
|
||||
|
||||
+12
-12
@@ -13,17 +13,17 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class Bad {
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: adapt 100;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: adapt 100;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
adapt 100;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:18: error(NameNotFound): name `F` not found
|
||||
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:18: error: name `F` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Use(b: Bad) { b.F(); }
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
@@ -34,10 +34,10 @@ fn Use(b: Bad) { b.F(); }
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class Bad {
|
||||
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: extend adapt 100;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: extend adapt 100;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -53,10 +53,10 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class MultipleAdapts {
|
||||
adapt ();
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error(AdaptDeclRepeated): multiple `adapt` declarations in class
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error: multiple `adapt` declarations in class [AdaptDeclRepeated]
|
||||
// CHECK:STDERR: adapt {};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: note(ClassSpecificDeclPrevious): previous `adapt` declaration is here
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious]
|
||||
// CHECK:STDERR: adapt ();
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -65,10 +65,10 @@ class MultipleAdapts {
|
||||
|
||||
class MultipleAdaptsSameType {
|
||||
adapt ();
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error(AdaptDeclRepeated): multiple `adapt` declarations in class
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error: multiple `adapt` declarations in class [AdaptDeclRepeated]
|
||||
// CHECK:STDERR: adapt ();
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: note(ClassSpecificDeclPrevious): previous `adapt` declaration is here
|
||||
// CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious]
|
||||
// CHECK:STDERR: adapt ();
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -79,14 +79,14 @@ class MultipleAdaptsSameType {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:1: error(ClassSpecificDeclOutsideClass): `adapt` declaration outside class
|
||||
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:1: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: adapt {};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
adapt {};
|
||||
|
||||
interface I {
|
||||
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:3: error(ClassSpecificDeclOutsideClass): `adapt` declaration outside class
|
||||
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:3: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: adapt {};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -95,7 +95,7 @@ interface I {
|
||||
|
||||
class C {
|
||||
interface I {
|
||||
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+3]]:5: error(ClassSpecificDeclOutsideClass): `adapt` declaration outside class
|
||||
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+3]]:5: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: adapt {};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
adapt {};
|
||||
|
||||
@@ -15,10 +15,10 @@ library "[[@TEST_NAME]]";
|
||||
class Incomplete;
|
||||
|
||||
class AdaptIncomplete {
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+6]]:3: error(IncompleteTypeInAdaptDecl): adapted type `Incomplete` is an incomplete type
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+6]]:3: error: adapted type `Incomplete` is an incomplete type [IncompleteTypeInAdaptDecl]
|
||||
// CHECK:STDERR: adapt Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-6]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-6]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
adapt Incomplete;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class B {}
|
||||
|
||||
class C1 {
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error(ModifierNotAllowedOnDeclaration): `private` not allowed on `adapt` declaration
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: private adapt B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -19,7 +19,7 @@ class C1 {
|
||||
}
|
||||
|
||||
class C2 {
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error(ModifierNotAllowedOnDeclaration): `abstract` not allowed on `adapt` declaration
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `abstract` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: abstract adapt B;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -27,7 +27,7 @@ class C2 {
|
||||
}
|
||||
|
||||
class C3 {
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error(ModifierNotAllowedOnDeclaration): `default` not allowed on `adapt` declaration
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: default adapt B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -35,10 +35,10 @@ class C3 {
|
||||
}
|
||||
|
||||
class C4 {
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+7]]:10: error(ModifierRepeated): `extend` repeated on declaration
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+7]]:10: error: `extend` repeated on declaration [ModifierRepeated]
|
||||
// CHECK:STDERR: extend extend adapt B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: note(ModifierPrevious): `extend` previously appeared here
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: note: `extend` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: extend extend adapt B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -46,10 +46,10 @@ class C4 {
|
||||
}
|
||||
|
||||
class C5 {
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+6]]:10: error(ModifierNotAllowedWith): `base` not allowed on declaration with `extend`
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+6]]:10: error: `base` not allowed on declaration with `extend` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: extend base adapt B;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+3]]:3: note(ModifierPrevious): `extend` previously appeared here
|
||||
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+3]]:3: note: `extend` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: extend base adapt B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
extend base adapt B;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
class Simple {};
|
||||
base class AdaptWithVirtual {
|
||||
virtual fn F();
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+6]]:3: error(AdaptWithVirtual): adapter with virtual function
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+6]]:3: error: adapter with virtual function [AdaptWithVirtual]
|
||||
// CHECK:STDERR: adapt Simple;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE-4]]:3: note(AdaptWithVirtualHere): first virtual function declaration is here
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE-4]]:3: note: first virtual function declaration is here [AdaptWithVirtualHere]
|
||||
// CHECK:STDERR: virtual fn F();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
adapt Simple;
|
||||
|
||||
@@ -15,11 +15,11 @@ library "[[@TEST_NAME]]";
|
||||
base class Base {}
|
||||
|
||||
class AdaptWithBase {
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3: error(AdaptWithBase): adapter with base class
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3: error: adapter with base class [AdaptWithBase]
|
||||
// CHECK:STDERR: adapt i32;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
adapt i32;
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+4]]:3: note(AdaptWithBaseHere): `base` declaration is here
|
||||
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+4]]:3: note: `base` declaration is here [AdaptWithBaseHere]
|
||||
// CHECK:STDERR: extend base: Base;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -31,11 +31,11 @@ class AdaptWithBase {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class AdaptWithField {
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error(AdaptWithFields): adapter with fields
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error: adapter with fields [AdaptWithFields]
|
||||
// CHECK:STDERR: adapt i32;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
adapt i32;
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+4]]:7: note(AdaptWithFieldHere): first field declaration is here
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+4]]:7: note: first field declaration is here [AdaptWithFieldHere]
|
||||
// CHECK:STDERR: var n: i32;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -43,11 +43,11 @@ class AdaptWithField {
|
||||
}
|
||||
|
||||
class AdaptWithFields {
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error(AdaptWithFields): adapter with fields
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error: adapter with fields [AdaptWithFields]
|
||||
// CHECK:STDERR: adapt i32;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
adapt i32;
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+4]]:7: note(AdaptWithFieldHere): first field declaration is here
|
||||
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+4]]:7: note: first field declaration is here [AdaptWithFieldHere]
|
||||
// CHECK:STDERR: var a: i32;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -65,10 +65,10 @@ base class Base {}
|
||||
class AdaptWithBaseAndFields {
|
||||
extend base: Base;
|
||||
var n: i32;
|
||||
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+6]]:3: error(AdaptWithBase): adapter with base class
|
||||
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+6]]:3: error: adapter with base class [AdaptWithBase]
|
||||
// CHECK:STDERR: adapt {};
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE-5]]:3: note(AdaptWithBaseHere): `base` declaration is here
|
||||
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE-5]]:3: note: `base` declaration is here [AdaptWithBaseHere]
|
||||
// CHECK:STDERR: extend base: Base;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
adapt {};
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_addr_not_self.carbon
|
||||
|
||||
class Class {
|
||||
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: error(AddrOnNonSelfParam): `addr` can only be applied to a `self` parameter
|
||||
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: error: `addr` can only be applied to a `self` parameter [AddrOnNonSelfParam]
|
||||
// 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(AddrOnNonSelfParam): `addr` can only be applied to a `self` parameter
|
||||
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: error: `addr` can only be applied to a `self` parameter [AddrOnNonSelfParam]
|
||||
// CHECK:STDERR: fn G(addr b: Class*);
|
||||
// CHECK:STDERR: ^~~~
|
||||
fn G(addr b: Class*);
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
|
||||
class Class {
|
||||
fn F[addr self: Class*]();
|
||||
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+4]]:8: error(AddrOnNonPointerType): `addr` can only be applied to a binding with a pointer type
|
||||
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+4]]:8: error: `addr` can only be applied to a binding with a pointer type [AddrOnNonPointerType]
|
||||
// CHECK:STDERR: fn G[addr self: Class]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -18,10 +18,10 @@ class Class {
|
||||
}
|
||||
|
||||
fn F(c: Class, p: Class*) {
|
||||
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+6]]:3: error(AddrSelfIsNonRef): `addr self` method cannot be invoked on a value
|
||||
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+6]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
|
||||
// CHECK:STDERR: c.F();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-12]]:8: note(InCallToFunctionSelf): initializing `addr self` parameter of method declared here
|
||||
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-12]]:8: note: initializing `addr self` parameter of method declared here [InCallToFunctionSelf]
|
||||
// CHECK:STDERR: fn F[addr self: Class*]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
c.F();
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
namespace N;
|
||||
|
||||
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+7]]:6: error(ExpectedDeclNameAfterPeriod): `.` should be followed by a name
|
||||
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+7]]:6: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod]
|
||||
// CHECK:STDERR: fn N.base() {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+3]]:6: error(SemanticsTodo): semantics TODO: `HandleInvalidParse`
|
||||
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+3]]:6: error: semantics TODO: `HandleInvalidParse` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn N.base() {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
fn N.base() {}
|
||||
|
||||
+25
-25
@@ -11,11 +11,11 @@
|
||||
// --- fail_derive_from_error.carbon
|
||||
|
||||
class DeriveFromError {
|
||||
// CHECK:STDERR: fail_derive_from_error.carbon:[[@LINE+6]]:16: error(NameNotFound): name `error` not found
|
||||
// CHECK:STDERR: fail_derive_from_error.carbon:[[@LINE+6]]:16: error: name `error` not found [NameNotFound]
|
||||
// CHECK:STDERR: extend base: error;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_derive_from_non_type.carbon: error(DuplicateMainApi): `Main//default` previously provided by `fail_derive_from_error.carbon`
|
||||
// CHECK:STDERR: fail_derive_from_non_type.carbon: error: `Main//default` previously provided by `fail_derive_from_error.carbon` [DuplicateMainApi]
|
||||
// CHECK:STDERR:
|
||||
extend base: error;
|
||||
}
|
||||
@@ -26,14 +26,14 @@ fn AccessMemberWithInvalidBaseError(p: DeriveFromError*) -> i32 { return (*p).n;
|
||||
// --- fail_derive_from_non_type.carbon
|
||||
|
||||
class DeriveFromNonType {
|
||||
// CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+9]]:16: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+9]]:16: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: extend base: 32;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+6]]:16: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+6]]:16: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: extend base: 32;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon: error(DuplicateMainApi): `Main//default` previously provided by `fail_derive_from_error.carbon`
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon: error: `Main//default` previously provided by `fail_derive_from_error.carbon` [DuplicateMainApi]
|
||||
// CHECK:STDERR:
|
||||
extend base: 32;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ fn AccessMemberWithInvalidBasNonType(p: DeriveFromNonType*) -> i32 { return (*p)
|
||||
// --- fail_derive_from_i32.carbon
|
||||
|
||||
class DeriveFromi32 {
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+4]]:16: error(BaseIsFinal): deriving from final type `i32`; base type must be an `abstract` or `base` class
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+4]]:16: error: deriving from final type `i32`; base type must be an `abstract` or `base` class [BaseIsFinal]
|
||||
// CHECK:STDERR: extend base: i32;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
@@ -52,14 +52,14 @@ class DeriveFromi32 {
|
||||
|
||||
// It's not really important whether this conversion produces an error or not,
|
||||
// but it shouldn't crash.
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+9]]:53: error(ImplicitAsConversionFailure): cannot implicitly convert from `DeriveFromi32*` to `i32*`
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+9]]:53: error: cannot implicitly convert from `DeriveFromi32*` to `i32*` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+6]]:53: note(MissingImplInMemberAccessNote): type `DeriveFromi32*` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+6]]:53: note: type `DeriveFromi32*` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon: error(DuplicateMainApi): `Main//default` previously provided by `fail_derive_from_error.carbon`
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon: error: `Main//default` previously provided by `fail_derive_from_error.carbon` [DuplicateMainApi]
|
||||
// CHECK:STDERR:
|
||||
fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; }
|
||||
|
||||
@@ -70,21 +70,21 @@ fn AccessMemberWithInvalidBasei32(p: DeriveFromi32*) -> i32 { return (*p).n; }
|
||||
base class Base {}
|
||||
|
||||
class DeriveFromTuple {
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+4]]:16: error(BaseIsFinal): deriving from final type `(Base,)`; base type must be an `abstract` or `base` class
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+4]]:16: error: deriving from final type `(Base,)`; base type must be an `abstract` or `base` class [BaseIsFinal]
|
||||
// CHECK:STDERR: extend base: (Base,);
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
extend base: (Base,);
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+9]]:61: error(ImplicitAsConversionFailure): cannot implicitly convert from `DeriveFromTuple*` to `(Base,)*`
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+9]]:61: error: cannot implicitly convert from `DeriveFromTuple*` to `(Base,)*` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+6]]:61: note(MissingImplInMemberAccessNote): type `DeriveFromTuple*` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+6]]:61: note: type `DeriveFromTuple*` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon: error(DuplicateMainApi): `Main//default` previously provided by `fail_derive_from_error.carbon`
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon: error: `Main//default` previously provided by `fail_derive_from_error.carbon` [DuplicateMainApi]
|
||||
// CHECK:STDERR:
|
||||
fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; }
|
||||
|
||||
@@ -95,21 +95,21 @@ fn AccessMemberWithInvalidBaseTuple(p: DeriveFromTuple*) -> i32 { return (*p).n;
|
||||
// TODO: Should we allow this?
|
||||
// We do allow `{.base = {.a: i32, .b: i32}}`.
|
||||
class DeriveFromStruct {
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+4]]:16: error(BaseIsFinal): deriving from final type `{.a: i32, .b: i32}`; base type must be an `abstract` or `base` class
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+4]]:16: error: deriving from final type `{.a: i32, .b: i32}`; base type must be an `abstract` or `base` class [BaseIsFinal]
|
||||
// CHECK:STDERR: extend base: {.a: i32, .b: i32};
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
extend base: {.a: i32, .b: i32};
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+9]]:74: error(ImplicitAsConversionFailure): cannot implicitly convert from `DeriveFromStruct*` to `{.a: i32, .b: i32}*`
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+9]]:74: error: cannot implicitly convert from `DeriveFromStruct*` to `{.a: i32, .b: i32}*` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+6]]:74: note(MissingImplInMemberAccessNote): type `DeriveFromStruct*` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+6]]:74: note: type `DeriveFromStruct*` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon: error(DuplicateMainApi): `Main//default` previously provided by `fail_derive_from_error.carbon`
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon: error: `Main//default` previously provided by `fail_derive_from_error.carbon` [DuplicateMainApi]
|
||||
// CHECK:STDERR:
|
||||
fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; }
|
||||
|
||||
@@ -118,31 +118,31 @@ fn AccessMemberWithInvalidBaseStruct(p: DeriveFromStruct*) -> i32 { return (*p).
|
||||
|
||||
// --- fail_derive_from_incomplete.carbon
|
||||
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+4]]:1: error(ModifierOnlyAllowedOnDefinition): `base` not allowed on `class` forward declaration, only definition
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+4]]:1: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition]
|
||||
// CHECK:STDERR: base class Incomplete;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
base class Incomplete;
|
||||
|
||||
class DeriveFromIncomplete {
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+7]]:16: error(IncompleteTypeInBaseDecl): base `Incomplete` is an incomplete type
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+7]]:16: error: base `Incomplete` is an incomplete type [IncompleteTypeInBaseDecl]
|
||||
// CHECK:STDERR: extend base: Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE-6]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE-6]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: base class Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
extend base: Incomplete;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+9]]:74: error(ImplicitAsConversionFailure): cannot implicitly convert from `DeriveFromIncomplete*` to `Incomplete*`
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+9]]:74: error: cannot implicitly convert from `DeriveFromIncomplete*` to `Incomplete*` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+6]]:74: note(MissingImplInMemberAccessNote): type `DeriveFromIncomplete*` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+6]]:74: note: type `DeriveFromIncomplete*` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon: error(DuplicateMainApi): `Main//default` previously provided by `fail_derive_from_error.carbon`
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon: error: `Main//default` previously provided by `fail_derive_from_error.carbon` [DuplicateMainApi]
|
||||
// CHECK:STDERR:
|
||||
fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; }
|
||||
|
||||
@@ -155,7 +155,7 @@ class Final {
|
||||
}
|
||||
|
||||
class DeriveFromFinal {
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error(BaseIsFinal): deriving from final type `Final`; base type must be an `abstract` or `base` class
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error: deriving from final type `Final`; base type must be an `abstract` or `base` class [BaseIsFinal]
|
||||
// CHECK:STDERR: extend base: Final;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -172,7 +172,7 @@ fn AccessMemberWithInvalidBaseFinal_WithMember(p: DeriveFromFinal*) -> i32 {
|
||||
}
|
||||
|
||||
fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 {
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:10: error(NameNotFound): name `b` not found
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:10: error: name `b` not found [NameNotFound]
|
||||
// CHECK:STDERR: return (*p).b;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
return (*p).b;
|
||||
|
||||
@@ -20,13 +20,13 @@ class D {
|
||||
extend base: B;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+4]]:6: error(QualifiedDeclOutsideScopeEntity): out-of-line declaration requires a declaration in scoped entity
|
||||
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+4]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity]
|
||||
// CHECK:STDERR: fn D.F() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn D.F() {}
|
||||
|
||||
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+3]]:6: error(NameNotFound): name `C` not found
|
||||
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+3]]:6: error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn D.C.F() {}
|
||||
// CHECK:STDERR: ^
|
||||
fn D.C.F() {}
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
|
||||
base class B {}
|
||||
|
||||
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:1: error(ClassSpecificDeclOutsideClass): `base` declaration outside class
|
||||
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:1: error: `base` declaration outside class [ClassSpecificDeclOutsideClass]
|
||||
// CHECK:STDERR: extend base: B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
extend base: B;
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+7]]:3: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+7]]:3: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: extend base: B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+3]]:3: error(SemanticsTodo): semantics TODO: `HandleInvalidParse`
|
||||
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+3]]:3: error: semantics TODO: `HandleInvalidParse` [SemanticsTodo]
|
||||
// CHECK:STDERR: extend base: B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
extend base: B;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
base class B {}
|
||||
|
||||
class C1 {
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error(ModifierNotAllowedOnDeclaration): `private` not allowed on `base` declaration
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: private extend base: B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -19,11 +19,11 @@ class C1 {
|
||||
}
|
||||
|
||||
class C2 {
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+8]]:3: error(ModifierNotAllowedOnDeclaration): `abstract` not allowed on `base` declaration
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+8]]:3: error: `abstract` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: abstract base: B;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error(BaseMissingExtend): missing `extend` before `base` declaration
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error: missing `extend` before `base` declaration [BaseMissingExtend]
|
||||
// CHECK:STDERR: abstract base: B;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -31,10 +31,10 @@ class C2 {
|
||||
}
|
||||
|
||||
class C3 {
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+7]]:10: error(ModifierNotAllowedWith): `default` not allowed on declaration with `extend`
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+7]]:10: error: `default` not allowed on declaration with `extend` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: extend default base: B;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: note(ModifierPrevious): `extend` previously appeared here
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: note: `extend` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: extend default base: B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -42,10 +42,10 @@ class C3 {
|
||||
}
|
||||
|
||||
class C4 {
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+6]]:10: error(ModifierRepeated): `extend` repeated on declaration
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+6]]:10: error: `extend` repeated on declaration [ModifierRepeated]
|
||||
// CHECK:STDERR: extend extend base: B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+3]]:3: note(ModifierPrevious): `extend` previously appeared here
|
||||
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+3]]:3: note: `extend` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: extend extend base: B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
extend extend base: B;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
base class B {}
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_base_no_extend.carbon:[[@LINE+3]]:3: error(BaseMissingExtend): missing `extend` before `base` declaration
|
||||
// CHECK:STDERR: fail_base_no_extend.carbon:[[@LINE+3]]:3: error: missing `extend` before `base` declaration [BaseMissingExtend]
|
||||
// CHECK:STDERR: base: B;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
base: B;
|
||||
|
||||
@@ -13,10 +13,10 @@ base class B2 {}
|
||||
|
||||
class C {
|
||||
extend base: B1;
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+7]]:3: error(BaseDeclRepeated): multiple `base` declarations in class; multiple inheritance is not permitted
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+7]]:3: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated]
|
||||
// CHECK:STDERR: extend base: B2;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-4]]:3: note(ClassSpecificDeclPrevious): previous `base` declaration is here
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-4]]:3: note: previous `base` declaration is here [ClassSpecificDeclPrevious]
|
||||
// CHECK:STDERR: extend base: B1;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -26,10 +26,10 @@ class C {
|
||||
class D {
|
||||
// TODO: Consider adding a custom diagnostic for this case.
|
||||
extend base: B1;
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+6]]:3: error(BaseDeclRepeated): multiple `base` declarations in class; multiple inheritance is not permitted
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+6]]:3: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated]
|
||||
// CHECK:STDERR: extend base: B1;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-4]]:3: note(ClassSpecificDeclPrevious): previous `base` declaration is here
|
||||
// CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-4]]:3: note: previous `base` declaration is here [ClassSpecificDeclPrevious]
|
||||
// CHECK:STDERR: extend base: B1;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
extend base: B1;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ class C {
|
||||
extend base: B;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_base_unbound.carbon:[[@LINE+3]]:12: error(UseOfNonExprAsValue): expression cannot be used as a value
|
||||
// CHECK:STDERR: fail_base_unbound.carbon:[[@LINE+3]]:12: error: expression cannot be used as a value [UseOfNonExprAsValue]
|
||||
// CHECK:STDERR: let b: B = C.base;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
let b: B = C.base;
|
||||
|
||||
@@ -17,10 +17,10 @@ class B {
|
||||
}
|
||||
|
||||
fn AccessBInA(a: A) -> i32 {
|
||||
// CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+6]]:10: error(ImplicitAsConversionFailure): cannot implicitly convert from `A` to `B`
|
||||
// CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+6]]:10: error: cannot implicitly convert from `A` to `B` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: return a.(B.b);
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+3]]:10: note(MissingImplInMemberAccessNote): type `A` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+3]]:10: note: type `A` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: return a.(B.b);
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
return a.(B.b);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+3]]:10: error(NameNotFound): name `NoSuchType` not found
|
||||
// CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+3]]:10: error: name `NoSuchType` not found [NameNotFound]
|
||||
// CHECK:STDERR: var a: NoSuchType;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
var a: NoSuchType;
|
||||
|
||||
@@ -21,10 +21,10 @@ class B2 {
|
||||
var b: i32;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+7]]:38: error(ImplicitAsConversionFailure): cannot implicitly convert from `B2*` to `A1*`
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+7]]:38: error: cannot implicitly convert from `B2*` to `A1*` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:38: note(MissingImplInMemberAccessNote): type `B2*` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+4]]:38: note: type `B2*` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -32,10 +32,10 @@ fn ConvertUnrelated(p: B2*) -> A1* { return p; }
|
||||
|
||||
class Incomplete;
|
||||
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+6]]:47: error(ImplicitAsConversionFailure): cannot implicitly convert from `Incomplete*` to `A2*`
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+6]]:47: error: cannot implicitly convert from `Incomplete*` to `A2*` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:47: note(MissingImplInMemberAccessNote): type `Incomplete*` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:47: note: type `Incomplete*` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; }
|
||||
|
||||
+3
-3
@@ -16,16 +16,16 @@ base class B {
|
||||
extend base: A;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+7]]:1: error(RedeclRedef): redefinition of `class A`
|
||||
// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+7]]:1: error: redefinition of `class A` [RedeclRedef]
|
||||
// CHECK:STDERR: base class A {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE-11]]:1: note(RedeclPrevDef): previously defined here
|
||||
// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE-11]]:1: note: previously defined here [RedeclPrevDef]
|
||||
// CHECK:STDERR: base class A {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
base class A {
|
||||
extend base: A;
|
||||
// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+3]]:10: error(NameNotFound): name `C` not found
|
||||
// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+3]]:10: error: name `C` not found [NameNotFound]
|
||||
// CHECK:STDERR: var c: C;
|
||||
// CHECK:STDERR: ^
|
||||
var c: C;
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
|
||||
class Class {
|
||||
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error(ModifierNotAllowedOnDeclaration): `default` not allowed on `var` declaration
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: default var j: i32;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
default var j: i32;
|
||||
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error(ModifierNotAllowedOnDeclaration): `final` not allowed on `var` declaration
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `final` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: final var k: i32;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
final var k: i32;
|
||||
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error(ModifierRequiresInterface): `default` not allowed; requires interface scope
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed; requires interface scope [ModifierRequiresInterface]
|
||||
// CHECK:STDERR: default let l: i32 = 0;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
default let l: i32 = 0;
|
||||
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+3]]:3: error(ModifierRequiresInterface): `final` not allowed; requires interface scope
|
||||
// CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+3]]:3: error: `final` not allowed; requires interface scope [ModifierRequiresInterface]
|
||||
// CHECK:STDERR: final let m: i32 = 1;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
final let m: i32 = 1;
|
||||
|
||||
@@ -15,18 +15,18 @@ class Class(T:! type) {
|
||||
|
||||
// TODO: The follow-on errors here aren't great. Investigate whether we can
|
||||
// enter the scope anyway if the parameters don't match.
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+14]]:10: error(RedeclParamDiffers): redeclaration differs at parameter 1
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+14]]:10: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-10]]:13: note(RedeclParamPrevious): previous declaration's corresponding parameter here
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-10]]:13: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: class Class(T:! type) {
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+7]]:27: error(NameNotFound): name `Self` not found
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+7]]:27: error: name `Self` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+3]]:36: error(NameNotFound): name `T` not found
|
||||
// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+3]]:36: error: name `T` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
// CHECK:STDERR: ^
|
||||
fn Class(N:! i32).F[self: Self](n: T) {}
|
||||
|
||||
@@ -23,22 +23,22 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import library "a";
|
||||
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:1: error(RedeclRedundant): redeclaration of `class Empty` is redundant
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:1: error: redeclaration of `class Empty` is redundant [RedeclRedundant]
|
||||
// CHECK:STDERR: class Empty {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE-5]]:1(InImport): in import
|
||||
// CHECK:STDERR: a.carbon:4:1: note(RedeclPrevDecl): previously declared here
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE-5]]:1: in import [InImport]
|
||||
// CHECK:STDERR: a.carbon:4:1: note: previously declared here [RedeclPrevDecl]
|
||||
// CHECK:STDERR: class Empty {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class Empty {
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE+7]]:8: error(IncompleteTypeInVarDecl): variable has incomplete type `Incomplete`
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE+7]]:8: error: variable has incomplete type `Incomplete` [IncompleteTypeInVarDecl]
|
||||
// CHECK:STDERR: var a: Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE-16]]:1(InImport): in import
|
||||
// CHECK:STDERR: a.carbon:7:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_b.carbon:[[@LINE-16]]:1: in import [InImport]
|
||||
// CHECK:STDERR: a.carbon:7:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Incomplete;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
var a: Incomplete;
|
||||
|
||||
+27
-27
@@ -14,49 +14,49 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Class;
|
||||
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:4: error(QualifiedDeclInIncompleteClassScope): cannot declare a member of incomplete class `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:4: error: cannot declare a member of incomplete class `Class` [QualifiedDeclInIncompleteClassScope]
|
||||
// CHECK:STDERR: fn Class.Function() {}
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-5]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-5]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn Class.Function() {}
|
||||
|
||||
fn CallClassFunction() {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:3: error(QualifiedExprInIncompleteClassScope): member access into incomplete class `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:3: error: member access into incomplete class `Class` [QualifiedExprInIncompleteClassScope]
|
||||
// CHECK:STDERR: Class.Function();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-15]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-15]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Class.Function();
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:17: error(IncompleteTypeInVarDecl): variable has incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:17: error: variable has incomplete type `Class` [IncompleteTypeInVarDecl]
|
||||
// CHECK:STDERR: var global_var: Class;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-25]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-25]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var global_var: Class;
|
||||
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:24: error(IncompleteTypeInFunctionReturnType): function returns incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:24: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fn ConvertFromStruct() -> Class { return {}; }
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-34]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-34]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn ConvertFromStruct() -> Class { return {}; }
|
||||
|
||||
fn G(p: Class*) -> i32 {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:10: error(IncompleteTypeInMemberAccess): member access into object of incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:10: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess]
|
||||
// CHECK:STDERR: return p->n;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-44]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-44]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -64,20 +64,20 @@ fn G(p: Class*) -> i32 {
|
||||
}
|
||||
|
||||
fn MemberAccess(p: Class*) -> i32 {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:11: error(IncompleteTypeInMemberAccess): member access into object of incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:11: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess]
|
||||
// CHECK:STDERR: return (*p).n;
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-55]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-55]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return (*p).n;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:20: error(IncompleteTypeInFunctionReturnType): function returns incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:20: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: fn Copy(p: Class*) -> Class {
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-65]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-65]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -86,10 +86,10 @@ fn Copy(p: Class*) -> Class {
|
||||
}
|
||||
|
||||
fn Let(p: Class*) {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:10: error(IncompleteTypeInLetDecl): `let` binding has incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+7]]:10: error: `let` binding has incomplete type `Class` [IncompleteTypeInLetDecl]
|
||||
// CHECK:STDERR: let c: Class = *p;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-77]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-77]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -101,25 +101,25 @@ fn TakeIncomplete(c: Class);
|
||||
fn ReturnIncomplete() -> Class;
|
||||
|
||||
fn CallTakeIncomplete(p: Class*) {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:18: error(IncompleteTypeInValueConversion): forming value of incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:18: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion]
|
||||
// CHECK:STDERR: TakeIncomplete(*p);
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-92]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-92]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-11]]:19: note(InCallToFunctionParam): initializing function parameter
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-11]]:19: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: fn TakeIncomplete(c: Class);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
TakeIncomplete(*p);
|
||||
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:18: error(IncompleteTypeInValueConversion): forming value of incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:18: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion]
|
||||
// CHECK:STDERR: TakeIncomplete({});
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-104]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-104]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-23]]:19: note(InCallToFunctionParam): initializing function parameter
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-23]]:19: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: fn TakeIncomplete(c: Class);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -127,13 +127,13 @@ fn CallTakeIncomplete(p: Class*) {
|
||||
}
|
||||
|
||||
fn CallReturnIncomplete() {
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:3: error(IncompleteTypeInFunctionReturnType): function returns incomplete type `Class`
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+10]]:3: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType]
|
||||
// CHECK:STDERR: ReturnIncomplete();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-118]]:1: note(ClassForwardDeclaredHere): class was forward declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-118]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-35]]:23: note(IncompleteReturnTypeHere): return type declared here
|
||||
// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-35]]:23: note: return type declared here [IncompleteReturnTypeHere]
|
||||
// CHECK:STDERR: fn ReturnIncomplete() -> Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -145,10 +145,10 @@ fn CallReturnIncomplete() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_in_definition.carbon:[[@LINE+6]]:10: error(IncompleteTypeInVarDecl): field has incomplete type `C`
|
||||
// CHECK:STDERR: fail_in_definition.carbon:[[@LINE+6]]:10: error: field has incomplete type `C` [IncompleteTypeInVarDecl]
|
||||
// CHECK:STDERR: var c: C;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_in_definition.carbon:[[@LINE-4]]:1: note(ClassIncompleteWithinDefinition): class is incomplete within its definition
|
||||
// CHECK:STDERR: fail_in_definition.carbon:[[@LINE-4]]:1: note: class is incomplete within its definition [ClassIncompleteWithinDefinition]
|
||||
// CHECK:STDERR: class C {
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
var c: C;
|
||||
|
||||
+3
-3
@@ -14,17 +14,17 @@ class Class {
|
||||
}
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error(StructInitElementCountMismatch): cannot initialize class with 2 fields from struct with 1 field
|
||||
// CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error: cannot initialize class with 2 fields from struct with 1 field [StructInitElementCountMismatch]
|
||||
// CHECK:STDERR: {.a = 1} as Class;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
{.a = 1} as Class;
|
||||
// CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error(StructInitMissingFieldInLiteral): missing value for field `b` in struct initialization
|
||||
// CHECK:STDERR: fail_init.carbon:[[@LINE+4]]:3: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral]
|
||||
// CHECK:STDERR: {.a = 1, .c = 2} as Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
{.a = 1, .c = 2} as Class;
|
||||
// CHECK:STDERR: fail_init.carbon:[[@LINE+3]]:3: error(StructInitElementCountMismatch): cannot initialize class with 2 fields from struct with 3 fields
|
||||
// CHECK:STDERR: fail_init.carbon:[[@LINE+3]]:3: error: cannot initialize class with 2 fields from struct with 3 fields [StructInitElementCountMismatch]
|
||||
// CHECK:STDERR: {.a = 1, .b = 2, .c = 3} as Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{.a = 1, .b = 2, .c = 3} as Class;
|
||||
|
||||
@@ -19,7 +19,7 @@ fn F() {
|
||||
// TODO: This case should presumably work: `{...} as Class` should be an
|
||||
// initializing expression, not a value expression.
|
||||
//
|
||||
// CHECK:STDERR: fail_init_as_inplace.carbon:[[@LINE+3]]:18: error(CopyOfUncopyableType): cannot copy value of type `Class`
|
||||
// CHECK:STDERR: fail_init_as_inplace.carbon:[[@LINE+3]]:18: error: cannot copy value of type `Class` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: var c: Class = {.a = 1, .b = 2} as Class;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var c: Class = {.a = 1, .b = 2} as Class;
|
||||
|
||||
@@ -18,10 +18,10 @@ class B {
|
||||
|
||||
fn F(s: {.a: A}, b: B) {
|
||||
// `s` has only a value representation, so this must be invalid.
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:4: error(AddrSelfIsNonRef): `addr self` method cannot be invoked on a value
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+7]]:4: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
|
||||
// CHECK:STDERR: s.a.F();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-12]]:8: note(InCallToFunctionSelf): initializing `addr self` parameter of method declared here
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-12]]:8: note: initializing `addr self` parameter of method declared here [InCallToFunctionSelf]
|
||||
// CHECK:STDERR: fn F[addr self: A*]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -29,10 +29,10 @@ fn F(s: {.a: A}, b: B) {
|
||||
|
||||
// `b` has an object representation for `A`, but this is still invalid for
|
||||
// consistency.
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+6]]:4: error(AddrSelfIsNonRef): `addr self` method cannot be invoked on a value
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+6]]:4: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
|
||||
// CHECK:STDERR: b.a.F();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-23]]:8: note(InCallToFunctionSelf): initializing `addr self` parameter of method declared here
|
||||
// CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-23]]:8: note: initializing `addr self` parameter of method declared here [InCallToFunctionSelf]
|
||||
// CHECK:STDERR: fn F[addr self: A*]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
b.a.F();
|
||||
|
||||
@@ -17,10 +17,10 @@ let T: type = Class;
|
||||
|
||||
// The class name is required to be written in the same way as in the class
|
||||
// declaration. An expression that evaluates to the class name is not accepted.
|
||||
// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+6]]:4: error(QualifiedNameInNonScope): name qualifiers are only allowed for entities that provide a scope
|
||||
// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+6]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope]
|
||||
// CHECK:STDERR: fn T.F() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE-7]]:5: note(QualifiedNameNonScopeEntity): referenced non-scope entity declared here
|
||||
// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE-7]]:5: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity]
|
||||
// CHECK:STDERR: let T: type = Class;
|
||||
// CHECK:STDERR: ^
|
||||
fn T.F() {}
|
||||
|
||||
+6
-6
@@ -20,27 +20,27 @@ fn F(c: Class) {
|
||||
c.WithSelf();
|
||||
|
||||
Class.NoSelf();
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error(MissingObjectInMethodCall): missing object argument in method call
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: Class.WithSelf();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE-13]]:3: note(InCallToFunction): calling function declared here
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE-13]]:3: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR: fn WithSelf[self: Class]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Class.WithSelf();
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error(CallArgCountMismatch): 1 argument passed to function expecting 0 arguments
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE+7]]:3: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: Class.WithSelf(c);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE-21]]:3: note(InCallToEntity): calling function declared here
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE-21]]:3: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn WithSelf[self: Class]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Class.WithSelf(c);
|
||||
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE+6]]:3: error(MissingObjectInMethodCall): missing object argument in method call
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE+6]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: A();
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE-30]]:3: note(InCallToFunction): calling function declared here
|
||||
// CHECK:STDERR: fail_method.carbon:[[@LINE-30]]:3: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR: fn WithSelf[self: Class]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
A();
|
||||
|
||||
@@ -10,19 +10,19 @@
|
||||
|
||||
class FinalClass {
|
||||
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error(ModifierAbstractNotAllowed): `abstract` not allowed; requires `abstract` class scope
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed]
|
||||
// CHECK:STDERR: abstract fn Abstract[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note(ModifierNotInContext): containing definition here
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note: containing definition here [ModifierNotInContext]
|
||||
// CHECK:STDERR: class FinalClass {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract fn Abstract[self: Self]();
|
||||
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error(ModifierVirtualNotAllowed): `virtual` not allowed; requires `abstract` or `base` class scope
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `virtual` not allowed; requires `abstract` or `base` class scope [ModifierVirtualNotAllowed]
|
||||
// CHECK:STDERR: virtual fn Virtual[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-14]]:1: note(ModifierNotInContext): containing definition here
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-14]]:1: note: containing definition here [ModifierNotInContext]
|
||||
// CHECK:STDERR: class FinalClass {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -31,13 +31,13 @@ class FinalClass {
|
||||
|
||||
abstract class AbstractClass {
|
||||
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+4]]:3: error(ModifierRequiresInterface): `default` not allowed; requires interface scope
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed; requires interface scope [ModifierRequiresInterface]
|
||||
// CHECK:STDERR: default fn Default[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
default fn Default[self: Self]();
|
||||
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+4]]:3: error(ModifierRequiresInterface): `final` not allowed; requires interface scope
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+4]]:3: error: `final` not allowed; requires interface scope [ModifierRequiresInterface]
|
||||
// CHECK:STDERR: final fn Final[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -46,10 +46,10 @@ abstract class AbstractClass {
|
||||
|
||||
base class BaseClass {
|
||||
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+6]]:3: error(ModifierAbstractNotAllowed): `abstract` not allowed; requires `abstract` class scope
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+6]]:3: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed]
|
||||
// CHECK:STDERR: abstract fn Abstract[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note(ModifierNotInContext): containing definition here
|
||||
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note: containing definition here [ModifierNotInContext]
|
||||
// CHECK:STDERR: base class BaseClass {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
abstract fn Abstract[self: Self]();
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
class Class {
|
||||
fn F() {}
|
||||
// CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE+6]]:3: error(RedeclRedef): redefinition of `fn F`
|
||||
// CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE+6]]:3: error: redefinition of `fn F` [RedeclRedef]
|
||||
// CHECK:STDERR: fn F() {}
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE-4]]:3: note(RedeclPrevDef): previously defined here
|
||||
// CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE-4]]:3: note: previously defined here [RedeclPrevDef]
|
||||
// CHECK:STDERR: fn F() {}
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
fn F() {}
|
||||
|
||||
+18
-18
@@ -8,89 +8,89 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_modifiers.carbon
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error(ModifierRepeated): `private` repeated on declaration
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error: `private` repeated on declaration [ModifierRepeated]
|
||||
// CHECK:STDERR: private private class DuplicatePrivate;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note(ModifierPrevious): `private` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `private` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: private private class DuplicatePrivate;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
private private class DuplicatePrivate;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error(ModifierOnlyAllowedOnDefinition): `abstract` not allowed on `class` forward declaration, only definition
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition]
|
||||
// CHECK:STDERR: abstract class AbstractDecl;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract class AbstractDecl;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error(ModifierNotAllowedWith): `protected` not allowed on declaration with `private`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:9: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: private protected class TwoAccess;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note(ModifierPrevious): `private` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `private` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: private protected class TwoAccess;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
private protected class TwoAccess;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error(ModifierOnlyAllowedOnDefinition): `base` not allowed on `class` forward declaration, only definition
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition]
|
||||
// CHECK:STDERR: base class BaseDecl;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
base class BaseDecl;
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error(ModifierRepeated): `abstract` repeated on declaration
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error: `abstract` repeated on declaration [ModifierRepeated]
|
||||
// CHECK:STDERR: abstract abstract class TwoAbstract { }
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note(ModifierPrevious): `abstract` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract abstract class TwoAbstract { }
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract abstract class TwoAbstract { }
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: error(ModifierProtectedNotAllowed): `protected` not allowed; requires class scope
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed]
|
||||
// CHECK:STDERR: protected virtual base class Virtual {}
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:11: error(ModifierNotAllowedOnDeclaration): `virtual` not allowed on `class` declaration
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:11: error: `virtual` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration]
|
||||
// CHECK:STDERR: protected virtual base class Virtual {}
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:19: error(ModifierNotAllowedWith): `base` not allowed on declaration with `virtual`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:19: error: `base` not allowed on declaration with `virtual` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: protected virtual base class Virtual {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:11: note(ModifierPrevious): `virtual` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:11: note: `virtual` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: protected virtual base class Virtual {}
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
protected virtual base class Virtual {}
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error(ModifierMustAppearBefore): `protected` must appear before `abstract`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error: `protected` must appear before `abstract` [ModifierMustAppearBefore]
|
||||
// CHECK:STDERR: abstract protected class WrongOrder { }
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note(ModifierPrevious): `abstract` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract protected class WrongOrder { }
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract protected class WrongOrder { }
|
||||
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error(ModifierNotAllowedWith): `base` not allowed on declaration with `abstract`
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:10: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith]
|
||||
// CHECK:STDERR: abstract base class AbstractAndBase {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note(ModifierPrevious): `abstract` previously appeared here
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: note: `abstract` previously appeared here [ModifierPrevious]
|
||||
// CHECK:STDERR: abstract base class AbstractAndBase {}
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract base class AbstractAndBase {}
|
||||
|
||||
abstract class AbstractWithDefinition {
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:19: error(DefinedAbstractFunction): definition of `abstract` function
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:19: error: definition of `abstract` function [DefinedAbstractFunction]
|
||||
// CHECK:STDERR: abstract fn F() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
abstract fn F() {}
|
||||
abstract fn G();
|
||||
}
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:31: error(DefinedAbstractFunction): definition of `abstract` function
|
||||
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:31: error: definition of `abstract` function [DefinedAbstractFunction]
|
||||
// CHECK:STDERR: fn AbstractWithDefinition.G() {
|
||||
// CHECK:STDERR: ^
|
||||
fn AbstractWithDefinition.G() {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class C {}
|
||||
|
||||
// CHECK:STDERR: fail_out_of_line_decl.carbon:[[@LINE+3]]:6: error(QualifiedDeclOutsideScopeEntity): out-of-line declaration requires a declaration in scoped entity
|
||||
// CHECK:STDERR: fail_out_of_line_decl.carbon:[[@LINE+3]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity]
|
||||
// CHECK:STDERR: fn C.F() {}
|
||||
// CHECK:STDERR: ^
|
||||
fn C.F() {}
|
||||
|
||||
@@ -19,7 +19,7 @@ class X {
|
||||
class A { class B; }
|
||||
|
||||
class Y {
|
||||
// CHECK:STDERR: fail_redeclaration_scope.carbon:[[@LINE+3]]:9: error(NameNotFound): name `A` not found
|
||||
// CHECK:STDERR: fail_redeclaration_scope.carbon:[[@LINE+3]]:9: error: name `A` not found [NameNotFound]
|
||||
// CHECK:STDERR: class A.B {}
|
||||
// CHECK:STDERR: ^
|
||||
class A.B {}
|
||||
|
||||
+5
-5
@@ -14,10 +14,10 @@ class Class {
|
||||
fn I() {}
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:1: error(RedeclRedef): redefinition of `class Class`
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+7]]:1: error: redefinition of `class Class` [RedeclRedef]
|
||||
// CHECK:STDERR: class Class {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-9]]:1: note(RedeclPrevDef): previously defined here
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-9]]:1: note: previously defined here [RedeclPrevDef]
|
||||
// CHECK:STDERR: class Class {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -28,16 +28,16 @@ class Class {
|
||||
}
|
||||
|
||||
fn Class.F() {}
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+4]]:10: error(QualifiedDeclOutsideScopeEntity): out-of-line declaration requires a declaration in scoped entity
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+4]]:10: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity]
|
||||
// CHECK:STDERR: fn Class.G() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
fn Class.G() {}
|
||||
fn Class.H() {}
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+6]]:1: error(RedeclRedef): redefinition of `fn I`
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+6]]:1: error: redefinition of `fn I` [RedeclRedef]
|
||||
// CHECK:STDERR: fn Class.I() {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-26]]:3: note(RedeclPrevDef): previously defined here
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-26]]:3: note: previously defined here [RedeclPrevDef]
|
||||
// CHECK:STDERR: fn I() {}
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
fn Class.I() {}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class Class {
|
||||
}
|
||||
|
||||
fn G() -> i32 {
|
||||
// CHECK:STDERR: fail_scope.carbon:[[@LINE+3]]:10: error(NameNotFound): name `F` not found
|
||||
// CHECK:STDERR: fail_scope.carbon:[[@LINE+3]]:10: error: name `F` not found [NameNotFound]
|
||||
// CHECK:STDERR: return F();
|
||||
// CHECK:STDERR: ^
|
||||
return F();
|
||||
|
||||
+7
-7
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_self.carbon
|
||||
|
||||
class Class {
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:8: error(SelfOutsideImplicitParamList): `self` can only be declared in an implicit parameter list
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:8: error: `self` can only be declared in an implicit parameter list [SelfOutsideImplicitParamList]
|
||||
// CHECK:STDERR: fn F(self: Self);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -18,7 +18,7 @@ class Class {
|
||||
fn G() -> Self;
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:12: error(SelfOutsideImplicitParamList): `self` can only be declared in an implicit parameter list
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:12: error: `self` can only be declared in an implicit parameter list [SelfOutsideImplicitParamList]
|
||||
// CHECK:STDERR: fn Class.F(self: Self) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -26,12 +26,12 @@ fn Class.F(self: Self) {
|
||||
}
|
||||
|
||||
fn Class.G() -> Self {
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:7: error(SelfOutsideImplicitParamList): `self` can only be declared in an implicit parameter list
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:7: error: `self` can only be declared in an implicit parameter list [SelfOutsideImplicitParamList]
|
||||
// CHECK:STDERR: var self: Self;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var self: Self;
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:10: error(CopyOfUncopyableType): cannot copy value of type `Class`
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:10: error: cannot copy value of type `Class` [CopyOfUncopyableType]
|
||||
// CHECK:STDERR: return self;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -43,13 +43,13 @@ class WrongSelf {
|
||||
}
|
||||
|
||||
fn CallWrongSelf(ws: WrongSelf) {
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+9]]:3: error(ImplicitAsConversionFailure): cannot implicitly convert from `WrongSelf` to `Class`
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+9]]:3: error: cannot implicitly convert from `WrongSelf` to `Class` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: ws.F();
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+6]]:3: note(MissingImplInMemberAccessNote): type `WrongSelf` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE+6]]:3: note: type `WrongSelf` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: ws.F();
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE-10]]:8: note(InCallToFunctionSelf): initializing `self` parameter of method declared here
|
||||
// CHECK:STDERR: fail_self.carbon:[[@LINE-10]]:8: note: initializing `self` parameter of method declared here [InCallToFunctionSelf]
|
||||
// CHECK:STDERR: fn F[self: Class]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
ws.F();
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_self_param.carbon
|
||||
|
||||
// CHECK:STDERR: fail_self_param.carbon:[[@LINE+3]]:9: error(SelfParameterNotAllowed): `self` parameter only allowed on functions
|
||||
// CHECK:STDERR: fail_self_param.carbon:[[@LINE+3]]:9: error: `self` parameter only allowed on functions [SelfParameterNotAllowed]
|
||||
// CHECK:STDERR: class C[self:! type](x:! self) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
class C[self:! type](x:! self) {}
|
||||
|
||||
@@ -14,11 +14,11 @@ class Class {
|
||||
|
||||
fn F() -> bool {
|
||||
var c1: Class = {.b = true};
|
||||
// CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+7]]:17: error(ExpectedIdentifierAfterPeriodOrArrow): expected identifier after `.`
|
||||
// CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+7]]:17: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow]
|
||||
// CHECK:STDERR: var c2: Class.Self = c1;
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+3]]:17: error(SemanticsTodo): semantics TODO: `Error recovery from keyword name.`
|
||||
// CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+3]]:17: error: semantics TODO: `Error recovery from keyword name.` [SemanticsTodo]
|
||||
// CHECK:STDERR: var c2: Class.Self = c1;
|
||||
// CHECK:STDERR: ^~~~
|
||||
var c2: Class.Self = c1;
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
// TODO: Support parsing classes at function scope.
|
||||
class A {
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_todo_local_class.carbon:[[@LINE+7]]:5: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_todo_local_class.carbon:[[@LINE+7]]:5: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: class B {
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_local_class.carbon:[[@LINE+3]]:5: error(SemanticsTodo): semantics TODO: `HandleInvalidParse`
|
||||
// CHECK:STDERR: fail_todo_local_class.carbon:[[@LINE+3]]:5: error: semantics TODO: `HandleInvalidParse` [SemanticsTodo]
|
||||
// CHECK:STDERR: class B {
|
||||
// CHECK:STDERR: ^~~~~
|
||||
class B {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class Class {
|
||||
var field: i32;
|
||||
fn F() -> i32 {
|
||||
// CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+4]]:12: error(UseOfNonExprAsValue): expression cannot be used as a value
|
||||
// CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+4]]:12: error: expression cannot be used as a value [UseOfNonExprAsValue]
|
||||
// CHECK:STDERR: return field;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -20,7 +20,7 @@ class Class {
|
||||
}
|
||||
|
||||
fn G() -> i32 {
|
||||
// CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+3]]:10: error(UseOfNonExprAsValue): expression cannot be used as a value
|
||||
// CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+3]]:10: error: expression cannot be used as a value [UseOfNonExprAsValue]
|
||||
// CHECK:STDERR: return Class.field;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
return Class.field;
|
||||
|
||||
@@ -14,7 +14,7 @@ class Class {
|
||||
|
||||
fn G(c: Class) -> i32 {
|
||||
// TODO: Mention the scope in which we looked for the name.
|
||||
// CHECK:STDERR: fail_unknown_member.carbon:[[@LINE+3]]:10: error(NameNotFound): name `something` not found
|
||||
// CHECK:STDERR: fail_unknown_member.carbon:[[@LINE+3]]:10: error: name `something` not found [NameNotFound]
|
||||
// CHECK:STDERR: return c.something;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
return c.something;
|
||||
|
||||
+7
-7
@@ -25,10 +25,10 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Class(T:! type, N:! i32) {}
|
||||
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+7]]:8: error(CallArgCountMismatch): 1 argument passed to generic class expecting 2 arguments
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE+7]]:8: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: var a: Class(i32*);
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE-5]]:1: note(InCallToEntity): calling generic class declared here
|
||||
// CHECK:STDERR: fail_too_few.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity]
|
||||
// CHECK:STDERR: class Class(T:! type, N:! i32) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -40,10 +40,10 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Class(T:! type, N:! i32) {}
|
||||
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+7]]:8: error(CallArgCountMismatch): 3 arguments passed to generic class expecting 2 arguments
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE+7]]:8: error: 3 arguments passed to generic class expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: var a: Class(i32*, 1, 2);
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE-5]]:1: note(InCallToEntity): calling generic class declared here
|
||||
// CHECK:STDERR: fail_too_many.carbon:[[@LINE-5]]:1: note: calling generic class declared here [InCallToEntity]
|
||||
// CHECK:STDERR: class Class(T:! type, N:! i32) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -55,13 +55,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
class Class(T:! type, N:! i32) {}
|
||||
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+9]]:8: error(ImplicitAsConversionFailure): cannot implicitly convert from `i32` to `type`
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+9]]:8: error: cannot implicitly convert from `i32` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: var a: Class(5, i32*);
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:8: note(MissingImplInMemberAccessNote): type `i32` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:8: note: type `i32` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: var a: Class(5, i32*);
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-8]]:1: note(DeductionGenericHere): while deducing parameters of generic declared here
|
||||
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-8]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: class Class(T:! type, N:! i32) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var a: Class(5, i32*);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user