mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In Swift 5 mode, CSGen generates a conversion constraint from the type of OptionalTryExpr's subexpression, call it T, and Optional<$tv> for a new type variable $tv. When applying the solution, we would coerce the sub-expression to T? if T was not optional, or T otherwise. This was wrong because there's no reason that $tv is actually equal to T. Instead, we must coerce the sub-expression to Optional<$tv>, which is the type of the overall OptionalTryExpr. Fixes <rdar://problem/46742002>.
16 KiB
16 KiB