From db35082eeeb338b8d949984f00c2ab6948a4c9db Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Mon, 21 Oct 2024 16:46:27 +0200 Subject: [PATCH] fix: used var detection for `match` function (#1128) --- src/used_variables.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/used_variables.rs b/src/used_variables.rs index 40fe3251..532f6787 100644 --- a/src/used_variables.rs +++ b/src/used_variables.rs @@ -91,7 +91,7 @@ fn extract_variable_from_expression(expr: &Expr, variables: &mut HashSet } else if function == "cdt" { variables.insert("cdt_name".into()); variables.insert("cdt_arch".into()); - } else if function == "cmp" { + } else if function == "match" { extract_variable_from_expression(&call.args[0], variables); } } @@ -316,6 +316,8 @@ mod test { - ${{ pin_subpackage("foobar") }} - ${{ pin_compatible(compatible) }} - ${{ pin_compatible(abc ~ def) }} + - if: match(xpython, ">=3.7") + then: numpy 100 "#; let recipe_node = crate::recipe::custom_yaml::Node::parse_yaml(0, recipe).unwrap(); @@ -332,6 +334,7 @@ mod test { assert!(used_vars.contains("compatible")); assert!(used_vars.contains("abc")); assert!(used_vars.contains("def")); + assert!(used_vars.contains("xpython")); } #[test]