Skip to content

Commit 1ec6c35

Browse files
committed
Sema: Simplify TypeChecker::isPassThroughTypealias()
This now matches what's actually described in 'Compiling Swift Generics', so of course it must be correct.
1 parent a8d865a commit 1ec6c35

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,28 +2938,12 @@ bool TypeChecker::isPassThroughTypealias(TypeAliasDecl *typealias,
29382938
// If neither is generic at this level, we have a pass-through typealias.
29392939
if (!typealias->isGeneric()) return true;
29402940

2941-
if (isa<BuiltinTupleDecl>(nominal) &&
2942-
typealias->getUnderlyingType()->isEqual(
2941+
if (typealias->getUnderlyingType()->isEqual(
29432942
nominal->getSelfInterfaceType())) {
29442943
return true;
29452944
}
29462945

2947-
auto boundGenericType = typealias->getUnderlyingType()
2948-
->getAs<BoundGenericType>();
2949-
if (!boundGenericType) return false;
2950-
2951-
// If our arguments line up with our innermost generic parameters, it's
2952-
// a passthrough typealias.
2953-
auto innermostGenericParams = typealiasSig.getInnermostGenericParams();
2954-
auto boundArgs = boundGenericType->getGenericArgs();
2955-
if (boundArgs.size() != innermostGenericParams.size())
2956-
return false;
2957-
2958-
return std::equal(boundArgs.begin(), boundArgs.end(),
2959-
innermostGenericParams.begin(),
2960-
[](Type arg, GenericTypeParamType *gp) {
2961-
return arg->isEqual(gp);
2962-
});
2946+
return false;
29632947
}
29642948

29652949
Type

0 commit comments

Comments
 (0)