mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Include the arguments for a generic class or interface in diagnostics. (#4511)
This can lead to us trying and failing to print certain kinds of constant value, but we can fix that in future changes. Note that `StringifyType` should probably be substantially refactored. For this change I'm trying to leave the overall structure relatively intact, but hopefully this additional formatting support will help guide future refactorings.
This commit is contained in:
@@ -15,7 +15,7 @@ library "[[@TEST_NAME]]";
|
||||
// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+7]]:13: error: cannot implicitly convert from `bool` to `type` [ImplicitAsConversionFailure]
|
||||
// CHECK:STDERR: impl i32 as false {}
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+4]]:13: note: type `bool` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+4]]:13: note: type `bool` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: impl i32 as false {}
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
|
||||
@@ -17,7 +17,7 @@ interface I { let T:! type; }
|
||||
// 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: type `type` does not implement interface `ImplicitAs` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: fail_todo_impl_assoc_const.carbon:[[@LINE+3]]:27: note: type `type` does not implement interface `ImplicitAs(<associated type in I>)` [MissingImplInMemberAccessNote]
|
||||
// CHECK:STDERR: impl bool as I where .T = bool {}
|
||||
// CHECK:STDERR: ^~~~
|
||||
impl bool as I where .T = bool {}
|
||||
|
||||
+1
-1
@@ -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: cannot access member of interface `HasF` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: fail_inconsistent_deduction.carbon:[[@LINE+3]]:3: error: cannot access member of interface `HasF(B)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: x.(HasF(B).F)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
x.(HasF(B).F)();
|
||||
|
||||
@@ -99,7 +99,7 @@ import HasExtraInterfaces;
|
||||
fn Test(c: HasExtraInterfaces.C(type)) {
|
||||
// This triggers the import of a bunch more interfaces, which reallocates the
|
||||
// interface ValueStore. Ensure that doesn't result in a use-after-free crash.
|
||||
// CHECK:STDERR: fail_use_has_extra_interfaces.carbon:[[@LINE+3]]:3: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: fail_use_has_extra_interfaces.carbon:[[@LINE+3]]:3: error: cannot access member of interface `I` in type `C(type)` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: c.(HasExtraInterfaces.I.F)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
c.(HasExtraInterfaces.I.F)();
|
||||
|
||||
@@ -28,7 +28,7 @@ impl forall [T:! type] C as I(T) {}
|
||||
|
||||
impl library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+7]]:1: error: redefinition of `impl C as I` [ImplRedefinition]
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+7]]:1: error: redefinition of `impl C as I(T*)` [ImplRedefinition]
|
||||
// CHECK:STDERR: impl forall [T:! type] C as I(T*) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE-5]]:6: in import [InImport]
|
||||
|
||||
@@ -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: cannot access member of interface `Action` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action(C)` 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: cannot access member of interface `Factory` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: return a.(Factory(C).Make)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
return a.(Factory(C).Make)();
|
||||
|
||||
Reference in New Issue
Block a user