Skip to content

Commit a3556b2

Browse files
committed
review
1 parent b63fa6e commit a3556b2

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

toolchain/check/testdata/facet/access.carbon

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ interface I {
108108
fn G() -> X;
109109
}
110110

111-
fn F2[U:! I](T: U) {}
112-
fn F3[U:! I where .X = .Self](T: U) {}
111+
fn F2[U:! I](V: U) {}
112+
fn F3[U:! I where .X = .Self](V: U) {}
113113

114-
fn F(U:! I where .X = .Self) {
114+
fn F(U:! I where .X = .Self, V: U) {
115115
// The returned value of `G` type `U` which has access to the methods of `I`.
116116
//
117117
// TODO: This works but a chained third call doesn't.
@@ -129,20 +129,35 @@ fn F(U:! I where .X = .Self) {
129129
// CHECK:STDERR: ^~~~~~~~~~~
130130
// CHECK:STDERR:
131131
U.G().G().G();
132+
// TODO: This works but a chained third call doesn't.
133+
(U as type).G().G();
132134
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:3: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
133135
// CHECK:STDERR: (U as type).G().G().G();
134136
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
135137
// CHECK:STDERR:
136138
(U as type).G().G().G();
137139

138140
// 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());
139144
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
140145
// CHECK:STDERR: F2(U.G().G().G());
141146
// CHECK:STDERR: ^~~~~~~~~~~
142147
// CHECK:STDERR:
143148
F2(U.G().G().G());
144149

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) {}
158+
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159+
// CHECK:STDERR:
160+
F3(U.G());
146161
// CHECK:STDERR: fail_todo_access_through_call.carbon:[[@LINE+4]]:6: error: type `.(I.X)` does not support qualified expressions [QualifiedExprUnsupported]
147162
// CHECK:STDERR: F3(U.G().G().G());
148163
// CHECK:STDERR: ^~~~~~~~~~~

0 commit comments

Comments
 (0)