Skip to content

Commit 1dfd519

Browse files
authored
Merge pull request #81083 from hamishknight/add-null-check-6.2
[6.2] [Sema] Add missing null check for Type
2 parents 6716b46 + 726d78d commit 1dfd519

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4703,9 +4703,11 @@ ActorIsolation ActorIsolationChecker::determineClosureIsolation(
47034703

47044704
// `nonisolated(nonsending)` inferred from the context makes
47054705
// the closure caller isolated.
4706-
if (auto *closureTy = getType(closure)->getAs<FunctionType>()) {
4707-
if (closureTy->getIsolation().isNonIsolatedCaller())
4708-
return ActorIsolation::forCallerIsolationInheriting();
4706+
if (auto closureTy = getType(closure)) {
4707+
if (auto *closureFnTy = closureTy->getAs<FunctionType>()) {
4708+
if (closureFnTy->getIsolation().isNonIsolatedCaller())
4709+
return ActorIsolation::forCallerIsolationInheriting();
4710+
}
47094711
}
47104712

47114713
// If a closure has an isolated parameter, it is isolated to that
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// https://github.com/swiftlang/swift/issues/80985
2+
struct S<T> {
3+
func foo<U>(_ fn: (T) -> U) -> S<U> { fatalError() }
4+
}
5+
6+
func foo(xs: S<(Int, Int)>) {
7+
_ = {
8+
let y = xs
9+
.foo{ $1 }
10+
.foo{ $0 }
11+
// RUN: %sourcekitd-test -req=complete -pos=%(line-1):11 %s -- %s
12+
}
13+
}

0 commit comments

Comments
 (0)