diff --git a/src/contracts/annotation.ligo b/src/contracts/annotation.ligo index 1cae3ffe9..2029e3aa6 100644 --- a/src/contracts/annotation.ligo +++ b/src/contracts/annotation.ligo @@ -1,3 +1,5 @@ +// Test that type annotations work in PascaLIGO + const lst : list(int) = list [] ; const address : address = "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; diff --git a/src/contracts/arithmetic.ligo b/src/contracts/arithmetic.ligo index efaa0e62b..1040aeebf 100644 --- a/src/contracts/arithmetic.ligo +++ b/src/contracts/arithmetic.ligo @@ -1,3 +1,5 @@ +// Test PascaLIGO arithmetic operators + function mod_op (const n : int) : nat is begin skip end with n mod 42 diff --git a/src/contracts/bitwise_arithmetic.ligo b/src/contracts/bitwise_arithmetic.ligo index 0711b5854..282b82be9 100644 --- a/src/contracts/bitwise_arithmetic.ligo +++ b/src/contracts/bitwise_arithmetic.ligo @@ -1,3 +1,5 @@ +// Test PascaLIGO bitwise operators + function or_op (const n : nat) : nat is begin skip end with bitwise_or(n , 4n) diff --git a/src/contracts/boolean_operators.ligo b/src/contracts/boolean_operators.ligo index 38b94ba02..4b53ff2d5 100644 --- a/src/contracts/boolean_operators.ligo +++ b/src/contracts/boolean_operators.ligo @@ -1,3 +1,5 @@ +// Test PascaLIGO boolean operators + function or_true (const b : bool) : bool is begin skip end with b or True diff --git a/src/contracts/closure-3.ligo b/src/contracts/closure-3.ligo index 71fb67269..98ad10cb0 100644 --- a/src/contracts/closure-3.ligo +++ b/src/contracts/closure-3.ligo @@ -1,3 +1,7 @@ +// This might seem like it's covered by induction with closure-2.ligo +// But it exists to prevent a regression on the bug patched by: +// https://gitlab.com/ligolang/ligo/commit/faf3bbc06106de98189f1c1673bd57e78351dc7e + function foobar(const i : int) : int is const j : int = 3 ; const k : int = 4 ; diff --git a/src/contracts/condition-simple.ligo b/src/contracts/condition-simple.ligo index 708d4c6b5..9df22cbe3 100644 --- a/src/contracts/condition-simple.ligo +++ b/src/contracts/condition-simple.ligo @@ -1,3 +1,5 @@ +// Test if conditional with trivial conditions in PascaLIGO + function main (const i : int) : int is begin if 1 = 1 then diff --git a/src/contracts/condition.ligo b/src/contracts/condition.ligo index 68c949640..98672b1c9 100644 --- a/src/contracts/condition.ligo +++ b/src/contracts/condition.ligo @@ -1,3 +1,5 @@ +// Test if conditional in PascaLIGO + function main (const i : int) : int is var result : int := 23 ; begin diff --git a/src/contracts/declaration-local.ligo b/src/contracts/declaration-local.ligo index 94d443b32..97f380112 100644 --- a/src/contracts/declaration-local.ligo +++ b/src/contracts/declaration-local.ligo @@ -1,3 +1,5 @@ +// Test PasaLIGO variable declarations inside of a block + function main (const i : int) : int is block { const j : int = 42 ; } with j diff --git a/src/contracts/declarations.ligo b/src/contracts/declarations.ligo index c153b0c57..4001fbdbf 100644 --- a/src/contracts/declarations.ligo +++ b/src/contracts/declarations.ligo @@ -1,3 +1,5 @@ +// Test PascaLIGO top level declarations + const foo : int = 42 function main (const i : int) : int is diff --git a/src/contracts/error_type.ligo b/src/contracts/error_type.ligo index 79e114388..6f828b9bf 100644 --- a/src/contracts/error_type.ligo +++ b/src/contracts/error_type.ligo @@ -1 +1,3 @@ -const foo : nat = 42 + "bar" \ No newline at end of file +// Test that PascaLIGO will reject a type declaration with improper value expression + +const foo : nat = 42 + "bar" diff --git a/src/contracts/function-complex.ligo b/src/contracts/function-complex.ligo index ec34cab7e..f1f33c74c 100644 --- a/src/contracts/function-complex.ligo +++ b/src/contracts/function-complex.ligo @@ -1,3 +1,5 @@ +// Test a PascaLIGO function with more complex logic than function.ligo + function main (const i : int) : int is var j : int := 0 ; var k : int := 1 ; diff --git a/src/contracts/function-shared.ligo b/src/contracts/function-shared.ligo index c84fec402..0155b5cb1 100644 --- a/src/contracts/function-shared.ligo +++ b/src/contracts/function-shared.ligo @@ -1,3 +1,5 @@ +// Test a PascaLIGO function which uses other functions as subroutines + function inc ( const i : int ) : int is block { skip } with i + 1 diff --git a/src/contracts/function.ligo b/src/contracts/function.ligo index 8149b2e15..27f4437ef 100644 --- a/src/contracts/function.ligo +++ b/src/contracts/function.ligo @@ -1,3 +1,5 @@ +// Test a trivial PascaLIGO function + function main (const i : int) : int is begin skip diff --git a/src/contracts/heap.ligo b/src/contracts/heap.ligo index 23d7425b7..48130f96b 100644 --- a/src/contracts/heap.ligo +++ b/src/contracts/heap.ligo @@ -1,3 +1,6 @@ +// Implementation of the heap data structure in PascaLIGO +// See: https://en.wikipedia.org/wiki/Heap_%28data_structure%29 + type heap is map(nat, heap_element) ; function is_empty (const h : heap) : bool is diff --git a/src/contracts/high-order.ligo b/src/contracts/high-order.ligo index 8dc7f3e4b..7c897d4ee 100644 --- a/src/contracts/high-order.ligo +++ b/src/contracts/high-order.ligo @@ -1,3 +1,5 @@ +// Test a PascaLIGO function which takes another PascaLIGO function as an argument + function foobar (const i : int) : int is function foo (const i : int) : int is block { skip } with i ; diff --git a/src/contracts/included.ligo b/src/contracts/included.ligo index 3f0a2d1ca..1ab1451af 100644 --- a/src/contracts/included.ligo +++ b/src/contracts/included.ligo @@ -1 +1,3 @@ +// Test PascaLIGO inclusion statements, see includer.ligo + const foo : int = 144 diff --git a/src/contracts/includer.ligo b/src/contracts/includer.ligo index e68975796..3afbfaa79 100644 --- a/src/contracts/includer.ligo +++ b/src/contracts/includer.ligo @@ -1,3 +1,5 @@ +// Test PascaLIGO inclusion statements, see included.ligo + #include "included.ligo" const bar : int = foo diff --git a/src/contracts/list.ligo b/src/contracts/list.ligo index a533d12e2..0a1d0c05d 100644 --- a/src/contracts/list.ligo +++ b/src/contracts/list.ligo @@ -1,3 +1,5 @@ +// Test list type and related built-in functions in PascaLIGO + type foobar is list(int) const fb : foobar = list diff --git a/src/contracts/loop.ligo b/src/contracts/loop.ligo index 0408f85ef..fcba9fda7 100644 --- a/src/contracts/loop.ligo +++ b/src/contracts/loop.ligo @@ -1,3 +1,5 @@ +// Test while loops in PascaLIGO + function counter (var n : nat) : nat is block { var i : nat := 0n ; while (i < n) block { diff --git a/src/contracts/map.ligo b/src/contracts/map.ligo index f0576bf54..af3697768 100644 --- a/src/contracts/map.ligo +++ b/src/contracts/map.ligo @@ -1,3 +1,5 @@ +// Test map type and related built-in functions in PascaLIGO + type foobar is map(int, int) const fb : foobar = map diff --git a/src/contracts/match.ligo b/src/contracts/match.ligo index ff5e3a0a4..fa204e5e1 100644 --- a/src/contracts/match.ligo +++ b/src/contracts/match.ligo @@ -1,3 +1,5 @@ +// Test the pattern matching functionality of PascaLIGO + function match_bool (const i : int) : int is var result : int := 23 ; begin diff --git a/src/contracts/multiple-parameters.ligo b/src/contracts/multiple-parameters.ligo index fe2373076..26f5daa0d 100644 --- a/src/contracts/multiple-parameters.ligo +++ b/src/contracts/multiple-parameters.ligo @@ -1,3 +1,5 @@ +// Test functions with several parameters in PascaLIGO + function ab(const a : int; const b : int) : int is begin skip end with (a + b) diff --git a/src/contracts/option.ligo b/src/contracts/option.ligo index 85e3396e0..c2d36439d 100644 --- a/src/contracts/option.ligo +++ b/src/contracts/option.ligo @@ -1,3 +1,5 @@ +// Test the option type in PascaLIGO + type foobar is option(int) const s : foobar = Some(42) diff --git a/src/contracts/record.ligo b/src/contracts/record.ligo index e0fbb5d04..cb578abb0 100644 --- a/src/contracts/record.ligo +++ b/src/contracts/record.ligo @@ -1,3 +1,5 @@ +// Test record type in PascaLIGO + type foobar is record foo : int ; bar : int ; diff --git a/src/contracts/set_arithmetic-1.ligo b/src/contracts/set_arithmetic-1.ligo index 2397f72b5..0cfab61d2 100644 --- a/src/contracts/set_arithmetic-1.ligo +++ b/src/contracts/set_arithmetic-1.ligo @@ -1,3 +1,5 @@ +// Test set iteration in PascaLIGO + function iter_op (const s : set(int)) : int is var r : int := 0 ; function aggregate (const i : int) : unit is diff --git a/src/contracts/set_arithmetic.ligo b/src/contracts/set_arithmetic.ligo index f85e42394..cd7c1175c 100644 --- a/src/contracts/set_arithmetic.ligo +++ b/src/contracts/set_arithmetic.ligo @@ -1,3 +1,5 @@ +// Test set type and basic operations in PascaLIGO + const s_e : set(string) = (set_empty : set(string)) const s_fb : set(string) = set [