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

bad type narrowing not removing nil #93

Open
lewis6991 opened this issue Feb 20, 2025 · 3 comments
Open

bad type narrowing not removing nil #93

lewis6991 opened this issue Feb 20, 2025 · 3 comments

Comments

@lewis6991
Copy link

Image

    local text --- @type string[]?
    if staged then
      local text1 --- @type string[]?
      text = text1
    else
      local text2 --- @type string[]?
      text = text2
    end

    if not text then
      return
    end

    --- @param _a string[]
    local function foo(_a) end

    foo(text)
@lewis6991 lewis6991 changed the title bad type narrowing nor removing nil bad type narrowing not removing nil Feb 20, 2025
@lewis6991
Copy link
Author

Another case:

Image

@lewis6991
Copy link
Author

Another case:

Image

@lewis6991
Copy link
Author

Another case:

Image

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

No branches or pull requests

1 participant