From 18d74230ac1fdcfdacb3aed0e016ec3f5280a36d Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 30 Aug 2019 01:02:55 -0400 Subject: [PATCH] Reproduce transitively used function bug --- tests/test_canonicalize.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_canonicalize.rs b/tests/test_canonicalize.rs index 1ebceb5c8a..e10e4337a0 100644 --- a/tests/test_canonicalize.rs +++ b/tests/test_canonicalize.rs @@ -306,6 +306,29 @@ mod test_canonicalize { }.into()); } + #[test] + fn transitively_used_function() { + // This should report that neither a nor b are unused, + // since if you never call a function but do return it, that's okay! + let (_, output, problems, _) = can_expr(indoc!(r#" + a = \_ -> 42 + b = a + + b + "#)); + + assert_eq!(problems, Vec::new()); + + assert_eq!(output, Out { + locals: vec!["a", "b"], + globals: vec![], + variants: vec![], + calls: vec![], + tail_call: None + }.into()); + } + + // ASSIGNMENT REORDERING #[test]