luau-lang/luau

Some functions returned by functions can't be called immediately with new solver

Ketasaja opened this issue · 0 comments

Tested on 0.636 with no errors in non-strict mode:

type t = ("") -> (() -> ())
local f = (nil :: any) :: t
f("")() -- TypeError: Argument count mismatch. Function expects 0 arguments, but 1 is specified
local g = f("")
g()
type u = () -> (() -> ())
local h = (nil :: any) :: u
h()()

Variant:

type t = ("") -> (({
	Name: string,
}) -> {})
local f = (nil :: any) :: t
f("")({ --[[ TypeError: Type
'typeof(string)'
could not be converted into
'{ Name: string }']]
	Name = "",
})
local g = f("")
g({
	Name = "",
})