Skip to content

Commit e8e5bec

Browse files
committed
fix #1430
1 parent 7cc86b4 commit e8e5bec

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* `FIX` [#1422](https://github.com/sumneko/lua-language-server/issues/1422)
66
* `FIX` [#1425](https://github.com/sumneko/lua-language-server/issues/1425)
77
* `FIX` [#1428](https://github.com/sumneko/lua-language-server/issues/1428)
8+
* `FIX` [#1430](https://github.com/sumneko/lua-language-server/issues/1430)
89

910
## 3.5.2
1011
`2022-8-1`

script/vm/compiler.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
373373
local fieldKey = guide.getKeyName(field)
374374
if fieldKey and not searchedFields[fieldKey] then
375375
if not searchedFields[fieldKey]
376-
and guide.isSet(field) then
376+
and guide.isSet(field)
377+
and guide.isLiteral(field.value) then
377378
hasFounded[fieldKey] = true
378379
pushResult(field, true)
379380
end

test/type_inference/init.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3761,3 +3761,15 @@ TEST 'integerA' [[
37613761
for <?i?> = 1, 10 do
37623762
end
37633763
]]
3764+
3765+
TEST 'string' [[
3766+
---@class A
3767+
---@field x string
3768+
3769+
---@class B : A
3770+
local t = {}
3771+
3772+
t.x = t.x
3773+
3774+
print(t.<?x?>)
3775+
]]

0 commit comments

Comments
 (0)