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
15161516 for (auto *expected : caseStmt->getCaseBodyVariablesOrEmptyArray ()) {
15171517 assert (expected->hasName ());
15181518 auto prev = expected->getParentVarDecl ();
1519- auto type = solution.resolveInterfaceType (solution.getType (prev));
1519+ auto type = solution.resolveInterfaceType (
1520+ solution.getType (prev)->mapTypeOutOfContext ());
15201521 expected->setInterfaceType (type);
15211522 }
15221523
Original file line number Diff line number Diff line change @@ -1349,7 +1349,8 @@ class ClosureConstraintApplication
13491349 for (auto *expected : caseStmt->getCaseBodyVariablesOrEmptyArray ()) {
13501350 assert (expected->hasName ());
13511351 auto prev = expected->getParentVarDecl ();
1352- auto type = solution.resolveInterfaceType (solution.getType (prev));
1352+ auto type = solution.resolveInterfaceType (
1353+ solution.getType (prev)->mapTypeOutOfContext ());
13531354 expected->setInterfaceType (type);
13541355 }
13551356
Original file line number Diff line number Diff line change @@ -1172,3 +1172,15 @@ func test(arr: [[Int]]) {
11721172 arr. map { ( $0 as? [ Int ] ) . map { A ( $0) } } // expected-error {{missing argument label 'arg:' in call}} {{36-36=arg: }}
11731173 // expected-warning@-1 {{conditional cast from '[Int]' to '[Int]' always succeeds}}
11741174}
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