Skip to content

Commit e8b46e3

Browse files
committed
fix
1 parent ff741df commit e8b46e3

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

script/vm/compiler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ local compilerSwitch = util.switch()
12701270
---@cast key string
12711271
vm.compileByParentNode(source.node, key, function (src)
12721272
vm.setNode(source, vm.compileNode(src))
1273-
if src == source and source.value then
1273+
if src == source and source.value and source.value.type ~= 'nil' then
12741274
vm.setNode(source, vm.compileNode(source.value))
12751275
end
12761276
end)

script/vm/global.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ function vm.compileByGlobal(source)
552552
if vm.bindDocs(source) then
553553
return true
554554
end
555-
if source.value then
555+
if source.value and source.value.type ~= 'nil' then
556556
vm.setNode(source, vm.compileNode(source.value))
557557
return true
558558
end

test/type_inference/init.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,12 +3407,12 @@ TEST '{ [string]: number, [true]: string, [1]: boolean, tag: integer }' [[
34073407
local <?t?>
34083408
]]
34093409

3410-
TEST 'nil' [[
3410+
TEST 'unknown' [[
34113411
local mt = {}
34123412
mt.<?x?> = nil
34133413
]]
34143414

3415-
TEST 'nil' [[
3415+
TEST 'unknown' [[
34163416
mt = {}
34173417
mt.<?x?> = nil
34183418
]]
@@ -4189,3 +4189,13 @@ X.Y = 1
41894189
41904190
print(X.<?Y?>)
41914191
]]
4192+
4193+
TEST 'integer' [[
4194+
local x = {}
4195+
4196+
x.y = 1
4197+
local y = x.y
4198+
x.y = nil
4199+
4200+
print(<?y?>)
4201+
]]

0 commit comments

Comments
 (0)