sophia/test/contracts/lhs_matching.aes
Radosław Rowicki 1d9f59fec3
Contract factories and bytecode introspection (#305)
* Support for CREATE, CLONE and BYTECODE_HASH

* Add missing files

* Pushed the clone example through the typechecker

* CLONE compiles

* Fix dependent type in CLONE

* Bytecode hash fixes

* Refactor

* Refactor 2

* move some logic away

* Fixed some error messages. Type inference of child contract still does some random shit\n(mistakes arguments with result type)

* CREATE sometimes compiles and sometimes not

* Fix some scoping/constraint issues

* works, needs cleanup

* cleanup

* Fix some tests. Remove optimization of singleton tuples

* Fix default argument for clone

* Cleanup

* CHANGELOG

* Mention void type

* Address review, fix some dialyzer errors

* Please dialyzer

* Fix failing tests

* Write negative tests

* Docs

* TOC

* missing 'the'

* missing 'the'

* missing 'the'

* missing 'the'

* mention pre-fund

* format

* pre-fund clarification

* format

* Grammar in docs
2021-05-18 12:21:57 +02:00

23 lines
503 B
Plaintext

contract LHSMatching =
function from_some(Some(x)) = x
function
length : list('a) => int
length([]) = 0
length(_ :: xs) = 1 + length(xs)
function
append([], ys) = ys
append(x :: xs, ys) = x :: append(xs, ys)
function local_match(xs : list('a)) =
let null([]) = true
let null(_ :: _) = false
!null(xs)
entrypoint main_fun() =
from_some(Some([0]))
++ append([length([true]), 2, 3], [4, 5, 6])
++ [7 | if (local_match([false]))]