Skip to content

Commit

Permalink
add more info when type constraints unsolved
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-xiaoming committed Mar 20, 2023
1 parent 5ba5fbb commit ea61ecf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/hobbes/lang/expr.C
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,13 @@ const MonoTypePtr& requireMonotype(const TEnvPtr& tenv, const ExprPtr& e) {
if (!e->type()->constraints().empty()) {
Constraints cs = expandHiddenTCs(tenv, simplifyVarNames(e->type())->constraints());
std::ostringstream ss;
ss << "Failed to compile expression due to unresolved type constraint" << (cs.size() > 1 ? "s" : "");
ss << "Failed to compile expression `";
e->show(ss);
ss << "` due to unresolved type constraint" << (cs.size() > 1 ? "s" : "");
for (const auto& c: cs) {
ss << "\n ";
c->show(ss);
}
throw unsolved_constraints(*e, ss.str(), cs);
}

Expand Down

0 comments on commit ea61ecf

Please sign in to comment.