Skip to content

Commit 75eb507

Browse files
authored
Merge pull request swiftlang#75649 from ahoppen/generic-environment-check
[IDE] Simplify `ContainsSpecializableArchetype`
2 parents c3018ac + 2b43b8d commit 75eb507

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lib/Sema/IDETypeCheckingRequests.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,10 @@ class ContainsSpecializableArchetype : public TypeWalker {
8989

9090
Action walkToTypePre(Type T) override {
9191
if (auto *Archetype = T->getAs<ArchetypeType>()) {
92-
if (auto *GenericTypeParam =
93-
Archetype->mapTypeOutOfContext()->getAs<GenericTypeParamType>()) {
94-
if (auto GenericTypeParamDecl = GenericTypeParam->getDecl()) {
95-
bool ParamMaybeVisibleInCurrentContext =
96-
(DC == GenericTypeParamDecl->getDeclContext() ||
97-
DC->isChildContextOf(GenericTypeParamDecl->getDeclContext()));
98-
if (!ParamMaybeVisibleInCurrentContext) {
99-
Result = true;
100-
return Action::Stop;
101-
}
102-
}
92+
if (Archetype->getGenericEnvironment() !=
93+
DC->getGenericEnvironmentOfContext()) {
94+
Result = true;
95+
return Action::Stop;
10396
}
10497
}
10598
return Action::Continue;

0 commit comments

Comments
 (0)