Skip to content

Commit

Permalink
format juvix files
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed May 14, 2024
1 parent 57a48e8 commit 231ee87
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 34 deletions.
2 changes: 1 addition & 1 deletion tests/negative/issue1337/DoubleBraces.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ type Nat :=
| O : Nat
| S : Nat -> Nat;

fun (n : Nat) : Nat := case n of {S {{y}} := O};
fun (n : Nat) : Nat := case n of S {{y}} := O;
5 changes: 2 additions & 3 deletions tests/positive/Alias.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ not2 (b : Boolean) : Boolean :=
let
syntax alias yes := ⊤;
syntax alias no := ⊥;
in case b of {
in case b of
| no := yes
| yes := no
};
| yes := no;

module ExportAlias;
syntax alias Binary := Bool;
Expand Down
2 changes: 1 addition & 1 deletion tests/positive/AliasRecordConstructor.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ t : T :=
};

t1 : T -> A
| mkT'@{ field := x } := x;
| mkT'@{field := x} := x;

syntax iterator it {init := 0; range := 1};
it : (A → A) → T → A
Expand Down
19 changes: 8 additions & 11 deletions tests/positive/Format.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,28 @@ M;
end;

-- case with single branch
case1 (n : Nat) : Nat := case n of {x := zero};
case1 (n : Nat) : Nat := case n of x := zero;

-- case with multiple branches
case2 (n : Nat) : Nat :=
case n of {
case n of
| zero := zero
| _ := zero
};
| _ := zero;

-- case on nested case
case3 (n : Nat) : Nat :=
case case n of {_ := zero} of {
case case n of {_ := zero} of
| zero := zero
| _ := zero
};
| _ := zero;

-- case on nested case expression
case4 (n : Nat) : Nat :=
case n of {
case n of
| zero := case n of {x := zero}
| _ := zero
};
| _ := zero;

-- -- case with application subject
case5 (n : Nat) : Nat := case id n of {x := zero};
case5 (n : Nat) : Nat := case id n of x := zero;

-- qualified commas
t4 : String := "a" M., "b" M., "c" M., "d";
Expand Down
7 changes: 3 additions & 4 deletions tests/positive/ImportShadow/Main.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import Nat open;

type Unit := unit : Unit;

f : Nat := case unit of {is-zero := zero};
f : Nat := case unit of is-zero := zero;

f2 : Nat :=
case suc zero of {
case suc zero of
| suc is-zero := zero
| _ := zero
};
| _ := zero;

f3 : Nat → Nat
| (suc is-zero) := is-zero
Expand Down
5 changes: 2 additions & 3 deletions tests/positive/ImportShadow/Nat.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type Nat :=

is-zero : Nat → Bool
| n :=
case n of {
case n of
| zero := true
| suc _ := false
};
| suc _ := false;
2 changes: 1 addition & 1 deletion tests/positive/InstanceImport/Main.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ type Bool :=
instance
boolI : T Bool := mkT λ {x := x};

main : Bool := case T.pp unit of {unit := T.pp true};
main : Bool := case T.pp unit of unit := T.pp true;
5 changes: 2 additions & 3 deletions tests/positive/Iterators.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ main : Bool :=
z : Bool := false;
in itconst (a := true; b := false) (c in false; d in false)
for (x := true) (y in false)
case x of {
case x of
| true := y
| false := z
};
| false := z;
5 changes: 2 additions & 3 deletions tests/positive/LetShadow.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ type Nat :=
type Unit := unit : Unit;

t : Nat :=
case unit of {
case unit of
x :=
let
x : Nat := suc zero;
in x
};
in x;
5 changes: 2 additions & 3 deletions tests/positive/NestedPatterns.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ toList : {A : Type} -> MyList A -> List A

f : MyList Nat -> Nat
| xs :=
case toList xs of {
case toList xs of
| suc n :: nil := n
| _ := zero
};
| _ := zero;
2 changes: 1 addition & 1 deletion tests/positive/Traits2.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import Stdlib.Data.Product open;
{{Semigroup A}}
{B C : Type}
: A × B -> (B -> A × C) -> A × C
| (a, b) f := case f b of {a', b' := a <> a', b'};
| (a, b) f := case f b of a', b' := a <> a', b';

instance
×-Monad
Expand Down

0 comments on commit 231ee87

Please sign in to comment.