mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeSynthesis] Make sure that LazyInitializerExpr has a type
Currently when `LazyInitializerExpr` is added to the AST it's not given an explicit type. Because of that constraint solver silently fails in contraint generator without diagnostic. But since sub-expression associated with `LazyInitializerExpr` is already type-checked it makes sense to set its type explicitly.
This commit is contained in:
@@ -1294,7 +1294,9 @@ static void synthesizeLazyGetterBody(AbstractFunctionDecl *fn, void *context) {
|
||||
// FIXME: we should really have stronger invariants than this. Leaving it
|
||||
// unwrapped may expose both expressions to naive walkers
|
||||
if (wasInitializerChecked) {
|
||||
auto initType = InitValue->getType();
|
||||
InitValue = new (Ctx) LazyInitializerExpr(InitValue);
|
||||
InitValue->setType(initType);
|
||||
}
|
||||
|
||||
Pattern *Tmp2PBDPattern = new (Ctx) NamedPattern(Tmp2VD, /*implicit*/true);
|
||||
|
||||
Reference in New Issue
Block a user