Skip to content

Commit 167f710

Browse files
committed
test-compound-self
1 parent ba8ed99 commit 167f710

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

toolchain/check/testdata/facet/period_self.carbon

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,25 @@ interface I(T:! Core.Destroy) {}
313313
// The `.Self` can see the LHS of the `where` to know `U` impls Core.Destroy.
314314
fn F(U:! Core.Destroy where .Self impls I(.Self)) {}
315315

316+
// --- fail_todo_compound_lookup_on_returned_period_self_parameter.carbon
317+
library "[[@TEST_NAME]]";
318+
319+
interface I(T:! Core.Destroy) {
320+
fn G[self: Self]() -> T;
321+
}
322+
323+
fn F[U:! Core.Destroy where .Self impls I(.Self)](u: U) {
324+
// This tests that both `I.G` is accessible and that `Destroy` is preserved;
325+
// we'd get an error for missing Destroy otherwise since G() returns an
326+
// initializing expression.
327+
328+
// CHECK:STDERR: fail_todo_compound_lookup_on_returned_period_self_parameter.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I(U as Core.Destroy)` in type `U` that does not implement that interface [MissingImplInMemberAccess]
329+
// CHECK:STDERR: u.(I(U).G)().(I(U).G)().(I(U).G)();
330+
// CHECK:STDERR: ^~~~~~~~~~
331+
// CHECK:STDERR:
332+
u.(I(U).G)().(I(U).G)().(I(U).G)();
333+
}
334+
316335
// CHECK:STDOUT: --- period_self_param.carbon
317336
// CHECK:STDOUT:
318337
// CHECK:STDOUT: constants {

0 commit comments

Comments
 (0)