From a9f091bc6573fd7b82ef8591c0240f2011e1aee9 Mon Sep 17 00:00:00 2001 From: Cr4xy Date: Mon, 25 Oct 2021 20:46:00 +0200 Subject: add tests for redundant-return --- test/diagnostics/init.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test') diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index c526560a..ab55cd92 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -1311,6 +1311,43 @@ end local val = {} location('uri', val) ]] + +-- redundant-return +TEST [[ +local function f() + +end +f() +]] + +TEST [[ +local function f() + return nil +end +f() +]] + +TEST [[ +local function f() + local function x() + + end + x() + return true +end +f() +]] + +TEST [[ +local function f() + local function x() + return true + end + return x() +end +f() +]] + ---TODO(arthur) do return end -- cgit v1.2.3