diff options
-rw-r--r-- | server/src/core/diagnostics.lua | 2 | ||||
-rw-r--r-- | server/src/method/workspace/executeCommand.lua | 2 | ||||
-rw-r--r-- | server/test/diagnostics/init.lua | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua index 1a72d504..badf3b00 100644 --- a/server/src/core/diagnostics.lua +++ b/server/src/core/diagnostics.lua @@ -288,6 +288,7 @@ function mt:searchAmbiguity1(callback) -- a + (b or 0) --> (a + b) or 0 do if opMap[first.op] + and first.type ~= 'unary' and not second.op and literalMap[second.type] then @@ -297,6 +298,7 @@ function mt:searchAmbiguity1(callback) -- (a or 0) + c --> a or (0 + c) do if opMap[second.op] + and second.type ~= 'unary' and not first.op and literalMap[second[1].type] then diff --git a/server/src/method/workspace/executeCommand.lua b/server/src/method/workspace/executeCommand.lua index 95d90fec..b622ec11 100644 --- a/server/src/method/workspace/executeCommand.lua +++ b/server/src/method/workspace/executeCommand.lua @@ -167,6 +167,7 @@ function command.solve(lsp, data) -- (a + b) or 0 --> a + (b or 0) do if opMap[first.op] + and first.type ~= 'unary' and not second.op and literalMap[second.type] then @@ -179,6 +180,7 @@ function command.solve(lsp, data) -- a or (b + c) --> (a or b) + c do if opMap[second.op] + and second.type ~= 'unary' and not first.op and literalMap[second[1].type] then diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua index 97cd6ccd..36cfb3c6 100644 --- a/server/test/diagnostics/init.lua +++ b/server/test/diagnostics/init.lua @@ -463,3 +463,8 @@ TEST [[ local x, y, z x = x and y or '' .. z ]] + +TEST [[ +local x +x = x or -1 +]] |