Comments (1)
I debugged a bit and seems that the logic doesn't handle the case when source
object is of variable
type which can also be inferred as integer
:
lua-language-server/script/vm/operator.lua
Lines 239 to 270 in e0a4869
- it will run the
else
case asvm.getInteger()
will not handlevariable
source objects
Meanwhile for the +
case, it has the following extra handling:
lua-language-server/script/vm/operator.lua
Lines 313 to 324 in e0a4869
I copied this to the <<
case, and it seems to work now:
: case '<<'
: case '>>'
: case '&'
: case '|'
: case '~'
: call(function (source)
local a = vm.getInteger(source[1])
local b = vm.getInteger(source[2])
local op = source.op.type
if a and b then
local result = op == '<<' and a << b
or op == '>>' and a >> b
or op == '&' and a & b
or op == '|' and a | b
or op == '~' and a ~ b
---@diagnostic disable-next-line: missing-fields
vm.setNode(source, {
type = 'integer',
start = source.start,
finish = source.finish,
parent = source,
[1] = result,
})
else
local node = vm.runOperator(binaryMap[op], source[1], source[2])
if not node then
node = vm.runOperator(binaryMap[op], source[2], source[1])
end
if node then
vm.setNode(source, node)
--- patch start
return
end
local uri = guide.getUri(source)
local infer1 = vm.getInfer(source[1])
local infer2 = vm.getInfer(source[2])
if infer1:hasType(uri, 'integer')
and infer2:hasType(uri, 'integer') then
vm.setNode(source, vm.declareGlobal('type', 'integer'))
return
--- patch finish
end
end
end)
maybe @RomanSpector you can test about it and open a PR?
from lua-language-server.
Related Issues (20)
- How to make a third-party member function as deprecated HOT 11
- Please add an option under the 'hint' category to specify a max length for hints HOT 3
- [Annotations] false positive param-type-mismatch on a class member function HOT 5
- ERROR: script/core/hint.lua:320: attempt to index a nil value (local 'last') HOT 3
- [FEATURE-REQUEST] Configuration option to disable didRenameFiles prompt HOT 1
- Unable to use `@enum` or `@alias` type in table index (index signature) HOT 2
- Hint display is incorrect when using plugin
- Modifying `.luarc.json` instead of `settings.json` with the Extension API HOT 4
- Unexpected behavior of terminal pop-up
- `say hello` does not make helix happy - `#40fd1d7` HOT 1
- Incorrect `fix-indent` behaviour when writing for loops at root scope HOT 14
- generic param no hint HOT 2
- Table literals aren't properly checked for field injections and missing fields HOT 1
- 性能问题 CPU占用高 HOT 3
- 自动修改 require 路径出现错误
- Completion for instance of class in array of instances HOT 2
- Not using latest version of LuaCats/love2d submodule HOT 2
- Packing multiple returns into a table only shows first return value
- Disallow ? on values HOT 4
- is there way to lua-ls as a formater in ci? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-language-server.