mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Set the interface type of lazy properties during validation.
Otherwise, we end up treating the contextual type as the interface type in situations where the lazy property is seen from other files. Fixes SR-837.
This commit is contained in:
@@ -1581,10 +1581,12 @@ void TypeChecker::completeLazyVarImplementation(VarDecl *VD) {
|
||||
NameBuf += ".storage";
|
||||
auto StorageName = Context.getIdentifier(NameBuf);
|
||||
auto StorageTy = OptionalType::get(VD->getType());
|
||||
auto StorageInterfaceTy = OptionalType::get(VD->getInterfaceType());
|
||||
|
||||
auto *Storage = new (Context) VarDecl(/*isStatic*/false, /*isLet*/false,
|
||||
VD->getLoc(), StorageName, StorageTy,
|
||||
VD->getDeclContext());
|
||||
Storage->setInterfaceType(StorageInterfaceTy);
|
||||
Storage->setUserAccessible(false);
|
||||
addMemberToContextIfNeeded(Storage, VD->getDeclContext(), VD);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user