mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Remove stored TypeLoc from TypedPattern (#19175)
* [AST] Remove stored TypeLoc from TypedPattern TypedPattern was only using this TypeLoc as a means to a TypeRepr, which caused it to store the pattern type twice (through the superclass and through the TypeLoc itself.) This also fixes a bug where deserializing a TypedPattern doesn't store the type correctly and generally cleans up TypedPattern initialization. Resolves rdar://44144435 * Address review comments
This commit is contained in:
@@ -381,9 +381,11 @@ Expected<Pattern *> ModuleFile::readPattern(DeclContext *owningDC) {
|
||||
return subPattern;
|
||||
}
|
||||
|
||||
auto result = new (getContext()) TypedPattern(subPattern.get(), TypeLoc(),
|
||||
auto type = getType(typeID);
|
||||
auto result = new (getContext()) TypedPattern(subPattern.get(),
|
||||
/*typeRepr*/nullptr,
|
||||
isImplicit);
|
||||
recordPatternType(result, getType(typeID));
|
||||
recordPatternType(result, type);
|
||||
restoreOffset.reset();
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user