Files
swift-mirror/test/Parse/try_swift5.swift
Slava Pestov 48e89f40d7 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>.
2018-12-15 01:29:07 -05:00

16 KiB