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/period_self.carbon
+37-26Lines changed: 37 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -243,9 +243,10 @@ interface I(T:! type) {
243
243
fnG() -> T;
244
244
}
245
245
246
-
// The first `.Self` refers to `T`. The second `.Self` is not attached to a
247
-
// facet value until later.
248
-
fnF(T:!I(.Self) where .A= ((I(.Self) where .B= {}) where .A= {})) {
246
+
// Both `.Self` refer to `T`. The first because it's the interface for the
247
+
// binding. The second because it refers to the top level facet type which is
248
+
// constraining the binding.
249
+
fnF(T:!I(.Self) where .A= ((I(.Self) where .B= {}) where .A= {}) and .B= {}, U:! T.A) {
249
250
// T.G() has type T.
250
251
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `T` [ConversionFailure]
251
252
// CHECK:STDERR: let t: T = T.G();
@@ -255,31 +256,41 @@ fn F(T:! I(.Self) where .A = ((I(.Self) where .B = {}) where .A = {})) {
255
256
// CHECK:STDERR: ^~~~~
256
257
// CHECK:STDERR:
257
258
let t: T= T.G();
258
-
// The second `.Self` now refers to `U`.
259
-
fnF2(U:! T.A) {
260
-
// U.G() has type U.
261
-
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:16: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure]
262
-
// CHECK:STDERR: let u: U = U.G();
263
-
// CHECK:STDERR: ^~~~~
264
-
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:16: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessNote]
265
-
// CHECK:STDERR: let u: U = U.G();
266
-
// CHECK:STDERR: ^~~~~
267
-
// CHECK:STDERR:
268
-
let u: U= U.G();
269
-
270
-
fnF3(V:!I(T) where .A= (I(U) where .A={} and .B= {})) {
271
-
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:7: error: cannot convert type `V` that implements `I(T) where .(I(T).A) = I(U) where .(I(U).A) = {} and .(I(U).B) = {}` into type implementing `I(.Self) where .(I(.Self).A) = I(.Self) where .(I(.Self).B) = {} and .(I(.Self).A) = {}` [ConversionFailureFacetToFacet]
272
-
// CHECK:STDERR: F(V);
273
-
// CHECK:STDERR: ^~~~
274
-
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE-26]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
275
-
// CHECK:STDERR: fn F(T:! I(.Self) where .A = ((I(.Self) where .B = {}) where .A = {})) {
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `T` [ConversionFailure]
261
+
// CHECK:STDERR: let u: T = U.G();
262
+
// CHECK:STDERR: ^~~~~
263
+
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessNote]
264
+
// CHECK:STDERR: let u: T = U.G();
265
+
// CHECK:STDERR: ^~~~~
266
+
// CHECK:STDERR:
267
+
let u: T= U.G();
268
+
269
+
// Shows both `I(.Self)` are `I(T)`.
270
+
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:9: error: found cycle in facet type constraint for `.(I(T).A)` [FacetTypeConstraintCycle]
271
+
// CHECK:STDERR: T as (I(T) where .A = (I(T) where .A = {} and .B = {}));
T as (I(T) where .A= (I(T) where .A= {} and .B= {}));
275
+
// CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:3: error: cannot convert type `U` that implements `I(.Self) where .(I(.Self).B) = {} and .(I(.Self).A) = {}` into type implementing `I(T) where .(I(T).A) = {} and .(I(T).B) = {}` [ConversionFailureFacetToFacet]
276
+
// CHECK:STDERR: U as (I(T) where .A ={} and .B = {});
0 commit comments