From 8ac0edb280e06cfd1f421ae628b02d527809da18 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 29 Jul 2026 11:18:43 -0400 Subject: [PATCH] Add a failing test where frozen `.Self` is passed in generic argument and never thawed (#7582) --- .../check/testdata/facet/period_self.carbon | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/toolchain/check/testdata/facet/period_self.carbon b/toolchain/check/testdata/facet/period_self.carbon index 20604855a5b6..a4a564cb6e75 100644 --- a/toolchain/check/testdata/facet/period_self.carbon +++ b/toolchain/check/testdata/facet/period_self.carbon @@ -800,6 +800,28 @@ interface Z(T: type); // CHECK:STDERR: fn F(generic _: C(Z(.Self))) {} +// --- fail_todo_period_self_in_generic_argument.carbon +library "[[@TEST_NAME]]"; + +interface Z { + let Z1: type; +} +interface Y(T: type) { + // The type here is `Z where .Z1 = ()` with a thawed `.Self` in the access of `.Z1`. + let Y1: Z where .Z1 = (); + // The type here ends up being `Z where .Z1 = ()` with a frozen `.Self` in the + // access of `.Z1`. So it can't convert to the type of `Y1`, which is a bug. + eval fn YF() -> T; +} + +// TODO: We crash if this impl is not generic, as the call to `.YF()` produces a +// symbolic-dependent instruction, but there's no generic eval block for it. +// CHECK:STDERR: fail_todo_period_self_in_generic_argument.carbon:[[@LINE+4]]:60: error: cannot convert type `` that implements `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: impl forall [T: type] T as Y(Z where .Z1 = ()) where .Y1 = .YF() {} +// CHECK:STDERR: ^~~~~ +// CHECK:STDERR: +impl forall [T: type] T as Y(Z where .Z1 = ()) where .Y1 = .YF() {} + // CHECK:STDOUT: --- period_self_param.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants {