diff options
-rw-r--r-- | script-beta/parser/guide.lua | 9 | ||||
-rw-r--r-- | test-beta/type_inference/init.lua | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index e377b6c8..2dfba346 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2780,7 +2780,10 @@ local function mergeFunctionReturns(status, source, index) local rtn = returns[i] if rtn[index] then if rtn[index].type == 'call' then - m.inferByCallReturnAndIndex(status, rtn[index], index) + if not m.checkReturnMark(status, rtn[index]) then + m.checkReturnMark(status, rtn[index], true) + m.inferByCallReturnAndIndex(status, rtn[index], index) + end else local newStatus = m.status(status) m.searchInfer(newStatus, rtn[index]) @@ -2808,7 +2811,9 @@ function m.inferByCallReturnAndIndex(status, call, index) if src.type == 'library' then mergeLibraryFunctionReturns(status, src.value, index) else - mergeFunctionReturns(status, src.value, index) + if not m.checkReturnMark(status, src.value, true) then + mergeFunctionReturns(status, src.value, index) + end end end end diff --git a/test-beta/type_inference/init.lua b/test-beta/type_inference/init.lua index 169047fa..562baee9 100644 --- a/test-beta/type_inference/init.lua +++ b/test-beta/type_inference/init.lua @@ -281,3 +281,14 @@ local _, _, _, <?b?>, _ = x(nil, true, 1, 'yy') TEST 'any' [[ local <?x?> = next() ]] + +TEST 'any' [[ +local a, b +function a() + return b() +end +function b() + return a() +end +local <?x?> = a() +]] |