Skip to content

basic mapping function fails in new solver #2168

@jackdotink

Description

@jackdotink
local function map<T, U>(v: T, fn: (T) -> U): U
	return fn(v)
end

local a = map(5, function(x)
	return x * 2
end)

The above code gives the type error Consider placing the following annotations on the arguments: x: number or instead annotating the return as number on the function expression passed in the call to map.

Luau should infer x to be number without an annotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions