more type validation during compilation
@@ -502,7 +502,7 @@ M3Result PopType (IM3Compilation o, u8 i_type)
u8 topType = GetStackTopType (o);
- if (i_type == topType)
+ if (i_type == topType or o->block.isPolymorphic)
{
result = Pop (o);
}
@@ -1035,7 +1035,7 @@ M3Result Compile_End (IM3Compilation o, m3opcode_t i_opcode)
if (type)
{
- if (type != GetStackTopType (o))
+ if (not o->block.isPolymorphic and type != GetStackTopType (o))
_throw (m3Err_typeMismatch);
// if there are branches to the function end, then their values are in a register
