File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1516,7 +1516,8 @@ class BuilderClosureRewriter
1516
1516
for (auto *expected : caseStmt->getCaseBodyVariablesOrEmptyArray ()) {
1517
1517
assert (expected->hasName ());
1518
1518
auto prev = expected->getParentVarDecl ();
1519
- auto type = solution.resolveInterfaceType (solution.getType (prev));
1519
+ auto type = solution.resolveInterfaceType (
1520
+ solution.getType (prev)->mapTypeOutOfContext ());
1520
1521
expected->setInterfaceType (type);
1521
1522
}
1522
1523
Original file line number Diff line number Diff line change @@ -1349,7 +1349,8 @@ class ClosureConstraintApplication
1349
1349
for (auto *expected : caseStmt->getCaseBodyVariablesOrEmptyArray ()) {
1350
1350
assert (expected->hasName ());
1351
1351
auto prev = expected->getParentVarDecl ();
1352
- auto type = solution.resolveInterfaceType (solution.getType (prev));
1352
+ auto type = solution.resolveInterfaceType (
1353
+ solution.getType (prev)->mapTypeOutOfContext ());
1353
1354
expected->setInterfaceType (type);
1354
1355
}
1355
1356
Original file line number Diff line number Diff line change @@ -1172,3 +1172,15 @@ func test(arr: [[Int]]) {
1172
1172
arr. map { ( $0 as? [ Int ] ) . map { A ( $0) } } // expected-error {{missing argument label 'arg:' in call}} {{36-36=arg: }}
1173
1173
// expected-warning@-1 {{conditional cast from '[Int]' to '[Int]' always succeeds}}
1174
1174
}
1175
+
1176
+ func closureWithCaseArchetype< T> ( _: T . Type) {
1177
+ let _ = { ( any: Any) throws -> Any ? in
1178
+ switch any {
1179
+ case let type as T :
1180
+ return type
1181
+
1182
+ default :
1183
+ return any
1184
+ }
1185
+ }
1186
+ }
You can’t perform that action at this time.
0 commit comments