You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: toolchain/check/testdata/facet/access.carbon
+18-26Lines changed: 18 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -210,11 +210,14 @@ fn F(U:! I where .X = .Self) {
210
210
// member lookup, but can't call methods without `self`. See the
211
211
// `compound_access_through_call_with_self_param.carbon` test for the former.
212
212
//
213
-
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:6: error: value of type `<associated entity in I>` is not callable [CallToNonCallable]
214
-
// CHECK:STDERR: u.(I.G());
215
-
// CHECK:STDERR: ^~~~~
213
+
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet]
214
+
// CHECK:STDERR: u.(I.G)();
215
+
// CHECK:STDERR: ^~~~~~~
216
+
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote]
217
+
// CHECK:STDERR: u.(I.G)();
218
+
// CHECK:STDERR: ^~~~~~~
216
219
// CHECK:STDERR:
217
-
u.(I.G());
220
+
u.(I.G)();
218
221
219
222
// This is the same as the above, since G() returns a non-type value of type
220
223
// `U`.
@@ -237,39 +240,28 @@ interface I {
237
240
fn G[self: Self]() -> X;
238
241
}
239
242
240
-
fnF(U:! I where .X= .Self) {
243
+
fnF(U:! I where .X= .Self, v: U) {
241
244
// Compound member lookup through a non-type value is possible for methods
242
245
// which take a `self` parameter.
243
246
244
247
// TODO: This should all work.
245
248
246
-
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:14: error: cannot access member of interface `I` in type `I where .(I.X) = .Self` that does not implement that interface [MissingImplInMemberAccess]
247
-
// CHECK:STDERR: let u: U = U.(I.G)();
248
-
// CHECK:STDERR: ^~~~~~~
249
+
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure]
250
+
// CHECK:STDERR: let u: U = v.(I.G)();
251
+
// CHECK:STDERR: ^~~~~~~~~
252
+
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote]
253
+
// CHECK:STDERR: let u: U = v.(I.G)();
254
+
// CHECK:STDERR: ^~~~~~~~~
249
255
// CHECK:STDERR:
250
-
let u: U=U.(I.G)();
256
+
let u: U=v.(I.G)();
251
257
// `u` is a non-type value. Can call methods with `self` through compound
252
258
// member lookup, but can't call methods without `self`. See the
253
259
// `compound_access_through_call.carbon` test for the latter.
254
-
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:6: error: member name `G2` not found in `I` [MemberNameNotFoundInInstScope]
255
-
// CHECK:STDERR: u.(I.G2());
256
-
// CHECK:STDERR: ^~~~
257
-
// CHECK:STDERR:
258
-
u.(I.G2());
260
+
u.(I.G)();
259
261
260
262
// This is the same as the above, since G() returns a non-type value of type
261
-
// `U`.
262
-
//
263
-
// This works because G2 has a `self` parameter.
264
-
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+8]]:3: error: cannot access member of interface `I` in type `I where .(I.X) = .Self` that does not implement that interface [MissingImplInMemberAccess]
265
-
// CHECK:STDERR: U.(I.G)().(I.G2)();
266
-
// CHECK:STDERR: ^~~~~~~
267
-
// CHECK:STDERR:
268
-
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:14: error: member name `G2` not found in `I` [MemberNameNotFoundInInstScope]
269
-
// CHECK:STDERR: U.(I.G)().(I.G2)();
270
-
// CHECK:STDERR: ^~~~
271
-
// CHECK:STDERR:
272
-
U.(I.G)().(I.G2)();
263
+
// `U`. This works because G has a `self` parameter.
0 commit comments