Skip to content

Commit 644e073

Browse files
committed
add-test
1 parent 888de54 commit 644e073

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

toolchain/check/testdata/builtins/type/can_destroy.carbon

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@ fn G() {
3838
//@dump-sem-ir-end
3939
}
4040

41+
// --- symbolic.carbon
42+
library "[[@TEST_NAME]]";
43+
44+
interface Z {}
45+
46+
fn CanDestroy() -> type = "type.can_destroy";
47+
48+
fn G(U:! CanDestroy()) {}
49+
50+
fn F(T:! Z & CanDestroy()) {
51+
// Requires a conversion (and thus impl lookup into `T`) since `T` and `U`
52+
// have different (but compatible) facet types.
53+
// CHECK:STDERR: symbolic.carbon:[[@LINE+7]]:3: error: cannot convert type `T` that implements `Z where .Self impls Core.CanDestroy` into type implementing `type where .Self impls Core.CanDestroy` [ConversionFailureFacetToFacet]
54+
// CHECK:STDERR: G(T);
55+
// CHECK:STDERR: ^~~~
56+
// CHECK:STDERR: symbolic.carbon:[[@LINE-8]]:6: note: initializing generic parameter `U` declared here [InitializingGenericParam]
57+
// CHECK:STDERR: fn G(U:! CanDestroy()) {}
58+
// CHECK:STDERR: ^
59+
// CHECK:STDERR:
60+
G(T);
61+
}
62+
4163
// --- fail_incomplete.carbon
4264
library "[[@TEST_NAME]]";
4365

0 commit comments

Comments
 (0)