Skip to content

Commit 06fe371

Browse files
committed
apply-core-destroy
1 parent 6e3bc59 commit 06fe371

File tree

3 files changed

+142
-139
lines changed

3 files changed

+142
-139
lines changed

toolchain/check/testdata/facet/access.carbon

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn F(U:! I where .I1 = .Self) {
9393
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
9494
// CHECK:STDERR:
9595
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]
9797
// CHECK:STDERR: (U as type) as (I where .I1 = U);
9898
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9999
// CHECK:STDERR:
@@ -113,22 +113,26 @@ fn F(U:! I where .I1 = .Self and .I2 = ()) {
113113
(U as type) as (I where .I1 = .Self);
114114
}
115115

116-
// --- access_through_call_once.carbon
116+
// --- fail_todo_access_through_call_once.carbon
117117
library "[[@TEST_NAME]]";
118118

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.
120120

121121
interface I {
122122
let X:! type;
123-
fn G() -> X;
123+
fn G() -> X*;
124124
}
125125

126-
fn F2[U:! I](V: U) {}
126+
fn F2[U:! I](V: U*) {}
127127

128128
fn F(U:! I where .X = .Self, V: U) {
129129
// The returned value of `G` type `U` which has access to the methods of `I`.
130-
U.G().G();
131-
(U as type).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 as type).G()->G();
132136

133137
// The returned value of type `U` can be used as a value of type `U`.
134138
F2(U.G());
@@ -139,13 +143,13 @@ library "[[@TEST_NAME]]";
139143

140144
interface I {
141145
let X:! type;
142-
fn G() -> X;
146+
fn G() -> X*;
143147
}
144148

145-
fn F2[U:! I](V: U) {}
146-
fn F3[U:! I where .X = .Self](V: U) {}
149+
fn F2[U:! I](V: U*) {}
150+
fn F3[U:! I where .X = .Self](V: U*) {}
147151

148-
fn F(U:! I where .X = .Self, V: U) {
152+
fn F(U:! I where .X = .Self, V: U*) {
149153
// The returned value of `G` type `U` which has access to the methods of `I`.
150154
//
151155
// TODO: These should work.
@@ -158,24 +162,24 @@ fn F(U:! I where .X = .Self, V: U) {
158162
// - We could expect that the constant value of the `ImplWitnessAccess` would
159163
// be the same type that we got for the second lookup.
160164
// 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: ^~~~~~~~~~~~~
163167
// 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: ^~~~~~~~~~~~~
168172
// CHECK:STDERR:
169-
(U as type).G().G().G();
173+
(U as type).G()->G()->G();
170174

171175
// The returned value of type `U` can be used as a value of type `U`.
172176
//
173177
// TODO: This should work.
174178
// 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: ^~~~~~~~~~~~~
177181
// CHECK:STDERR:
178-
F2(U.G().G().G());
182+
F2(U.G()->G()->G());
179183

180184
// The constraints in the type `U` are preserved.
181185
//
@@ -184,15 +188,15 @@ fn F(U:! I where .X = .Self, V: U) {
184188
// CHECK:STDERR: F3(U.G());
185189
// CHECK:STDERR: ^~~~~~~~~
186190
// 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) {}
188-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191+
// CHECK:STDERR: fn F3[U:! I where .X = .Self](V: U*) {}
192+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
189193
// CHECK:STDERR:
190194
F3(U.G());
191195
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
192-
// CHECK:STDERR: F3(U.G().G().G());
193-
// CHECK:STDERR: ^~~~~~~~~~~
196+
// CHECK:STDERR: F3(U.G()->G()->G());
197+
// CHECK:STDERR: ^~~~~~~~~~~~~
194198
// CHECK:STDERR:
195-
F3(U.G().G().G());
199+
F3(U.G()->G()->G());
196200
}
197201

198202
// --- fail_todo_compound_access_through_call.carbon
@@ -250,7 +254,7 @@ library "[[@TEST_NAME]]";
250254

251255
interface I {
252256
let X:! type;
253-
fn G[self: Self]() -> X;
257+
fn G[self: Self]() -> X*;
254258
}
255259

256260
fn F(U:! I where .X = .Self, v: U) {
@@ -259,22 +263,22 @@ fn F(U:! I where .X = .Self, v: U) {
259263

260264
// TODO: This should all work.
261265

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: ^~~~~~~~~
268272
// CHECK:STDERR:
269-
let u: U = v.(I.G)();
273+
let u: U* = v.(I.G)();
270274
// `u` is a non-type value. Can call methods with `self` through compound
271275
// member lookup, but can't call methods without `self`. See the
272276
// `compound_access_through_call.carbon` test for the latter.
273-
u.(I.G)();
277+
u->(I.G)();
274278

275279
// This is the same as the above, since G() returns a non-type value of type
276280
// `U`. This works because G has a `self` parameter.
277-
v.(I.G)().(I.G)();
281+
v.(I.G)()->(I.G)();
278282
}
279283

280284
// --- fail_non_const_associated.carbon

0 commit comments

Comments
 (0)