-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Annotations
Expected Behaviour
I expected this code would produce an assignment error, since it's assigning an integer to a boolean-typed variable:
---@alias test boolean
---@type test
local test = 4 -- error expected (assign-type-mismatch)Actual Behaviour
But no error is raised:
---@alias test boolean
---@type test
local test = 4 -- no error
test = "four"
test = false
test = 4
-- no errorsReproduction steps
Create a new lua file, assign an alias, then assign a mismatched type to it.
Additional Notes
This is with the Lua extension at mostly default settings: only formatting and telemetry are disabled. vscode is version 1.72.2, and the lua extension is version 3.5.6.
The language server is definitely running; in the same file, the following assignments:
---@type boolean
local test_two = 4 -- error (assign-type-mismatch)
---@type non_existent_alias -- error (undefined-doc-name)
local test_three = 4 -- error (assign-type-mismatch)Produce these errors:
Interestingly, the server does seem to know what type the variable should be, as it shows it correctly in the autocomplete suggestion:
Apologies if this is intended behaviour or a known issue.
Log File
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

