Skip to content

Commit a4acf39

Browse files
committed
Sema: Simplify classifyArgumentByType() in TypeCheckEffects.cpp
1 parent 305fa94 commit a4acf39

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,22 +1233,10 @@ class ApplyClassifier {
12331233
EffectKind kind) {
12341234
if (!paramType || paramType->hasError())
12351235
return Classification::forInvalidCode();
1236-
if (auto fnType = paramType->getAs<AnyFunctionType>()) {
1237-
if (fnType->hasEffect(kind)) {
1238-
return Classification::forUnconditional(kind, reason);
1239-
} else {
1240-
return Classification();
1241-
}
1242-
}
1243-
if (auto tupleType = paramType->getAs<TupleType>()) {
1244-
Classification result;
1245-
for (auto eltType : tupleType->getElementTypes()) {
1246-
result.merge(classifyArgumentByType(eltType, reason, kind));
1247-
}
1248-
return result;
1249-
}
12501236

1251-
// No other types include throwing functions for now.
1237+
if (hasFunctionParameterWithEffect(kind, paramType))
1238+
return Classification::forUnconditional(kind, reason);
1239+
12521240
return Classification();
12531241
}
12541242
};

0 commit comments

Comments
 (0)