luau icon indicating copy to clipboard operation
luau copied to clipboard

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

Open Ketasaja opened this issue 1 year ago • 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 = "",
})

Ketasaja avatar Aug 01 '24 18:08 Ketasaja