mindcode
mindcode copied to clipboard
Case expression as a function argument compiles incorrectly
A case expression used as a function argument is compiled into two arguments:
print(case 1 when 1 then 2 end)
produces
set __tmp0 2
print 1
print __tmp0
end
When used with user defined function
def foo(n) print(n) end
foo(case 1 when 1 then 2 end)
an error is reported: "Function 'foo': wrong number of arguments (expected 1, found 2)" (Note: the error is only displayed in the command line application).