mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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
@@ -13,7 +13,7 @@ interface Simple {
|
||||
}
|
||||
|
||||
impl i32 as Simple {
|
||||
// CHECK:STDERR: fail_call_invalid.carbon:[[@LINE+3]]:14: error(NameNotFound): name `Undeclared` not found
|
||||
// CHECK:STDERR: fail_call_invalid.carbon:[[@LINE+3]]:14: error: name `Undeclared` not found [NameNotFound]
|
||||
// CHECK:STDERR: fn G[self: Undeclared]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
fn G[self: Undeclared]();
|
||||
|
||||
@@ -13,7 +13,7 @@ interface GenericInterface(T:! type) {
|
||||
}
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+3]]:3: error(ExtendImplForall): cannot `extend` a parameterized `impl`
|
||||
// CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+3]]:3: error: cannot `extend` a parameterized `impl` [ExtendImplForall]
|
||||
// CHECK:STDERR: extend impl forall [T:! type] as GenericInterface(T) {
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
extend impl forall [T:! type] as GenericInterface(T) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
interface I {}
|
||||
|
||||
// CHECK:STDERR: fail_extend_impl_scope.carbon:[[@LINE+3]]:1: error(ExtendImplOutsideClass): `extend impl` can only be used in a class
|
||||
// CHECK:STDERR: fail_extend_impl_scope.carbon:[[@LINE+3]]:1: error: `extend impl` can only be used in a class [ExtendImplOutsideClass]
|
||||
// CHECK:STDERR: extend impl i32 as I {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
extend impl i32 as I {}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
interface I {}
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:3: error(ExtendImplSelfAs): cannot `extend` an `impl` with an explicit self type
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs]
|
||||
// CHECK:STDERR: extend impl i32 as I {}
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -19,10 +19,10 @@ class C {
|
||||
}
|
||||
|
||||
class D {
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+7]]:3: error(ExtendImplSelfAs): cannot `extend` an `impl` with an explicit self type
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+7]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs]
|
||||
// CHECK:STDERR: extend impl D as I;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:15: note(ExtendImplSelfAsDefault): remove the explicit `Self` type here
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault]
|
||||
// CHECK:STDERR: extend impl D as I;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -30,10 +30,10 @@ class D {
|
||||
}
|
||||
|
||||
class E {
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+6]]:3: error(ExtendImplSelfAs): cannot `extend` an `impl` with an explicit self type
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+6]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs]
|
||||
// CHECK:STDERR: extend impl Self as I {}
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+3]]:15: note(ExtendImplSelfAsDefault): remove the explicit `Self` type here
|
||||
// CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+3]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault]
|
||||
// CHECK:STDERR: extend impl Self as I {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
extend impl Self as I {}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_non_interface.carbon
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+3]]:3: error(SemanticsTodo): semantics TODO: `extending non-interface constraint`
|
||||
// CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+3]]:3: error: semantics TODO: `extending non-interface constraint` [SemanticsTodo]
|
||||
// CHECK:STDERR: extend impl as i32;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
extend impl as i32;
|
||||
|
||||
+2
-2
@@ -10,10 +10,10 @@
|
||||
|
||||
interface I {
|
||||
class C {
|
||||
// CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+6]]:5: error(ExtendUndefinedInterface): `extend impl` requires a definition for interface `I`
|
||||
// CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+6]]:5: error: `extend impl` requires a definition for interface `I` [ExtendUndefinedInterface]
|
||||
// CHECK:STDERR: extend impl as I;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-5]]:1: note(InterfaceUndefinedWithinDefinition): interface is currently being defined
|
||||
// CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-5]]:1: note: interface is currently being defined [InterfaceUndefinedWithinDefinition]
|
||||
// CHECK:STDERR: interface I {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
extend impl as I;
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
interface I;
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+6]]:3: error(ExtendUndefinedInterface): `extend impl` requires a definition for interface `I`
|
||||
// CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+6]]:3: error: `extend impl` requires a definition for interface `I` [ExtendUndefinedInterface]
|
||||
// CHECK:STDERR: extend impl as I;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-6]]:1: note(InterfaceForwardDeclaredHere): interface was forward declared here
|
||||
// CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
|
||||
// CHECK:STDERR: interface I;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
extend impl as I;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ interface Simple {
|
||||
fn F();
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_impl_as_scope.carbon:[[@LINE+3]]:6: error(ImplAsOutsideClass): `impl as` can only be used in a class
|
||||
// CHECK:STDERR: fail_impl_as_scope.carbon:[[@LINE+3]]:6: error: `impl as` can only be used in a class [ImplAsOutsideClass]
|
||||
// CHECK:STDERR: impl as Simple {
|
||||
// CHECK:STDERR: ^~
|
||||
impl as Simple {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
interface I { let T:! type; }
|
||||
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE+3]]:1: error(SemanticsTodo): semantics TODO: `impl of interface with associated constant`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE+3]]:1: error: semantics TODO: `impl of interface with associated constant` [SemanticsTodo]
|
||||
// CHECK:STDERR: impl bool as I {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
impl bool as I {}
|
||||
|
||||
+30
-30
@@ -11,10 +11,10 @@
|
||||
interface I { fn F(); }
|
||||
|
||||
class NoF {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:3: error(ImplMissingFunction): missing implementation of F in impl of interface I
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:3: error: missing implementation of F in impl of interface I [ImplMissingFunction]
|
||||
// CHECK:STDERR: impl as I {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15: note(ImplAssociatedFunctionHere): associated function F declared here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15: note: associated function F declared here [ImplAssociatedFunctionHere]
|
||||
// CHECK:STDERR: interface I { fn F(); }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -23,10 +23,10 @@ class NoF {
|
||||
|
||||
class FNotFunction {
|
||||
impl as I {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(ImplFunctionWithNonFunction): associated function F implemented by non-function
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: associated function F implemented by non-function [ImplFunctionWithNonFunction]
|
||||
// CHECK:STDERR: class F;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-18]]:15: note(ImplAssociatedFunctionHere): associated function F declared here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-18]]:15: note: associated function F declared here [ImplAssociatedFunctionHere]
|
||||
// CHECK:STDERR: interface I { fn F(); }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -39,10 +39,10 @@ fn PossiblyF();
|
||||
// TODO: Should this be permitted?
|
||||
class FAlias {
|
||||
impl as I {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:11: error(ImplFunctionWithNonFunction): associated function F implemented by non-function
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:11: error: associated function F implemented by non-function [ImplFunctionWithNonFunction]
|
||||
// CHECK:STDERR: alias F = PossiblyF;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-34]]:15: note(ImplAssociatedFunctionHere): associated function F declared here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-34]]:15: note: associated function F declared here [ImplAssociatedFunctionHere]
|
||||
// CHECK:STDERR: interface I { fn F(); }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -52,10 +52,10 @@ class FAlias {
|
||||
|
||||
class FExtraParam {
|
||||
impl as I {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(RedeclParamCountDiffers): redeclaration differs because of parameter count of 1
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers]
|
||||
// CHECK:STDERR: fn F(b: bool);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-47]]:15: note(RedeclParamCountPrevious): previously declared with parameter count of 0
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-47]]:15: note: previously declared with parameter count of 0 [RedeclParamCountPrevious]
|
||||
// CHECK:STDERR: interface I { fn F(); }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -65,10 +65,10 @@ class FExtraParam {
|
||||
|
||||
class FExtraImplicitParam {
|
||||
impl as I {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(RedeclParamListDiffers): redeclaration differs because of implicit parameter list
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers]
|
||||
// CHECK:STDERR: fn F[self: Self]();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-60]]:15: note(RedeclParamListPrevious): previously declared without implicit parameter list
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-60]]:15: note: previously declared without implicit parameter list [RedeclParamListPrevious]
|
||||
// CHECK:STDERR: interface I { fn F(); }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -79,10 +79,10 @@ class FExtraImplicitParam {
|
||||
// TODO: Should this be permitted?
|
||||
class FExtraReturnType {
|
||||
impl as I {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(FunctionRedeclReturnTypeDiffers): function redeclaration differs because return type is `bool`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: function redeclaration differs because return type is `bool` [FunctionRedeclReturnTypeDiffers]
|
||||
// CHECK:STDERR: fn F() -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-74]]:15: note(FunctionRedeclReturnTypePreviousNoReturn): previously declared with no return type
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-74]]:15: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn]
|
||||
// CHECK:STDERR: interface I { fn F(); }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -94,10 +94,10 @@ interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
|
||||
class FMissingParam {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(RedeclParamCountDiffers): redeclaration differs because of parameter count of 0
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers]
|
||||
// CHECK:STDERR: fn F[self: bool]() -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-7]]:15: note(RedeclParamCountPrevious): previously declared with parameter count of 1
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-7]]:15: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -107,10 +107,10 @@ class FMissingParam {
|
||||
|
||||
class FMissingImplicitParam {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(RedeclParamListDiffers): redeclaration differs because of missing implicit parameter list
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: redeclaration differs because of missing implicit parameter list [RedeclParamListDiffers]
|
||||
// CHECK:STDERR: fn F(b: bool) -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-20]]:15: note(RedeclParamListPrevious): previously declared with implicit parameter list
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-20]]:15: note: previously declared with implicit parameter list [RedeclParamListPrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -120,10 +120,10 @@ class FMissingImplicitParam {
|
||||
|
||||
class FMissingReturnType {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(FunctionRedeclReturnTypeDiffersNoReturn): function redeclaration differs because no return type is provided
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: function redeclaration differs because no return type is provided [FunctionRedeclReturnTypeDiffersNoReturn]
|
||||
// CHECK:STDERR: fn F[self: bool](b: bool);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-33]]:15: note(FunctionRedeclReturnTypePrevious): previously declared with return type `bool`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-33]]:15: note: previously declared with return type `bool` [FunctionRedeclReturnTypePrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -133,10 +133,10 @@ class FMissingReturnType {
|
||||
|
||||
class FDifferentParamType {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:22: error(RedeclParamDiffers): redeclaration differs at parameter 1
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:22: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn F[self: bool](b: Self) -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-46]]:32: note(RedeclParamPrevious): previous declaration's corresponding parameter here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-46]]:32: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -146,10 +146,10 @@ class FDifferentParamType {
|
||||
|
||||
class FDifferentImplicitParamType {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: error(RedeclParamDiffers): redeclaration differs at implicit parameter 1
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: error: redeclaration differs at implicit parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn F[self: Self](b: bool) -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-59]]:20: note(RedeclParamPrevious): previous declaration's corresponding implicit parameter here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-59]]:20: note: previous declaration's corresponding implicit parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -159,10 +159,10 @@ class FDifferentImplicitParamType {
|
||||
|
||||
class FDifferentReturnType {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error(FunctionRedeclReturnTypeDiffers): function redeclaration differs because return type is `FDifferentReturnType`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:5: error: function redeclaration differs because return type is `FDifferentReturnType` [FunctionRedeclReturnTypeDiffers]
|
||||
// CHECK:STDERR: fn F[self: bool](b: bool) -> Self;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-72]]:15: note(FunctionRedeclReturnTypePrevious): previously declared with return type `bool`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-72]]:15: note: previously declared with return type `bool` [FunctionRedeclReturnTypePrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -173,10 +173,10 @@ class FDifferentReturnType {
|
||||
// TODO: This should probably be permitted.
|
||||
class FDifferentParamName {
|
||||
impl as J {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:22: error(RedeclParamDiffers): redeclaration differs at parameter 1
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:22: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn F[self: bool](not_b: bool) -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-86]]:32: note(RedeclParamPrevious): previous declaration's corresponding parameter here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-86]]:32: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: interface J { fn F[self: bool](b: bool) -> bool; }
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -190,10 +190,10 @@ interface SelfNested {
|
||||
|
||||
class SelfNestedBadParam {
|
||||
impl as SelfNested {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: error(RedeclParamDiffers): redeclaration differs at parameter 1
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+7]]:10: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
|
||||
// CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-8]]:8: note(RedeclParamPrevious): previous declaration's corresponding parameter here
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-8]]:8: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
|
||||
// CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> [Self; 4];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -203,10 +203,10 @@ class SelfNestedBadParam {
|
||||
|
||||
class SelfNestedBadReturnType {
|
||||
impl as SelfNested {
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: error(FunctionRedeclReturnTypeDiffers): function redeclaration differs because return type is `[SelfNestedBadParam; 4]`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+6]]:5: error: function redeclaration differs because return type is `[SelfNestedBadParam; 4]` [FunctionRedeclReturnTypeDiffers]
|
||||
// CHECK:STDERR: fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-21]]:3: note(FunctionRedeclReturnTypePrevious): previously declared with return type `[SelfNestedBadReturnType; 4]`
|
||||
// CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-21]]:3: note: previously declared with return type `[SelfNestedBadReturnType; 4]` [FunctionRedeclReturnTypePrevious]
|
||||
// CHECK:STDERR: fn F(x: (Self*, {.x: Self, .y: i32})) -> [Self; 4];
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4];
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_interface.carbon
|
||||
|
||||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+10]]:1: error(SemanticsTodo): semantics TODO: `impl as non-interface`
|
||||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+10]]:1: error: semantics TODO: `impl as non-interface` [SemanticsTodo]
|
||||
// CHECK:STDERR: impl i32 as false {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+6]]:13: error(ImplicitAsConversionFailure): cannot implicitly convert from `bool` to `type`
|
||||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+6]]:13: error: cannot implicitly convert from `bool` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: impl i32 as false {}
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+3]]:13: note(MissingImplInMemberAccessNote): type `bool` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+3]]:13: note: type `bool` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: impl i32 as false {}
|
||||
// CHECK:STDERR: ^~~~~
|
||||
impl i32 as false {}
|
||||
|
||||
+2
-2
@@ -12,10 +12,10 @@ interface I {}
|
||||
|
||||
impl i32 as I {}
|
||||
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+6]]:1: error(ImplRedefinition): redefinition of `impl i32 as I`
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+6]]:1: error: redefinition of `impl i32 as I` [ImplRedefinition]
|
||||
// CHECK:STDERR: impl i32 as I {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-5]]:1: note(ImplPreviousDefinition): previous definition was here
|
||||
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-5]]:1: note: previous definition was here [ImplPreviousDefinition]
|
||||
// CHECK:STDERR: impl i32 as I {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
impl i32 as I {}
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
interface I { let T:! type; }
|
||||
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+10]]:1: error(SemanticsTodo): semantics TODO: `impl of interface with associated constant`
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+10]]:1: error: semantics TODO: `impl of interface with associated constant` [SemanticsTodo]
|
||||
// CHECK:STDERR: impl bool as I where .T = bool {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+6]]:27: error(ImplicitAsConversionFailure): cannot implicitly convert from `type` to `<associated type in I>`
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+6]]:27: error: cannot implicitly convert from `type` to `<associated type in I>` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: impl bool as I where .T = bool {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+3]]:27: note(MissingImplInMemberAccessNote): type `type` does not implement interface `ImplicitAs`
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+3]]:27: note: type `type` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: impl bool as I where .T = bool {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
impl bool as I where .T = bool {}
|
||||
|
||||
@@ -17,12 +17,12 @@ class C {
|
||||
}
|
||||
|
||||
fn F(c: C) {
|
||||
// CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+4]]:3: error(MissingImplInMemberAccess): cannot access member of interface `I` in type `C` that does not implement that interface
|
||||
// CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: C.F();
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
C.F();
|
||||
// CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+3]]:3: error(MissingImplInMemberAccess): cannot access member of interface `I` in type `C` that does not implement that interface
|
||||
// CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+3]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: c.F();
|
||||
// CHECK:STDERR: ^~~
|
||||
c.F();
|
||||
|
||||
@@ -18,7 +18,7 @@ class C {
|
||||
|
||||
fn F() -> i32 {
|
||||
// TODO: This should produce a more useful error message.
|
||||
// CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+3]]:10: error(MissingImplInMemberAccess): cannot access member of interface `I` in type `C` that does not implement that interface
|
||||
// CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+3]]:10: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: return C.F();
|
||||
// CHECK:STDERR: ^~~
|
||||
return C.F();
|
||||
|
||||
+2
-2
@@ -90,7 +90,7 @@ impl forall [T:! type, U:! type] T as HasF {
|
||||
fn G(x: {}) {
|
||||
// TODO: It'd be nice to include a note here saying that deduction failed because
|
||||
// we couldn't deduce a value for 'U'.
|
||||
// CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+4]]:3: error(MissingImplInMemberAccess): cannot access member of interface `HasF` in type `{}` that does not implement that interface
|
||||
// CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+4]]:3: error: cannot access member of interface `HasF` in type `{}` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: x.(HasF.F)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -115,7 +115,7 @@ class B {}
|
||||
fn G(x: A) {
|
||||
// TODO: It'd be nice to include a note here saying that deduction failed because
|
||||
// we deduced two different values for `T`.
|
||||
// CHECK:STDERR: fail_inconsistent_deduction.carbon:[[@LINE+3]]:3: error(MissingImplInMemberAccess): cannot access member of interface `HasF` in type `A` that does not implement that interface
|
||||
// CHECK:STDERR: fail_inconsistent_deduction.carbon:[[@LINE+3]]:3: error: cannot access member of interface `HasF` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: x.(HasF(B).F)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
x.(HasF(B).F)();
|
||||
|
||||
@@ -16,10 +16,10 @@ alias AC = C;
|
||||
|
||||
impl AC as AI {}
|
||||
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE+6]]:1: error(ImplRedefinition): redefinition of `impl AC as AI`
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE+6]]:1: error: redefinition of `impl AC as AI` [ImplRedefinition]
|
||||
// CHECK:STDERR: impl AC as AI {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE-5]]:1: note(ImplPreviousDefinition): previous definition was here
|
||||
// CHECK:STDERR: fail_alias.carbon:[[@LINE-5]]:1: note: previous definition was here [ImplPreviousDefinition]
|
||||
// CHECK:STDERR: impl AC as AI {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
impl AC as AI {}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
interface I {}
|
||||
|
||||
// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+3]]:6: error(CoreNotFound): package `Core` implicitly referenced here, but not found
|
||||
// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+3]]:6: error: package `Core` implicitly referenced here, but not found [CoreNotFound]
|
||||
// CHECK:STDERR: impl true as I {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
impl true as I {}
|
||||
|
||||
@@ -39,10 +39,10 @@ interface I {}
|
||||
interface J {}
|
||||
|
||||
impl forall [T:! I] T as J {}
|
||||
// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE+6]]:1: error(ImplRedefinition): redefinition of `impl T as J`
|
||||
// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE+6]]:1: error: redefinition of `impl T as J` [ImplRedefinition]
|
||||
// CHECK:STDERR: impl forall [T:! I] T as J {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE-4]]:1: note(ImplPreviousDefinition): previous definition was here
|
||||
// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE-4]]:1: note: previous definition was here [ImplPreviousDefinition]
|
||||
// CHECK:STDERR: impl forall [T:! I] T as J {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
impl forall [T:! I] T as J {}
|
||||
|
||||
@@ -28,11 +28,11 @@ impl forall [T:! type] C as I(T) {}
|
||||
|
||||
impl library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+7]]:1: error(ImplRedefinition): redefinition of `impl C as I`
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+7]]:1: error: redefinition of `impl C as I` [ImplRedefinition]
|
||||
// CHECK:STDERR: impl forall [T:! type] C as I(T*) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE-5]]:6(InImport): in import
|
||||
// CHECK:STDERR: import_generic.carbon:8:1: note(ImplPreviousDefinition): previous definition was here
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE-5]]:6: in import [InImport]
|
||||
// CHECK:STDERR: import_generic.carbon:8:1: note: previous definition was here [ImplPreviousDefinition]
|
||||
// CHECK:STDERR: impl forall [T:! type] C as I(T*) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
impl forall [T:! type] C as I(T*) {}
|
||||
|
||||
@@ -36,7 +36,7 @@ fn G(a: A) { a.(Action(B).Op)(); }
|
||||
|
||||
impl library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error(MissingImplInMemberAccess): cannot access member of interface `Action` in type `A` that does not implement that interface
|
||||
// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -72,7 +72,7 @@ impl library "[[@TEST_NAME]]";
|
||||
class C {}
|
||||
|
||||
fn MakeC(a: A) -> C {
|
||||
// CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+3]]:10: error(MissingImplInMemberAccess): cannot access member of interface `Factory` in type `A` that does not implement that interface
|
||||
// CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Factory` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: return a.(Factory(C).Make)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
return a.(Factory(C).Make)();
|
||||
|
||||
@@ -58,7 +58,7 @@ impl () as C;
|
||||
|
||||
impl library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error(MissingDefinitionInImpl): no definition found for declaration in impl file
|
||||
// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl]
|
||||
// CHECK:STDERR: impl () as C;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -74,7 +74,7 @@ impl library "[[@TEST_NAME]]";
|
||||
|
||||
interface D {};
|
||||
|
||||
// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+3]]:1: error(MissingDefinitionInImpl): no definition found for declaration in impl file
|
||||
// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+3]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl]
|
||||
// CHECK:STDERR: impl () as D;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
impl () as D;
|
||||
|
||||
Reference in New Issue
Block a user