Skip to content

Commit 0984180

Browse files
authored
Merge pull request #41109 from xedin/rdar-88285682-5.6
[5.6][CSApply] Result coercion check should always use resolved type
2 parents 492ecea + 04ec6a9 commit 0984180

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
@@ -8695,7 +8695,7 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
86958695
return convertType &&
86968696
!convertType->hasPlaceholder() &&
86978697
!target.isOptionalSomePatternInit() &&
8698-
!(solution.getType(resultExpr)->isUninhabited() &&
8698+
!(solution.getResolvedType(resultExpr)->isUninhabited() &&
86998699
cs.getContextualTypePurpose(target.getAsExpr())
87008700
== CTP_ReturnSingleExpr);
87018701
};
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)