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
This commit is contained in:
+9
-99
@@ -1,102 +1,12 @@
|
||||
// This is a custom test file if you need to run a compiler without
|
||||
// changing aeso_compiler_tests.erl
|
||||
|
||||
contract Identity =
|
||||
// type xy = {x:int, y:int}
|
||||
// type xz = {x:int, z:int}
|
||||
// type yz = {y:int, z:int}
|
||||
record point = {x:int,y:int}
|
||||
record cp('a) = {color: string, p:'a}
|
||||
//type intpoint = point(int)
|
||||
// //if (x==42) 1 else (x*x)
|
||||
// }
|
||||
//let baz() = {age:3, name:(4:int)}
|
||||
//let foo(a,b,c) = c
|
||||
// let rec fac(n) = if((n:int)==0) 1 else (n*fac(n-1))
|
||||
// and main(x) = x::[x+1]
|
||||
// let lentr(l) = lent(0,l)
|
||||
// let rec len(l) =
|
||||
// switch(l) {
|
||||
// | [] => 0
|
||||
// | x::xs => 1+len(xs)
|
||||
// }
|
||||
// let lent(n,l) =
|
||||
// switch (l) {
|
||||
// | [] => n
|
||||
// | (x::xs) => lent(n+1,xs)
|
||||
// }
|
||||
// let rec app(a,b) =
|
||||
// switch(a) {
|
||||
// | [] => b
|
||||
// | (x::xs) => x::app(xs,b)
|
||||
// }
|
||||
// let rec revt(l,r) =
|
||||
// switch(l) {
|
||||
// | [] => r
|
||||
// | x::xs => revt(xs,x::r)
|
||||
// }
|
||||
// let rev(l) = revt(l,[])
|
||||
// let main(x:int) = {
|
||||
// switch(rev([1,2,3])) {
|
||||
// | h::_ => h
|
||||
// }
|
||||
// }
|
||||
//let fac(n:int) = {
|
||||
// if (n==0) 1 else (n*fac(n-1))
|
||||
//}
|
||||
//let main(x) = switch((12,34)) {
|
||||
//| (13,_) => x
|
||||
//| (_,a) => x+a
|
||||
// | y => y+1
|
||||
// }
|
||||
//let main(x) = ({y:0>1, x:x==0}:point(bool))
|
||||
//let main(x) = x
|
||||
//let main(x) = len(1::2::[])
|
||||
//let main(x) = ((x,x):list('a))
|
||||
// let main(x) = switch("a") {
|
||||
// | "b" => 0
|
||||
// | "a" => 1
|
||||
// | "c" => 2
|
||||
// }
|
||||
//let main(x) = x.color+1
|
||||
//let main(x) = switch(({x:x, y:x+1}:cp(int))) {
|
||||
// | {y:xx} => xx
|
||||
// }
|
||||
//let main(x) = {x:0, y:1, z:2}
|
||||
// let id(x) = x
|
||||
// let double(x) = x+x
|
||||
// let pair(x) = (1,2)
|
||||
// let unit(x) = ()
|
||||
// let tuples(x) = ((1,x),(2,3,4))
|
||||
// let singleton(x) = [x]
|
||||
// let rec seq(n) = if (n==0) [] else (app(seq(n-1),[n]))
|
||||
// let idString(s:string) = s
|
||||
// let pairString(s:string) = (s,s)
|
||||
// let revStrings(ss:list(string))=rev(ss)
|
||||
// let makePoint(x,y) = {x:x, y:y}
|
||||
// let getx(x) = x.x
|
||||
// let updatex(p,x) = p{x:x}
|
||||
// let quad(x) = {let y=x+x; let z=y+y; z;}
|
||||
// let noblock(x) = {x; x}
|
||||
// let unit(x) = ()
|
||||
// let foo(x) = switch (x) {
|
||||
// | y => y+1
|
||||
// }
|
||||
// let p(x) = {color:"blue", p:{x:x, y:x+1}}
|
||||
//let twice(f,x) = f(f(x))
|
||||
// let twice(f,x) = f(f(x))
|
||||
// let double(x) = x+x
|
||||
// let main(x) = twice((y=>y+y),x)
|
||||
// let rec map(f,xs) = switch(xs) {
|
||||
// | [] => []
|
||||
// | (x::ys) => f(x)::map(f,ys)
|
||||
// }
|
||||
// let id(x) = x
|
||||
// let main(xs) = map(double,xs)
|
||||
function z(f,x) = x
|
||||
function s(n) = (f,x)=>f(n(f,x))
|
||||
function add(m,n) = (f,x)=>m(f,n(f,x))
|
||||
include "List.aes"
|
||||
|
||||
entrypoint main() =
|
||||
let three=s(s(s(z)))
|
||||
add(three,three)
|
||||
(((i)=>i+1),0)
|
||||
contract IntegerHolder =
|
||||
type state = int
|
||||
entrypoint init(x) = x
|
||||
entrypoint get() = state
|
||||
|
||||
main contract Test =
|
||||
stateful entrypoint f(c) = Chain.clone(ref=c, 123)
|
||||
Reference in New Issue
Block a user