summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-08-10 16:23:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-08-10 16:23:01 +0800
commitc3c73efb8fbb3e37d0191d3f924283861218a358 (patch)
treefe449ebf84ac56cd9a8928adba04093126997830
parentb778d586096ecfe40832ebf8fd3d795a3d4947dc (diff)
downloadlua-language-server-c3c73efb8fbb3e37d0191d3f924283861218a358.zip
enable `as` table
#2144
-rw-r--r--changelog.md2
-rw-r--r--script/vm/compiler.lua3
-rw-r--r--test/type_inference/init.lua8
3 files changed, 12 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 820c4af7..247b10da 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,6 @@
# changelog
-## 3.6.26
+## 3.7.0
* `FIX` wrong hover and signature for method with varargs and overloads
* `FIX` [#2224]
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index a6b95b7c..a4147d70 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1153,6 +1153,9 @@ local compilerSwitch = util.switch()
end)
: case 'table'
: call(function (source)
+ if vm.bindAs(source) then
+ return
+ end
vm.setNode(source, source)
if source.parent.type == 'callargs' then
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 8797cfdd..9f5c8493 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -4313,3 +4313,11 @@ local x = 1
repeat
until <?x?>
]]
+
+TEST 'A' [=[
+local function f()
+ return {} --[[@as A]]
+end
+
+local <?x?> = f()
+]=]