LuaLS / LuaLS/lua-language-server
Cannot assign parent primitive type (like integer) to it child @class int64: integer, how it work for integer: number
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
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?
Diagnostics/Syntax Checking
Expected Behaviour
No warnings
Actual Behaviour
Cannot assign `integer` to parameter `int64`.
- Type `integer` cannot match `int64`
- Type `number` cannot match `int64`Lua Diagnostics.(param-type-mismatch)
Reproduction steps
---@class int64: integer
---@param v int64
function f(v)
assert(v)
end
local a = 1ULL
local b = 1
f(a)
f(b)
f(1)
--- Cannot assign `integer` to parameter `int64`.
--- - Type `integer` cannot match `int64`
--- - Type `number` cannot match `int64`Lua Diagnostics.(param-type-mismatch)
for i = 1, 10 do
f(i)
end
Additional Notes
No response
Log File
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Lua reproduction in the issue and run it through the Visual Studio Code extension to confirm the param-type-mismatch diagnostic for integer values passed to an int64 parameter. Trace the diagnostics and type-checking entry points responsible for class types and primitive numeric types. Done means the reported valid calls produce no warnings while incompatible assignments remain diagnosed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100