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
// CHECK:STDERR: fail_todo_convert_from_period_self_to_full_facet_value.carbon:[[@LINE+4]]:3: error: cannot convert type `U` that implements `I where .(I.I1) = .Self` into type implementing `I where .(I.I1) = U` [ConversionFailureFacetToFacet]
92
+
// CHECK:STDERR: U as (I where .I1 = U);
93
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
94
+
// CHECK:STDERR:
95
+
U as (I where .I1= U);
96
+
// CHECK:STDERR: fail_todo_convert_from_period_self_to_full_facet_value.carbon:[[@LINE+4]]:3: error: cannot convert type `U` that implements `I where .(I.I1) = .Self` into type implementing `I where .(I.I1) = U` [ConversionFailureFacetToFacet]
97
+
// CHECK:STDERR: (U as type) as (I where .I1 = U);
98
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
+
// CHECK:STDERR:
100
+
(U astype) as (I where .I1= U);
101
+
}
102
+
103
+
// --- convert_to_period_self.carbon
104
+
library "[[@TEST_NAME]]";
105
+
106
+
interfaceI {
107
+
let I1:!type;
108
+
let I2:!type;
109
+
}
110
+
111
+
fnF(U:! I where .I1= .Self and .I2= ()) {
112
+
U as (I where .I1= .Self);
113
+
(U astype) as (I where .I1= .Self);
114
+
}
115
+
116
+
// --- fail_todo_access_through_call_once.carbon
117
+
library "[[@TEST_NAME]]";
118
+
119
+
// TODO: Merge this test with the one below once they both work.
120
+
121
+
interfaceI {
122
+
let X:!type;
123
+
fnG() -> X*;
124
+
}
125
+
126
+
fnF2[U:! I](V: U*) {}
127
+
128
+
fnF(U:! I where .X= .Self, V: U) {
129
+
// The returned value of `G` type `U` which has access to the methods of `I`.
130
+
U.G()->G();
131
+
// CHECK:STDERR: fail_todo_access_through_call_once.carbon:[[@LINE+4]]:3: error: type `type` does not support qualified expressions [QualifiedExprUnsupported]
132
+
// CHECK:STDERR: (U as type).G()->G();
133
+
// CHECK:STDERR: ^~~~~~~~~~~~~
134
+
// CHECK:STDERR:
135
+
(U astype).G()->G();
136
+
137
+
// The returned value of type `U` can be used as a value of type `U`.
138
+
F2(U.G());
139
+
}
140
+
141
+
// --- fail_todo_access_through_call.carbon
142
+
library "[[@TEST_NAME]]";
143
+
144
+
interfaceI {
145
+
let X:!type;
146
+
fnG() -> X*;
147
+
}
148
+
149
+
fnF2[U:! I](V: U*) {}
150
+
fnF3[U:! I where .X= .Self](V: U*) {}
151
+
152
+
fnF(U:! I where .X= .Self, V: U*) {
153
+
// The returned value of `G` type `U` which has access to the methods of `I`.
154
+
//
155
+
// TODO: These should work.
156
+
// - The first `.` is on a NameRef of type FacetType for `I where .X = .Self`.
157
+
// - This finds `G` through the FacetType.
158
+
// - The second `.` is on a Call of type FacetAccessType into `BindSymbolicName` with type FacetType for `I`.
159
+
// - This finds `G` through the FacetType (impl lookup strips off FacetAccessType).
160
+
// - The third `.` is on a Call of type FacetAccessType into `ImplWitnessAccess` of `I.X` into `LookupImplWitness`, which has type `type`
161
+
// - Can't make calls on an `ImplWitnessAccess`.
162
+
// - We could expect that the constant value of the `ImplWitnessAccess` would
163
+
// be the same type that we got for the second lookup.
164
+
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:3: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
165
+
// CHECK:STDERR: U.G()->G()->G();
166
+
// CHECK:STDERR: ^~~~~~~~~~~~~
167
+
// CHECK:STDERR:
168
+
U.G()->G()->G();
169
+
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:3: error: type `type` does not support qualified expressions [QualifiedExprUnsupported]
170
+
// CHECK:STDERR: (U as type).G()->G()->G();
171
+
// CHECK:STDERR: ^~~~~~~~~~~~~
172
+
// CHECK:STDERR:
173
+
(U astype).G()->G()->G();
174
+
175
+
// The returned value of type `U` can be used as a value of type `U`.
176
+
//
177
+
// TODO: This should work.
178
+
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
179
+
// CHECK:STDERR: F2(U.G()->G()->G());
180
+
// CHECK:STDERR: ^~~~~~~~~~~~~
181
+
// CHECK:STDERR:
182
+
F2(U.G()->G()->G());
183
+
184
+
// The constraints in the type `U` are preserved.
185
+
//
186
+
// TODO: These should work.
187
+
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+7]]:3: error: cannot convert type `.Self` that implements `I` into type implementing `I where .(I.X) = .Self` [ConversionFailureFacetToFacet]
188
+
// CHECK:STDERR: F3(U.G());
189
+
// CHECK:STDERR: ^~~~~~~~~
190
+
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE-40]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
191
+
// CHECK:STDERR: fn F3[U:! I where .X = .Self](V: U*) {}
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure]
219
+
// CHECK:STDERR: let u: U = U.(I.G)();
220
+
// CHECK:STDERR: ^~~~~~~~~
221
+
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote]
222
+
// CHECK:STDERR: let u: U = U.(I.G)();
223
+
// CHECK:STDERR: ^~~~~~~~~
224
+
// CHECK:STDERR:
225
+
let u: U= U.(I.G)();
226
+
// `u` is a non-type value. Can call methods with `self` through compound
227
+
// member lookup, but can't call methods without `self`. See the
228
+
// `compound_access_through_call_with_self_param.carbon` test for the former.
229
+
//
230
+
// 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]
231
+
// CHECK:STDERR: u.(I.G)();
232
+
// CHECK:STDERR: ^~~~~~~
233
+
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote]
234
+
// CHECK:STDERR: u.(I.G)();
235
+
// CHECK:STDERR: ^~~~~~~
236
+
// CHECK:STDERR:
237
+
u.(I.G)();
238
+
239
+
// This is the same as the above, since G() returns a non-type value of type
240
+
// `U`.
241
+
//
242
+
// 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]
243
+
// CHECK:STDERR: U.(I.G)().(I.G)();
244
+
// CHECK:STDERR: ^~~~~~~~~~~~~~~
245
+
// CHECK:STDERR: fail_todo_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `.Self` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessNote]
// Compound member lookup through a non-type value is possible for methods
262
+
// which take a `self` parameter.
263
+
264
+
// TODO: This should all work.
265
+
266
+
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+7]]:15: error: cannot implicitly convert expression of type `.Self*` to `U*` [ConversionFailure]
267
+
// CHECK:STDERR: let u: U* = v.(I.G)();
268
+
// CHECK:STDERR: ^~~~~~~~~
269
+
// CHECK:STDERR: fail_todo_compound_access_through_call_with_self_param.carbon:[[@LINE+4]]:15: note: type `.Self*` does not implement interface `Core.ImplicitAs(U*)` [MissingImplInMemberAccessNote]
270
+
// CHECK:STDERR: let u: U* = v.(I.G)();
271
+
// CHECK:STDERR: ^~~~~~~~~
272
+
// CHECK:STDERR:
273
+
let u: U*= v.(I.G)();
274
+
// `u` is a non-type value. Can call methods with `self` through compound
275
+
// member lookup, but can't call methods without `self`. See the
276
+
// `compound_access_through_call.carbon` test for the latter.
277
+
u->(I.G)();
278
+
279
+
// This is the same as the above, since G() returns a non-type value of type
280
+
// `U`. This works because G has a `self` parameter.
0 commit comments