Skip to content

Commit fd9072a

Browse files
committed
compounds
1 parent 3d97c04 commit fd9072a

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

toolchain/check/testdata/facet/access.carbon

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn F(U:! I where .X = .Self) {
150150
F3(U.G().G().G());
151151
}
152152

153-
// --- fail_todo_compound_access_through_call.carbon
153+
// --- fail_compound_access_through_call.carbon
154154
library "[[@TEST_NAME]]";
155155

156156
interface I {
@@ -159,19 +159,18 @@ interface I {
159159
}
160160

161161
fn F(U:! I where .X = .Self) {
162-
// TODO: The return of `I.G()` is a value with type `U` which is constrained
163-
// by `I`. We have access to the methods of `I` through name lookup, but how
164-
// do we get to them with compound member access?
162+
// It's not possible to do compound member lookup here. You'd need
163+
// to work with `U.(I.X)` instead.
165164
// See: https://github.com/carbon-language/carbon-lang/issues/6025
166165
//
167-
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `.Self` into type implementing `I` [ConversionFailureNonTypeToFacet]
168-
// CHECK:STDERR: U.(I.G)().(I.G)().(I.G)();
166+
// CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `.Self` into type implementing `I` [ConversionFailureNonTypeToFacet]
167+
// CHECK:STDERR: U.(I.G)().(I.G)();
169168
// CHECK:STDERR: ^~~~~~~~~~~~~~~
170-
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `.Self` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote]
171-
// CHECK:STDERR: U.(I.G)().(I.G)().(I.G)();
169+
// CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `.Self` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote]
170+
// CHECK:STDERR: U.(I.G)().(I.G)();
172171
// CHECK:STDERR: ^~~~~~~~~~~~~~~
173172
// CHECK:STDERR:
174-
U.(I.G)().(I.G)().(I.G)();
173+
U.(I.G)().(I.G)();
175174
}
176175

177176
// --- fail_non_const_associated.carbon

toolchain/check/testdata/facet/period_self.carbon

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn F(U:! I(.Self) & J(.Self)) {
161161
F2(U.I1().J1().I1().J1().I1().J1());
162162
}
163163

164-
// --- fail_todo_return_of_period_self_impls_interface.carbon
164+
// --- fail_return_of_period_self_impls_interface.carbon
165165
library "[[@TEST_NAME]]";
166166

167167
interface I(T:! type) {
@@ -173,23 +173,15 @@ interface J(T:! type) {
173173
}
174174

175175
fn G(U:! I(.Self) where .Self impls J(.Self)) {
176-
// TODO: U.I1() returns a value of type `U`. How do we call `J.J1` on that? It
177-
// is accessible through non-compound member lookup when `U` extends `J`.
176+
// It's not possible to do compound lookup here. You would have to work with
177+
// the original type `U` instead.
178178
// See: https://github.com/carbon-language/carbon-lang/issues/6025
179179
//
180-
// CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+12]]:11: error: type `<type of J>` does not support qualified expressions [QualifiedExprUnsupported]
181-
// CHECK:STDERR: U.I1().(J.J1)().I1().(J.J1)().I1().(J.J1)();
180+
// CHECK:STDERR: fail_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:11: error: type `<type of J>` does not support qualified expressions [QualifiedExprUnsupported]
181+
// CHECK:STDERR: U.I1().(J.J1)();
182182
// CHECK:STDERR: ^~~~
183183
// CHECK:STDERR:
184-
// CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+8]]:25: error: type `<type of J>` does not support qualified expressions [QualifiedExprUnsupported]
185-
// CHECK:STDERR: U.I1().(J.J1)().I1().(J.J1)().I1().(J.J1)();
186-
// CHECK:STDERR: ^~~~
187-
// CHECK:STDERR:
188-
// CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:39: error: type `<type of J>` does not support qualified expressions [QualifiedExprUnsupported]
189-
// CHECK:STDERR: U.I1().(J.J1)().I1().(J.J1)().I1().(J.J1)();
190-
// CHECK:STDERR: ^~~~
191-
// CHECK:STDERR:
192-
U.I1().(J.J1)().I1().(J.J1)().I1().(J.J1)();
184+
U.I1().(J.J1)();
193185
}
194186

195187
// --- fail_todo_return_of_type_period_self_has_type_u.carbon

0 commit comments

Comments
 (0)