Skip to content

Commit 2140dc2

Browse files
committed
Eliminate an unnecessary use of the generic environment of an archetype
1 parent 859110c commit 2140dc2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/AST/Type.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,12 @@ bool TypeBase::isActorType() {
379379
if (!actorProto)
380380
return false;
381381

382-
auto interfaceType = archetype->getInterfaceType();
383-
auto genericEnv = archetype->getGenericEnvironment();
384-
return genericEnv->getGenericSignature()->requiresProtocol(
385-
interfaceType, actorProto);
382+
for (auto proto : archetype->getConformsTo()) {
383+
if (proto == actorProto || proto->inheritsFrom(actorProto))
384+
return true;
385+
}
386+
387+
return false;
386388
}
387389

388390
// Existential types: check for Actor protocol.

0 commit comments

Comments
 (0)