Skip to content

Commit 1af98f7

Browse files
authored
Merge pull request swiftlang#81025 from hamishknight/add-null-check
[Sema] Add missing null check for Type
2 parents b4b93ef + 54e0607 commit 1af98f7

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
@@ -4700,9 +4700,11 @@ ActorIsolation ActorIsolationChecker::determineClosureIsolation(
47004700

47014701
// `nonisolated(nonsending)` inferred from the context makes
47024702
// the closure caller isolated.
4703-
if (auto *closureTy = getType(closure)->getAs<FunctionType>()) {
4704-
if (closureTy->getIsolation().isNonIsolatedCaller())
4705-
return ActorIsolation::forCallerIsolationInheriting();
4703+
if (auto closureTy = getType(closure)) {
4704+
if (auto *closureFnTy = closureTy->getAs<FunctionType>()) {
4705+
if (closureFnTy->getIsolation().isNonIsolatedCaller())
4706+
return ActorIsolation::forCallerIsolationInheriting();
4707+
}
47064708
}
47074709

47084710
// 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)