LuaLS / LuaLS/lua-language-server
Cannot assign parent primitive type (like integer) to it child @class int64: integer, how it work for integer: number
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
```lua
---@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