anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
457 stars 53 forks source link

`juvix format` breaks `else` clause in multiway if syntax #2879

Closed paulcadman closed 4 months ago

paulcadman commented 4 months ago

Reproduced using the latest nightly build.

This bug was introduced since the 0.6.3 release, possibly in https://github.com/anoma/juvix/pull/2852

Consider a module that contains multiway if syntax:

module Bug;

import Stdlib.Prelude open;

a : Nat :=
  if
    | true := 1
    | else := 2;

and run juvix format --inplace, the following is the result:

module Bug;

import Stdlib.Prelude open;

a : Nat :=
  if
    | true := 1
    else := 2;

and this does not typecheck:

$ juvix typecheck Bug.juvix
/private/tmp/Bug.juvix:8:9: error:
/private/tmp/Bug.juvix:8:9:
  |
8 |     else := 2;
  |         ^
expecting |