IntelliJ-Luanalysis icon indicating copy to clipboard operation
IntelliJ-Luanalysis copied to clipboard

Packing the results of a function doesn't detect multiple return values

Open pouwelsjochem opened this issue 3 years ago • 0 comments

What are the steps to reproduce this issue?

---@shape Color
---@field [1] number
---@field [2] number
---@field [3] number

local function returnColorRGB()
    return 0, 0, 0
end

local colorByFunction = {returnColorRGB()} ---@type Color
local color = {0, 0, 0} ---@type Color

What happens?

The colorByFunction assignment gives an error saying:

Type mismatch. Missing member: '[2]' of: 'Color' 
Type mismatch. Missing member: '[3]' of: 'Color' 

What were you expecting to happen?

No errors to be given, since both color and colorByFunction assignments have the exact same resulting table.

pouwelsjochem avatar Mar 27 '21 10:03 pouwelsjochem