-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking
Expected Behaviour
In older versions (3.4), the following generated warnings for passing invalid values to the class construction function:
---@class Options
---@field name string
---@class MyClass
---@overload fun(x : Options) : MyClass
---@overload fun(x : string) : MyClass
local MyClass = {}
local w = MyClass(1) -- Cannot assign `integer` to parameter `string|Options`.
local z = MyClass { name = 1 } -- Cannot assign `integer` to `string`.
Actual Behaviour
In the current version, any value can be passed to the constructor without any warnings. I assume this is to support arbitrary __call metamethod, but in that case it's better to explicitly use the @opeartor
annotation, and the extra warnings in the old version were very useful to detect invalid constructor parameters.
Reproduction steps
Try the example above.
Additional Notes
No response
Log File
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working