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
+19-4Lines changed: 19 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -108,10 +108,10 @@ interface I {
108
108
fnG() -> X;
109
109
}
110
110
111
-
fnF2[U:! I](T: U) {}
112
-
fnF3[U:! I where .X= .Self](T: U) {}
111
+
fnF2[U:! I](V: U) {}
112
+
fnF3[U:! I where .X= .Self](V: U) {}
113
113
114
-
fnF(U:! I where .X= .Self) {
114
+
fnF(U:! I where .X= .Self, V: U) {
115
115
// The returned value of `G` type `U` which has access to the methods of `I`.
116
116
//
117
117
// TODO: This works but a chained third call doesn't.
@@ -129,20 +129,35 @@ fn F(U:! I where .X = .Self) {
129
129
// CHECK:STDERR: ^~~~~~~~~~~
130
130
// CHECK:STDERR:
131
131
U.G().G().G();
132
+
// TODO: This works but a chained third call doesn't.
133
+
(U astype).G().G();
132
134
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:3: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
133
135
// CHECK:STDERR: (U as type).G().G().G();
134
136
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
135
137
// CHECK:STDERR:
136
138
(U astype).G().G().G();
137
139
138
140
// The returned value of type `U` can be used as a value of type `U`.
141
+
//
142
+
// TODO: This works but a chaining calls to G doesn't.
143
+
F2(U.G());
139
144
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
140
145
// CHECK:STDERR: F2(U.G().G().G());
141
146
// CHECK:STDERR: ^~~~~~~~~~~
142
147
// CHECK:STDERR:
143
148
F2(U.G().G().G());
144
149
145
-
// TODO: The constraints in the type `U` are preserved.
150
+
// The constraints in the type `U` are preserved.
151
+
//
152
+
// TODO: These should work.
153
+
// 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]
154
+
// CHECK:STDERR: F3(U.G());
155
+
// CHECK:STDERR: ^~~~~~~~~
156
+
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE-44]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
157
+
// 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]
0 commit comments