Add test for outer scope transient captures

This commit is contained in:
Ayaz Hafiz 2022-08-10 14:38:15 -07:00
parent 5ead673cfc
commit 4b55416ca1
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -3971,3 +3971,25 @@ fn deep_transient_capture_chain_with_multiple_captures() {
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn transient_captures_from_outer_scope() {
assert_evals_to!(
indoc!(
r#"
x = "abc"
getX = \{} -> x
innerScope =
h = \{} -> getX {}
h {}
innerScope
"#
),
RocStr::from("abc"),
RocStr
);
}