Skip to content

Commit 4aa18db

Browse files
committed
Sema: Remove obsolete hack related to generic lazy getters
1 parent c3ce3eb commit 4aa18db

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,6 @@ static AccessorDecl *createGetterPrototype(AbstractStorageDecl *storage,
16331633
ASTContext &ctx) {
16341634
SourceLoc loc = storage->getLoc();
16351635

1636-
GenericEnvironment *genericEnvironmentOfLazyAccessor = nullptr;
1637-
16381636
ParamDecl *selfDecl = nullptr;
16391637
if (storage->getDeclContext()->isTypeContext()) {
16401638
if (storage->getAttrs().hasAttribute<LazyAttr>()) {
@@ -1645,8 +1643,6 @@ static AccessorDecl *createGetterPrototype(AbstractStorageDecl *storage,
16451643
bindingDecl->getPatternEntryForVarDecl(varDecl).getInitContext());
16461644

16471645
selfDecl = bindingInit->getImplicitSelfDecl();
1648-
genericEnvironmentOfLazyAccessor =
1649-
bindingInit->getGenericEnvironmentOfContext();
16501646
}
16511647
}
16521648

@@ -1675,18 +1671,6 @@ static AccessorDecl *createGetterPrototype(AbstractStorageDecl *storage,
16751671
if (selfDecl)
16761672
*getter->getImplicitSelfDeclStorage() = selfDecl;
16771673

1678-
// We need to install the generic environment here because:
1679-
// 1) validating the getter will change the implicit self decl's DC to it,
1680-
// 2) it's likely that the initializer will be type-checked before the
1681-
// accessor (and therefore before the normal installation happens), and
1682-
// 3) type-checking a reference to the self decl will map its type into
1683-
// its context, which requires an environment to be installed on that
1684-
// context.
1685-
// We can safely use the enclosing environment because properties are never
1686-
// differently generic.
1687-
if (genericEnvironmentOfLazyAccessor)
1688-
getter->setGenericEnvironment(genericEnvironmentOfLazyAccessor);
1689-
16901674
if (storage->isGetterMutating())
16911675
getter->setSelfAccessKind(SelfAccessKind::Mutating);
16921676
else

0 commit comments

Comments
 (0)