Order list-min-size tests in descending order

Some of the head-constructor tests we generate can be supersets of other tests.
Edges must be ordered so that more general tests always happen after their
specialized variants.

For example, patterns

  [1, ..] -> ...
  [2, 1, ..] -> ...

may generate the edges

  ListLen(>=1) -> <rest>
  ListLen(>=2) -> <rest>

but evaluated in exactly this order, the second edge is never reachable.
The necessary ordering is

  ListLen(>=2) -> <rest>
  ListLen(>=1) -> <rest>

Closes #4732
This commit is contained in:
Ayaz Hafiz 2022-12-14 12:58:33 -06:00
parent a295e7ac3d
commit a8693e6102
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 324 additions and 31 deletions

View file

@ -2220,3 +2220,17 @@ fn lambda_set_with_imported_toplevels_issue_4733() {
"###
)
}
#[mono_test]
fn order_list_size_tests_issue_4732() {
indoc!(
r###"
when [] is
[1, ..] -> "B1"
[2, 1, ..] -> "B2"
[3, 2, 1, ..] -> "B3"
[4, 3, 2, 1, ..] -> "B4"
_ -> "Catchall"
"###
)
}