Remove The Parser Hack For If-Let

The parser used to rewrite

if let x: T

into

if let x: T?

This transformation is correct at face value, but relied on being able
to construct TypeReprs with bogus source locations. Instead of having
the parser kick semantic analysis into shape, let's perform this
reinterpretation when we resolve if-let patterns in statement
conditions.
This commit is contained in:
Robert Widmann
2020-05-13 10:33:59 -07:00
parent 14ff43e72b
commit 31242bc3da
8 changed files with 29 additions and 28 deletions

View File

@@ -4278,7 +4278,7 @@ SolutionApplicationTarget SolutionApplicationTarget::forInitialization(
bool bindPatternVarsOneWay) {
// Determine the contextual type for the initialization.
TypeLoc contextualType;
if (!isa<OptionalSomePattern>(pattern) &&
if (!(isa<OptionalSomePattern>(pattern) && !pattern->isImplicit()) &&
patternType && !patternType->isHole()) {
contextualType = TypeLoc::withoutLoc(patternType);