Skip to content

Commit 8963183

Browse files
committed
fix
1 parent e868888 commit 8963183

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

script/parser/newparser.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,13 +1749,13 @@ local function addDummySelf(node, call)
17491749
parent = call,
17501750
}
17511751
end
1752-
local self = createLocal {
1752+
local self = {
1753+
type = 'self',
17531754
start = node.colon.start,
17541755
finish = node.colon.finish,
17551756
parent = call.args,
17561757
[1] = 'self',
17571758
}
1758-
self.type = 'self'
17591759
tinsert(call.args, 1, self)
17601760
end
17611761

script/vm/compiler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ local function compileLocalBase(source)
731731
local hasMarkParam
732732
if source.type == 'self' and not hasMarkDoc then
733733
hasMarkParam = true
734-
if source.parent.parent.type == 'call' then
734+
if source.parent.type == 'callargs' then
735735
-- obj:func(...)
736736
vm.setNode(source, vm.compileNode(source.parent.parent.node.node))
737737
else

test/type_inference/init.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,3 +1471,14 @@ TEST 'A' [[
14711471
---@type A
14721472
local <?x?> = nil
14731473
]]
1474+
1475+
TEST 'A' [[
1476+
---@class A
1477+
---@field b B
1478+
local mt
1479+
1480+
function mt:f()
1481+
self.b:x()
1482+
print(<?self?>)
1483+
end
1484+
]]

0 commit comments

Comments
 (0)