Skip to content

Commit e717330

Browse files
committed
RequirementMachine: Minor optimization
1 parent 58b414d commit e717330

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/AST/RequirementMachine/GenericSignatureQueries.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ bool RequirementMachine::isCanonicalTypeInContext(Type type) const {
265265
explicit Walker(const RequirementMachine &self) : Self(self) {}
266266

267267
Action walkToTypePre(Type component) override {
268+
if (!component->hasTypeParameter())
269+
return Action::SkipChildren;
270+
268271
if (!component->isTypeParameter())
269272
return Action::Continue;
270273

@@ -305,6 +308,9 @@ Type RequirementMachine::getCanonicalTypeInContext(
305308
TypeArrayView<GenericTypeParamType> genericParams) const {
306309

307310
return type.transformRec([&](Type t) -> Optional<Type> {
311+
if (!t->hasTypeParameter())
312+
return t;
313+
308314
if (!t->isTypeParameter())
309315
return None;
310316

0 commit comments

Comments
 (0)