fix: Discard not taken into account in backpassing
closes #890 Co-authored-by: Kasey White <kwhitemsg@gmail.com>
This commit is contained in:
@@ -2008,3 +2008,25 @@ fn correct_span_for_backpassing_args() {
|
||||
matches!(&warnings[0], Warning::UnusedVariable { ref name, location } if name == "b" && location.start == 245 && location.end == 246)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn allow_discard_for_backpassing_args() {
|
||||
let source_code = r#"
|
||||
fn fold(list: List<a>, acc: b, f: fn(a, b) -> b) -> b {
|
||||
when list is {
|
||||
[] -> acc
|
||||
[x, ..xs] -> fold(xs, f(x, acc), f)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sum(list: List<Int>) -> Int {
|
||||
let a, _b <- fold(list, 0)
|
||||
|
||||
a + 1
|
||||
}
|
||||
"#;
|
||||
|
||||
let (warnings, _ast) = check(parse(source_code)).unwrap();
|
||||
|
||||
assert_eq!(warnings.len(), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user