Type check arrow type expressions
This commit is contained in:
parent
9578e5d252
commit
c8ceff3210
1 changed files with 13 additions and 0 deletions
|
@ -336,6 +336,19 @@ std::tuple<ConstraintSet, Type*> Checker::inferTypeExpr(TypeEnv& Env, TypeExpres
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NodeKind::ArrowTypeExpression:
|
||||||
|
{
|
||||||
|
auto Arrow = static_cast<ArrowTypeExpression*>(TE);
|
||||||
|
auto [ReturnOut, ReturnTy] = inferTypeExpr(Env, Arrow->ReturnType);
|
||||||
|
Ty = ReturnTy;
|
||||||
|
for (auto PT: Arrow->ParamTypes) {
|
||||||
|
auto [ParamOut, ParamTy] = inferTypeExpr(Env, PT);
|
||||||
|
mergeTo(Out, ParamOut);
|
||||||
|
Ty = new TFun(ParamTy, Ty);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ZEN_UNREACHABLE
|
ZEN_UNREACHABLE
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue