Skip to content

Commit e77d46f

Browse files
committed
Sema: Fix a trivial usage of FunctionType::getOld() in CSDiag
Trivial reading of the code shows that InputType is always a function type, and never nullptr.
1 parent ba6d385 commit e77d46f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5403,18 +5403,19 @@ bool FailureDiagnosis::diagnoseTrailingClosureErrors(ApplyExpr *callExpr) {
54035403
return false;
54045404

54055405
class ClosureCalleeListener : public ExprTypeCheckListener {
5406-
Type InputType;
5406+
FunctionType *InputType;
54075407
Type ResultType;
54085408

54095409
public:
5410-
explicit ClosureCalleeListener(Type inputType, Type resultType)
5410+
explicit ClosureCalleeListener(FunctionType *inputType, Type resultType)
54115411
: InputType(inputType), ResultType(resultType) {}
54125412

54135413
bool builtConstraints(ConstraintSystem &cs, Expr *expr) override {
5414-
if (!InputType || !ResultType)
5414+
if (!ResultType)
54155415
return false;
54165416

5417-
auto expectedType = FunctionType::getOld(InputType, ResultType);
5417+
AnyFunctionType::Param Input(InputType);
5418+
auto expectedType = FunctionType::get({Input}, ResultType);
54185419
cs.addConstraint(ConstraintKind::Conversion, cs.getType(expr),
54195420
expectedType, cs.getConstraintLocator(expr),
54205421
/*isFavored*/ true);

0 commit comments

Comments
 (0)