summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/vm/compiler.lua7
-rw-r--r--test/type_inference/init.lua7
2 files changed, 13 insertions, 1 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index c7d57dcb..103239c1 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -78,8 +78,13 @@ local searchFieldSwitch = util.switch()
or not math.tointeger(key) then
return
end
+ pushResult(source.node)
+ end
+ if type(key) == 'table' then
+ if vm.isSubType(suri, key, 'integer') then
+ pushResult(source.node)
+ end
end
- pushResult(source.node)
end)
: case 'doc.type.table'
: call(function (suri, source, key, ref, pushResult)
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 522c48f2..09f51b8e 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -2667,3 +2667,10 @@ end
print(<?x?>)
]]
+
+TEST 'unknown' [[
+---@type string[]
+local t
+
+local <?x?> = t.x
+]]