fixing tests

This commit is contained in:
Folkert 2020-07-31 00:49:16 +02:00
parent 01f9539d8e
commit f48a661b3d
3 changed files with 9 additions and 7 deletions

View file

@ -77,9 +77,14 @@ pub fn symbols_from_pattern_help(pattern: &Pattern, symbols: &mut Vec<Symbol>) {
} }
RecordDestructure { destructs, .. } => { RecordDestructure { destructs, .. } => {
for destruct in destructs { for destruct in destructs {
// when a record field has a pattern guard, only symbols in the guard are introduced
if let DestructType::Guard(_, subpattern) = &destruct.value.typ {
symbols_from_pattern_help(&subpattern.value, symbols);
} else {
symbols.push(destruct.value.symbol); symbols.push(destruct.value.symbol);
} }
} }
}
NumLiteral(_, _) NumLiteral(_, _)
| IntLiteral(_) | IntLiteral(_)

View file

@ -451,6 +451,7 @@ impl<'a> Expr<'a> {
.append(alloc.hardline()) .append(alloc.hardline())
.append(expr.to_doc(alloc, false)), .append(expr.to_doc(alloc, false)),
Store(stores, expr) if stores.is_empty() => expr.to_doc(alloc, false),
Store(stores, expr) => { Store(stores, expr) => {
let doc_stores = stores let doc_stores = stores
.iter() .iter()

View file

@ -868,11 +868,10 @@ mod test_mono {
Store Test.1: Just 0i64 3i64 Store Test.1: Just 0i64 3i64
Store Test.1: Load Test.1 Store Test.1: Load Test.1
Store Test.3: Lowlevel.And (Lowlevel.Eq 0i64 (Access @0 Load Test.1)) true Store Test.3: Lowlevel.And (Lowlevel.Eq 0i64 (Access @0 Load Test.1)) true
if Test.3 then if Test.3 then
Reset Test.1 Reset Test.1
Reuse Test.1 Reuse Test.1
Just 0i64 *magic* Just 0i64 (Call Num.14 (Load Test.2) 1i64)
else else
Reset Test.1 Reset Test.1
Reuse Test.1 Reuse Test.1
@ -902,9 +901,7 @@ mod test_mono {
Store Test.1: Just 0i64 Just 0i64 3i64 Store Test.1: Just 0i64 Just 0i64 3i64
Store Test.1: Load Test.1 Store Test.1: Load Test.1
Store Test.5: Lowlevel.And (Lowlevel.Eq 0i64 (Access @0 Load Test.1)) true Store Test.5: Lowlevel.And (Lowlevel.Eq 0i64 (Access @0 Load Test.1)) true
if Test.5 then if Test.5 then
if Test.4 then if Test.4 then
Just 0i64 Just 0i64 1i64 Just 0i64 Just 0i64 1i64
else else
@ -937,7 +934,6 @@ mod test_mono {
r#" r#"
Store Test.1: These 1i64 1i64 2i64 Store Test.1: These 1i64 1i64 2i64
Store Test.1: Load Test.1 Store Test.1: Load Test.1
switch Test.1: switch Test.1:
case 2: case 2:
Reset Test.1 Reset Test.1
@ -974,7 +970,7 @@ mod test_mono {
Lowlevel.ListLen (Load #Attr.2) Lowlevel.ListLen (Load #Attr.2)
Store Test.0: [ 1i64, 2i64, 3i64 ] Store Test.0: [ 1i64, 2i64, 3i64 ]
*magic* Call List.7 (Load Test.0)
Dec Test.0 Dec Test.0
"# "#
), ),