aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-08-21 10:16:19 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-08-21 10:16:19 +0100
commitcca381f29cc019ee91579006b7bc5681cb204b46 (patch)
tree37aaccfc56a0ef184d105e257b02e5bf9aa1bde9
parent6660222a799c57b71eb0272dbe53d76f36c0e4be (diff)
downloadmicro-lang-hs-cca381f29cc019ee91579006b7bc5681cb204b46.tar.gz
micro-lang-hs-cca381f29cc019ee91579006b7bc5681cb204b46.zip
Test lambdas can access local variables only
-rw-r--r--test/Language.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/Language.hs b/test/Language.hs
index da5d288..f23fa9a 100644
--- a/test/Language.hs
+++ b/test/Language.hs
@@ -234,6 +234,16 @@ testCase18 =
\def fn(a: u8): u8 { return undef; }\n"
E.Undefined
+testCase19 =
+ TestLabel "lambdas can use only local variables" $
+ TestCase $
+ expectError
+ "module main\n\
+ \def fn(a: u8): () -> u8 {\n\
+ \return (): u8 { return a; };\n\
+ \}\n"
+ E.Undefined
+
language =
[ testCase1,
testCase2,
@@ -252,5 +262,6 @@ language =
testCase15,
testCase16,
testCase17,
- testCase18
+ testCase18,
+ testCase19
]