Open snoopcatt opened 3 years ago
I have pushed some changes to make it consistent between the JIT and the interpreter. For now, this continues the existing model in the VM that NIL is valid value for Lua types - the Ravi add-on types do not allow NIL.
Hello. Let's summarize our discussion on that.
Currently we have strange behaviour of annotated function arguments. With some argument types (
number
,integer
,number[]
,integer[]
,table
) you can't passnil
, you will get a type error. But with other types --string
,closure
,userdata
-- you can passnil
without any errors.Example:
ravi: t.lua:0: TOFLT: number expected
Another example:
nil
(no error thrown)I think behaviour of annotated arguments should be unified. Most obvious solution is to make all arguments with specified type -- mandatory. (it is already that in JIT mode: #225)
In case when argument must be optional -- we have
any
type (or just omit annotation) as for now.