From f7ec693b035e2d947ec0c2d349facffd97d74152 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Sun, 22 Feb 2015 21:23:08 -0800 Subject: [PATCH] Fixed looping in auto-complete when processing recursive assignments. --- spec/lua.lua | 2 ++ t/2-autocomplete.lua | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/spec/lua.lua b/spec/lua.lua index 29ed8a46dc..4da8692bf8 100644 --- a/spec/lua.lua +++ b/spec/lua.lua @@ -164,6 +164,8 @@ return { :gsub("%b()","") :gsub("%b{}","") :gsub("%b[]",".0") + -- replace concatenation with addition to avoid misidentifying types + :gsub("%.%.+","+") -- remove comments; they may be in strings, but that's okay here :gsub("%-%-.*","")) if (typ and (typ:match(",") or typ:match("%sor%s") or typ:match("%sand%s"))) then diff --git a/t/2-autocomplete.lua b/t/2-autocomplete.lua index c345479543..cb3a44f6f3 100644 --- a/t/2-autocomplete.lua +++ b/t/2-autocomplete.lua @@ -52,6 +52,15 @@ editor:AddText([[ ok(limit(10000, function() EditorAutoComplete(editor) end), "Auto-complete doesn't loop for classes that reference '...'.") +editor:SetText('') +editor:AddText([[ + buf = str + str = buf..str + buf = buf..]]) + +ok(limit(10000, function() EditorAutoComplete(editor) end), + "Auto-complete doesn't loop for string concatenations with self-reference.") + -- create a valuetype self-reference -- this is to test "s = Scan(); s:" fragment ide.apis.lua.baselib.io.valuetype = "io"