Add better error raporting

This commit is contained in:
Sofia 2026-04-13 21:47:18 +03:00
parent 28483812ea
commit 51c54e375a

View File

@ -25,8 +25,11 @@ namespace {
if (types::types_equal(checked, target)) {
return TypecheckRes{ TypecheckResKind::Ok, target };
}
else if (potential_cast.has_value() && potential_cast->allow_implicit) {
else if (potential_cast.has_value()) {
if (potential_cast->allow_implicit)
return TypecheckRes{ TypecheckResKind::Castable, target };
return std::string{ "Type " + checked->formatted() + " not implicitly castable to " + target->formatted() };
}
return std::string{ "Types " + checked->formatted() + " and " + target->formatted() + " incompatible" };