summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/vm/compiler.lua11
-rw-r--r--test/type_inference/init.lua8
2 files changed, 19 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index c249b44d..b2cdb1be 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1008,6 +1008,17 @@ local function compileLocal(source)
vm.setNode(source, vm.compileNode(source.value))
end
end
+ if not hasMarkValue and not hasMarkValue then
+ if source.ref then
+ for _, ref in ipairs(source.ref) do
+ if ref.type == 'setlocal'
+ and ref.value
+ and ref.value.type == 'function' then
+ vm.setNode(source, vm.compileNode(ref.value))
+ end
+ end
+ end
+ end
-- function x.y(self, ...) --> function x:y(...)
if source[1] == 'self'
and not hasMarkDoc
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index b5814e29..6d81e640 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -3167,3 +3167,11 @@ TEST 'number' [[
local function f() end
local x, y, <?z?> = 1, 2, f()
]]
+
+TEST 'function' [[
+local f
+
+print(<?f?>)
+
+function f() end
+]]