Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust

Home Page:https://kampfkarren.github.io/selene/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`unused_variable` false positive

ketrab2004 opened this issue · comments

When using a function before it's defined it thinks that it isn't used.

doSomething()

function doSomething() -- doSomething is defined, but never used selene::unused_variable
    print("something")
end

In regular lua this would error but in luau this works just fine.

In regular lua this would error but in luau this works just fine.

That isn't true for your code in specific. Luau doesn't change this behavior at all.

That being said, you are roughly right about the bug, this is a duplicate of #212

That is odd, because for me in 5.4 and 5.3 it does error, but not with luau.

input:1: attempt to call a nil value (global 'doSomething')

Oh nevermind, my minimal reproducible example is wrong.

function main()
    doSomething()
end

function doSomething()
    print("something")
end

main()