From f1454bbbd13a71da2005ff789cde2da0e9eb81f6 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 22 Jan 2026 15:03:12 +0800 Subject: Adding tests. --- spec/outputs/nil_coalesce_precedence.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spec/outputs/nil_coalesce_precedence.lua (limited to 'spec/outputs/nil_coalesce_precedence.lua') diff --git a/spec/outputs/nil_coalesce_precedence.lua b/spec/outputs/nil_coalesce_precedence.lua new file mode 100644 index 0000000..6f353ee --- /dev/null +++ b/spec/outputs/nil_coalesce_precedence.lua @@ -0,0 +1,24 @@ +local a = nil +local b = false +local c = 0 +local x +if a ~= nil then + x = a +else + do + local _exp_0 = (b and 1) + if _exp_0 ~= nil then + x = _exp_0 + else + x = (c or 2) + end + end +end +local y = ((function() + if a ~= nil then + return a + else + return b + end +end)()) and 1 or 2 +return print(x, y) -- cgit v1.2.3-55-g6feb