Skip to content

Warn and ignore variadic expansions that can't be handled properly #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

taminomara
Copy link
Contributor

This PR checks for situation where variadic type expansion operator (T...) is used in an unexpected place, and can't be handled properly. Users will get a warning about such situations, and the operator will be ignored.

This prevents unexpected variadic types such as:

local x --- @type integer...
local x1, x2 = x
--             ^ EmmyLua thinks `x` is a result of a variadic expansion,
--    ^^  ^^     so it infers both `x1` and `x2` as integers.

Fix #701

This PR checks for situation where variadic type expansion operator (`T...`)
is used in an unexpected place, and can't be handled properly. Users will get
a warning about such situations, and the operator will be ignored.

This prevents unexpected variadic types such as:

```lua
local x --- @type integer...
local x1, x2 = x
--             ^ EmmyLua thinks `x` is a result of a variadic expansion,
--    ^^  ^^     so it infers both `x1` and `x2` as integers.
```

Fix EmmyLuaLs#701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve semantics of variadic expansion
2 participants