Fix some logic not making use of Checker::makeEqual
This commit is contained in:
parent
6234a49feb
commit
af7fcb52b4
1 changed files with 7 additions and 7 deletions
|
@ -137,7 +137,7 @@ namespace bolt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checker::makeEqual(Type* A, Type* B, Node* Source) {
|
void Checker::makeEqual(Type* A, Type* B, Node* Source) {
|
||||||
makeEqual(A, B, Source);
|
addConstraint(new CEqual(A, B, Source));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checker::addConstraint(Constraint* C) {
|
void Checker::addConstraint(Constraint* C) {
|
||||||
|
@ -572,7 +572,7 @@ namespace bolt {
|
||||||
RetType = createTypeVar();
|
RetType = createTypeVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
addConstraint(new CEqual { Decl->Ty, new TArrow(ParamTypes, RetType), Decl });
|
makeEqual(Decl->Ty, new TArrow(ParamTypes, RetType), Decl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,7 +617,7 @@ namespace bolt {
|
||||||
auto IfStmt = static_cast<IfStatement*>(N);
|
auto IfStmt = static_cast<IfStatement*>(N);
|
||||||
for (auto Part: IfStmt->Parts) {
|
for (auto Part: IfStmt->Parts) {
|
||||||
if (Part->Test != nullptr) {
|
if (Part->Test != nullptr) {
|
||||||
addConstraint(new CEqual { BoolType, inferExpression(Part->Test), Part->Test });
|
makeEqual(BoolType, inferExpression(Part->Test), Part->Test);
|
||||||
}
|
}
|
||||||
for (auto Element: Part->Elements) {
|
for (auto Element: Part->Elements) {
|
||||||
infer(Element);
|
infer(Element);
|
||||||
|
@ -634,10 +634,10 @@ namespace bolt {
|
||||||
auto RetStmt = static_cast<ReturnStatement*>(N);
|
auto RetStmt = static_cast<ReturnStatement*>(N);
|
||||||
Type* ReturnType;
|
Type* ReturnType;
|
||||||
if (RetStmt->Expression) {
|
if (RetStmt->Expression) {
|
||||||
addConstraint(new CEqual { inferExpression(RetStmt->Expression), getReturnType(), RetStmt->Expression });
|
makeEqual(inferExpression(RetStmt->Expression), getReturnType(), RetStmt->Expression);
|
||||||
} else {
|
} else {
|
||||||
ReturnType = new TTuple({});
|
ReturnType = new TTuple({});
|
||||||
addConstraint(new CEqual { new TTuple({}), getReturnType(), N });
|
makeEqual(new TTuple({}), getReturnType(), N);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -964,7 +964,7 @@ namespace bolt {
|
||||||
for (auto Arg: Call->Args) {
|
for (auto Arg: Call->Args) {
|
||||||
ArgTypes.push_back(inferExpression(Arg));
|
ArgTypes.push_back(inferExpression(Arg));
|
||||||
}
|
}
|
||||||
addConstraint(new CEqual { OpTy, new TArrow(ArgTypes, Ty), X });
|
makeEqual(OpTy, new TArrow(ArgTypes, Ty), X);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ namespace bolt {
|
||||||
std::vector<Type*> ArgTys;
|
std::vector<Type*> ArgTys;
|
||||||
ArgTys.push_back(inferExpression(Infix->LHS));
|
ArgTys.push_back(inferExpression(Infix->LHS));
|
||||||
ArgTys.push_back(inferExpression(Infix->RHS));
|
ArgTys.push_back(inferExpression(Infix->RHS));
|
||||||
addConstraint(new CEqual { new TArrow(ArgTys, Ty), OpTy, X });
|
makeEqual(new TArrow(ArgTys, Ty), OpTy, X);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue