Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust
https://kampfkarren.github.io/selene/
Mozilla Public License 2.0
597 stars 75 forks source link

Improve error message when using too many arguments when some parameters are optional #38

Open Kampfkarren opened 4 years ago

Kampfkarren commented 4 years ago
local hit, hitPoint = game.Workspace:FindPartOnRayWithWhitelist(ray, partsWhitelist, false, false)

Current output: standard library function game.Workspace.FindPartOnRayWithWhitelist requires 0 parameters, 4 passed

Expected output: standard library function game.Workspace.FindPartOnRayWithWhitelist takes at most 3 parameters, 4 passed

matthargett commented 2 years ago

another example, to make sure the future fix is reasonably generic:

error[incorrect_standard_library_use]: standard library function `UDim.new` requires 0 parameters, 4 passed
   ┌─ src\Cer.spec.lua:79:12
   │
79 │             width = UDim.new(1, 1, 1, 1),
   │                     ^^^^^^^^^^^^^^^