Flattened if-else case for math builtins.
@@ -863,25 +863,13 @@ function ToIR:exp_to_value(cmds, exp, _recursive)
elseif def._tag == "checker.Def.Function" then
decl = def.func
elseif def._tag == "checker.Def.Builtin" then
- if var._type._tag == "types.T.Float" then
local bname = def.id
- if bname == "math.pi" then
- return ir.Value.Float(math.pi)
- elseif bname == "math.huge" then
- return ir.Value.Float(math.huge)
- else
- typedecl.tag_error(bname)
- end
- elseif var._type._tag == "types.T.Integer" then
- local bname = def.id
- if bname == "math.maxinteger" then
- return ir.Value.Integer(math.maxinteger)
- elseif bname == "math.mininteger" then
- return ir.Value.Integer(math.mininteger)
- else
- typedecl.tag_error(bname)
- end
+ if bname == "math.pi" then return ir.Value.Float(math.pi)
+ elseif bname == "math.huge" then return ir.Value.Float(math.huge)
+ elseif bname == "math.maxinteger" then return ir.Value.Integer(math.maxinteger)
+ elseif bname == "math.mininteger" then return ir.Value.Integer(math.mininteger)
else
+ -- See https://github.com/pallene-lang/pallene/issues/337
error("not implemented")
end
else
