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
+40-36Lines changed: 40 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@ fn F(U:! I where .I1 = .Self) {
93
93
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
94
94
// CHECK:STDERR:
95
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` into type implementing `I where .(I.I1) = U` [ConversionFailureTypeToFacet]
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
97
// CHECK:STDERR: (U as type) as (I where .I1 = U);
98
98
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
99
// CHECK:STDERR:
@@ -113,22 +113,26 @@ fn F(U:! I where .I1 = .Self and .I2 = ()) {
113
113
(U astype) as (I where .I1= .Self);
114
114
}
115
115
116
-
// --- access_through_call_once.carbon
116
+
// --- fail_todo_access_through_call_once.carbon
117
117
library "[[@TEST_NAME]]";
118
118
119
-
// TODO: Merge this test with the one below once it works.
119
+
// TODO: Merge this test with the one below once they both work.
120
120
121
121
interfaceI {
122
122
let X:!type;
123
-
fnG() -> X;
123
+
fnG() -> X*;
124
124
}
125
125
126
-
fnF2[U:! I](V: U) {}
126
+
fnF2[U:! I](V: U*) {}
127
127
128
128
fnF(U:! I where .X= .Self, V: U) {
129
129
// The returned value of `G` type `U` which has access to the methods of `I`.
130
-
U.G().G();
131
-
(U astype).G().G();
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();
132
136
133
137
// The returned value of type `U` can be used as a value of type `U`.
134
138
F2(U.G());
@@ -139,13 +143,13 @@ library "[[@TEST_NAME]]";
139
143
140
144
interfaceI {
141
145
let X:!type;
142
-
fnG() -> X;
146
+
fnG() -> X*;
143
147
}
144
148
145
-
fnF2[U:! I](V: U) {}
146
-
fnF3[U:! I where .X= .Self](V: U) {}
149
+
fnF2[U:! I](V: U*) {}
150
+
fnF3[U:! I where .X= .Self](V: U*) {}
147
151
148
-
fnF(U:! I where .X= .Self, V: U) {
152
+
fnF(U:! I where .X= .Self, V: U*) {
149
153
// The returned value of `G` type `U` which has access to the methods of `I`.
150
154
//
151
155
// TODO: These should work.
@@ -158,24 +162,24 @@ fn F(U:! I where .X = .Self, V: U) {
158
162
// - We could expect that the constant value of the `ImplWitnessAccess` would
159
163
// be the same type that we got for the second lookup.
160
164
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:3: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
161
-
// CHECK:STDERR: U.G().G().G();
162
-
// CHECK:STDERR: ^~~~~~~~~~~
165
+
// CHECK:STDERR: U.G()->G()->G();
166
+
// CHECK:STDERR: ^~~~~~~~~~~~~
163
167
// CHECK:STDERR:
164
-
U.G().G().G();
165
-
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:3: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
166
-
// CHECK:STDERR: (U as type).G().G().G();
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: ^~~~~~~~~~~~~
168
172
// CHECK:STDERR:
169
-
(U astype).G().G().G();
173
+
(U astype).G()->G()->G();
170
174
171
175
// The returned value of type `U` can be used as a value of type `U`.
172
176
//
173
177
// TODO: This should work.
174
178
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
175
-
// CHECK:STDERR: F2(U.G().G().G());
176
-
// CHECK:STDERR: ^~~~~~~~~~~
179
+
// CHECK:STDERR: F2(U.G()->G()->G());
180
+
// CHECK:STDERR: ^~~~~~~~~~~~~
177
181
// CHECK:STDERR:
178
-
F2(U.G().G().G());
182
+
F2(U.G()->G()->G());
179
183
180
184
// The constraints in the type `U` are preserved.
181
185
//
@@ -184,15 +188,15 @@ fn F(U:! I where .X = .Self, V: U) {
184
188
// CHECK:STDERR: F3(U.G());
185
189
// CHECK:STDERR: ^~~~~~~~~
186
190
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE-40]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
187
-
// 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]
@@ -259,22 +263,22 @@ fn F(U:! I where .X = .Self, v: U) {
259
263
260
264
// TODO: This should all work.
261
265
262
-
// 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]
263
-
// CHECK:STDERR: let u: U = v.(I.G)();
264
-
// CHECK:STDERR: ^~~~~~~~~
265
-
// 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]
266
-
// CHECK:STDERR: let u: U = v.(I.G)();
267
-
// CHECK:STDERR: ^~~~~~~~~
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: ^~~~~~~~~
268
272
// CHECK:STDERR:
269
-
let u: U= v.(I.G)();
273
+
let u: U*= v.(I.G)();
270
274
// `u` is a non-type value. Can call methods with `self` through compound
271
275
// member lookup, but can't call methods without `self`. See the
272
276
// `compound_access_through_call.carbon` test for the latter.
273
-
u.(I.G)();
277
+
u->(I.G)();
274
278
275
279
// This is the same as the above, since G() returns a non-type value of type
276
280
// `U`. This works because G has a `self` parameter.
0 commit comments