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

Union function-types are not working as expecting

Open dvilker opened this issue 2 years ago • 0 comments

Environment

Name Version
IDEA version Build #IU-213.7172.25, built on March 15, 2022
Luanalysis version 1.2.2-IDEA203
OS macOS 12.1 (21C52)

Preferences

(Preferences -> Languages & Frameworks > Luanalysis)

Lua

Name Setting
Language level 5.2

Type Safety

Name Setting
Strict nil checks ☑️ / ❎ - no affecting
Unknown type (any) is indexable ☑️
Unknown type (any) is callabale ☑️

What are the steps to reproduce this issue?

---@alias f1 fun(a: string)
---@alias f2 fun(a: string, b: number)

---@type f1|f2
local foo

foo("one", 1)
foo("one") -- "Missing argument: b: number"


---@type f2|f1
local bar

bar("one", 1)
bar("one") -- "Missing argument: b: number" too

What happens?

IDE says missing argument.

What were you expecting to happen?

IDE accepts both function types

dvilker avatar Aug 16 '22 11:08 dvilker