From 6c2f08ef4991df5d39305507bcaf41a2315491f5 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sun, 15 Mar 2026 13:34:12 -0500 Subject: [PATCH] Add unit tests for variable shadowing. --- test/suite-compile.janet | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/suite-compile.janet b/test/suite-compile.janet index 5f7270c0..5b0c5d54 100644 --- a/test/suite-compile.janet +++ b/test/suite-compile.janet @@ -150,5 +150,10 @@ (check-lint-compile '(g 1 2 :z) "g lint 1") (check-lint-compile '(g 1 2 :z 4 5) "g lint 2") -(end-suite) +# Variable shadowing linting +(def outer1 "a") +(check-lint-compile '(def outer1 "b") "shadow global-to-global") +(check-lint-compile '(let [outer1 "b"] outer1) "shadow local-to-global") +(check-lint-compile '(do (def x "b") (def x "c")) "shadow local-to-local") +(end-suite)