Skip to content

Return type inference fails if the parameter contains a LuaJIT 3 style lambda #1233

Description

@memchr

The return value of a function call will be inferred as unknown if any of its parameters is a LuaJIT 3 lambda.

Example

using emmylua_ls 0.25.1

local function foo(_)
  return 42
end


local a = foo("string") -- inferred as number

local b = foo(123) -- inferred as number

local c = foo(function () end) -- inferred as number

local d = foo(|| -> 2) -- inferred as unknown 
Image
Image
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions