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

Incorrectly reports unreachable-code #1363

Closed
Nexela opened this issue Jul 21, 2022 · 0 comments
Closed

Incorrectly reports unreachable-code #1363

Nexela opened this issue Jul 21, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Nexela
Copy link
Contributor

Nexela commented Jul 21, 2022

--- @diagnostic disable
--- @diagnostic enable: unreachable-code
---@param s string
---@return any[]
---@nodiscard
function test(s, sep, pattern, func)
  while start_idx do
    start_idx, end_idx = s:find(sep, end_idx + 1)
  end
  local sub_str = s:sub(last_find)
  if sub_str:len() > 0 then table.insert(fields, func(s:sub(last_find))) end
  return fields
end

image

image

@sumneko sumneko added the bug Something isn't working label Jul 21, 2022
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