Skip to content

Commit 49ae1c7

Browse files
authored
Merge pull request #41108 from xedin/rdar-88285682
[CSApply] Result coercion check should always use resolved type
2 parents 89bb2b5 + 48ffedd commit 49ae1c7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8802,7 +8802,7 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
88028802
return convertType &&
88038803
!convertType->hasPlaceholder() &&
88048804
!target.isOptionalSomePatternInit() &&
8805-
!(solution.getType(resultExpr)->isUninhabited() &&
8805+
!(solution.getResolvedType(resultExpr)->isUninhabited() &&
88068806
cs.getContextualTypePurpose(target.getAsExpr())
88078807
== CTP_ReturnSingleExpr);
88088808
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
struct S {
4+
func crash() -> Never {
5+
fatalError("")
6+
}
7+
}
8+
9+
class A {
10+
func value() -> Int { 42 }
11+
}
12+
13+
class B : A {
14+
let value: S = S()
15+
16+
func test() throws -> B {
17+
value.crash() // Ok
18+
}
19+
}

0 commit comments

Comments
 (0)