swift
0b831cac - Sema: Fix applying solution for OptionalTryExpr

Commit
6 years ago
Sema: Fix applying solution for OptionalTryExpr 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>.
Author
Committer
Parents
Loading