Skip to content
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

Lua template #1243

Closed
Nexela opened this issue Jun 28, 2022 · 2 comments
Closed

Lua template #1243

Nexela opened this issue Jun 28, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@Nexela
Copy link
Contributor

Nexela commented Jun 28, 2022

Using Lua 5.2 but I believe it applies for all the other versions

Missing optional nil return values on next()

local tab = {}---@type {[integer]: {[string]: string}}
local index, value = next(tab)
print(index) -- This line should warn for need check nil
print(value.first) -- This line should warn for need check nil

string.match returns string? (not string|number)

return city_name:match(".*, .*, (.*)") --- Incorrect type warning here

latest Vscode, latest master

@sumneko
Copy link
Collaborator

sumneko commented Jun 28, 2022

string.match returns string? (not string|number)

string.match can return integer with local startPos, finishPos = string.match('()somewords()')

I'm considering change it to return any, and supports analysising parameters to determin return types in the future

@sumneko sumneko added the bug Something isn't working label Jun 28, 2022
@sumneko sumneko added this to the 3.4.0 milestone Jun 28, 2022
@Nexela
Copy link
Contributor Author

Nexela commented Jun 28, 2022

string.match can return integer with local startPos, finishPos = string.match('()somewords()')

I did not realize this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants