From 47cd7034e4766538d9a5de5a15809e520ed398a3 Mon Sep 17 00:00:00 2001 From: AlexALX Date: Tue, 16 Jun 2026 22:06:41 +0300 Subject: [PATCH 1/2] backward compatibility with string calls and empty e2, fix issue mention in #2841 --- lua/entities/gmod_wire_expression2/base/compiler.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/base/compiler.lua b/lua/entities/gmod_wire_expression2/base/compiler.lua index a4597854ae..b9ff290753 100644 --- a/lua/entities/gmod_wire_expression2/base/compiler.lua +++ b/lua/entities/gmod_wire_expression2/base/compiler.lua @@ -1832,7 +1832,7 @@ local CompileVisitors = { local fn = state.funcs[sig] or state.funcs[meta_sig] if fn then -- first check if user defined any functions that match signature local r = state.funcs_ret[sig] or state.funcs_ret[meta_sig] - if r ~= ret_type then + if r ~= ret_type and not (ret_type == nil or r == "") then state:forceThrow( "Mismatching return types. Got " .. (r or "void") .. ", expected " .. (ret_type or "void")) end @@ -1841,7 +1841,7 @@ local CompileVisitors = { fn = wire_expression2_funcs[sig] or wire_expression2_funcs[meta_sig] if fn then local r = fn[2] - if r ~= ret_type and not (ret_type == nil and r == "") then + if r ~= ret_type and not (ret_type == nil or r == "") then state:forceThrow( "Mismatching return types. Got " .. (r or "void") .. ", expected " .. (ret_type or "void")) end @@ -2132,4 +2132,4 @@ function Compiler:Process(ast) end return self:CompileStmt(ast) -end \ No newline at end of file +end From 34eb822d554625937def6fd82b0fb40deeae20b8 Mon Sep 17 00:00:00 2001 From: AlexALX Date: Tue, 16 Jun 2026 22:08:45 +0300 Subject: [PATCH 2/2] add test script for #2841 issue --- data_static/expression2/tests/regressions/2841.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 data_static/expression2/tests/regressions/2841.txt diff --git a/data_static/expression2/tests/regressions/2841.txt b/data_static/expression2/tests/regressions/2841.txt new file mode 100644 index 0000000000..8676518808 --- /dev/null +++ b/data_static/expression2/tests/regressions/2841.txt @@ -0,0 +1,7 @@ +## SHOULD_PASS:EXECUTE + +function number test() { + return 1 +} + +"test"()