diff options
author | Erik Svedäng <erik.svedang@gmail.com> | 2022-01-03 19:13:13 +0100 |
---|---|---|
committer | Erik Svedäng <erik.svedang@gmail.com> | 2022-01-03 19:13:13 +0100 |
commit | c1b0d8ac5ff56256d5c29e95925ed3144cfccd10 (patch) | |
tree | 1ffd15cb39acdb31021e0fca987720b0fee77eb3 | |
parent | 47f8addc699a8b0f6fa63ab30837a569652e28c4 (diff) |
test: a test-for-error that should work, but needs more advanced lifetimesstack-allocated-lambdas-error-test
-rw-r--r-- | test/output/test/test-for-errors/return_lambda_that_captures.carp.output.expected | 1 | ||||
-rw-r--r-- | test/test-for-errors/return_lambda_that_captures.carp | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/test/output/test/test-for-errors/return_lambda_that_captures.carp.output.expected b/test/output/test/test-for-errors/return_lambda_that_captures.carp.output.expected new file mode 100644 index 00000000..224c134a --- /dev/null +++ b/test/output/test/test-for-errors/return_lambda_that_captures.carp.output.expected @@ -0,0 +1 @@ +return_lambda_that_captures.carp:4:3 The reference '(let [s (String.copy "DATA")] (fn <s : String> [] s))' isn't alive. diff --git a/test/test-for-errors/return_lambda_that_captures.carp b/test/test-for-errors/return_lambda_that_captures.carp new file mode 100644 index 00000000..303f9dbe --- /dev/null +++ b/test/test-for-errors/return_lambda_that_captures.carp @@ -0,0 +1,7 @@ +(Project.config "file-path-print-length" "short") + +(defn not-allowed [] + (let [s @"DATA"] + (fn [] s) + ;; Note: 's' will get deleted here (since the lambda is a ref) + )) |