summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-31 19:43:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-31 19:43:48 +0800
commitd004c1c6dcc5716d1e2f049782b660bb3d7bd74d (patch)
tree5b36bafba9e0a5c6452bc1e160990a8ca9f8d4d0 /server
parentb63286f959f6a07c8901b0e3f0e03e81a935ac4d (diff)
downloadlua-language-server-d004c1c6dcc5716d1e2f049782b660bb3d7bd74d.zip
#fixed 104
Diffstat (limited to 'server')
-rw-r--r--server/src/core/diagnostics.lua2
-rw-r--r--server/src/parser/ast.lua1
-rw-r--r--server/test/diagnostics/init.lua10
3 files changed, 13 insertions, 0 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua
index c99f6e87..3b11b818 100644
--- a/server/src/core/diagnostics.lua
+++ b/server/src/core/diagnostics.lua
@@ -354,6 +354,7 @@ function mt:searchAmbiguity1(callback)
and first.type ~= 'unary'
and not second.op
and literalMap[second.type]
+ and not first.brackets
then
callback(source.start, source.finish, first.start, first.finish)
end
@@ -364,6 +365,7 @@ function mt:searchAmbiguity1(callback)
and second.type ~= 'unary'
and not first.op
and literalMap[second[1].type]
+ and not second.brackets
then
callback(source.start, source.finish, second.start, second.finish)
end
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 0eb17a80..3a91e42a 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -627,6 +627,7 @@ local Defs = {
return expSplit(list, 1, #list, 1)
end,
Prefix = function (start, exp, finish)
+ exp.brackets = true
return exp
end,
Index = function (start, exp, finish)
diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua
index 666d72dc..ec0b76ba 100644
--- a/server/test/diagnostics/init.lua
+++ b/server/test/diagnostics/init.lua
@@ -554,6 +554,16 @@ local x
x = x or -1
]]
+TEST [[
+local x
+x = x or (0 + 1)
+]]
+
+TEST [[
+local x, y
+x = (x + y) or 0
+]]
+
--TEST [[
--local t = {}
--function t:<!a!>()