mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user