Skip to content

Commit d89fd11

Browse files
Merge pull request #74 from hyperpolymath/fix/ci-corrective
fix(test): remove trailing semicolons in test_opt_if_fold if-branches
2 parents bc2db17 + 0444804 commit d89fd11

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// Test if-expression constant folding
22

33
fn main() -> Int {
4-
let x = if true { 42; } else { 0; }; // Should fold to 42
5-
let y = if false { 99; } else { 10; }; // Should fold to 10
4+
// No trailing semicolons inside the if-branches: a trailing `;` makes
5+
// the branch return Unit, so `let x = if ...` would fail with
6+
// "Unification error: (Unify.TypeMismatch (Unit, Int))". The bare
7+
// expression form returns Int.
8+
let x = if true { 42 } else { 0 }; // Should fold to 42
9+
let y = if false { 99 } else { 10 }; // Should fold to 10
610
return x + y; // 42 + 10 = 52
711
}

0 commit comments

Comments
 (0)