/ test / contracts / remote_type_check.aes
remote_type_check.aes
 1  contract interface Remote =
 2    entrypoint id : ('a) => 'a
 3    entrypoint missing : ('a) => 'a
 4    entrypoint bogus_string_string_arg : (string) => string
 5    entrypoint bogus_string_string_ret : (string) => string
 6    entrypoint bogus_id : ('a) => ('a)
 7  
 8  contract Main =
 9  
10    type state = int
11  
12    entrypoint init() = 0
13  
14    entrypoint next_state() = state + 1
15  
16    entrypoint id(x : int) =
17      x
18  
19    entrypoint bogus_id(x) =
20      (x, x)
21  
22    entrypoint bogus_string_string_arg(x : int) =
23      "hello"
24  
25    entrypoint bogus_string_string_ret(x : string) =
26      42
27  
28    entrypoint remote_id(r : Remote, x) =
29      r.id(x)
30  
31    entrypoint remote_missing(r : Remote, x) =
32      r.missing(x)
33  
34    entrypoint remote_wrong_arg(r : Remote, x) =
35      r.bogus_string_string_arg(x)
36  
37    entrypoint remote_wrong_ret(r : Remote, x) =
38      (r.bogus_string_string_ret(x), r.bogus_string_string_ret(x))
39  
40    entrypoint remote_wrong_ret_tailcall(r : Remote, x) : string =
41      r.bogus_string_string_ret(x)
42  
43    entrypoint remote_wrong_ret_tailcall_type_vars(r : Remote, x) =
44      r.bogus_id(x)
45  
46    stateful entrypoint remote_wrong_put(r : Remote, x) =
47      put(r.bogus_id(x))
48  
49    function call_bogus_id(r : Remote, x : 'a) : 'a = r.bogus_id(x)
50  
51    stateful entrypoint remote_wrong_put_polymorphic(r : Remote, x) =
52      put(call_bogus_id(r, x))
53