Implement loading namespaces with the using
keyword
#829
@ -798,6 +798,14 @@ failing_contracts() ->
|
||||
[<<?Pos(2,3)
|
||||
"Cannot use undefined namespace MyUndefinedNamespace">>
|
||||
])
|
||||
, ?TYPE_ERROR(using_namespace_undefined_parts,
|
||||
[<<?Pos(5,3)
|
||||
"The namespace Nsp does not define the following names: a">>
|
||||
])
|
||||
, ?TYPE_ERROR(using_namespace_hidden_parts,
|
||||
[<<?Pos(8,23)
|
||||
"Unbound variable g at line 8, column 23">>
|
||||
])
|
||||
].
|
||||
|
||||
-define(Path(File), "code_errors/" ??File).
|
||||
|
@ -1,15 +1,20 @@
|
||||
include "Option.aes"
|
||||
include "Pair.aes"
|
||||
include "String.aes"
|
||||
include "Triple.aes"
|
||||
|
||||
using Pair
|
||||
using Triple hiding [fst, snd]
|
||||
|
||||
namespace Nsp =
|
||||
using Option
|
||||
|
||||
function h() =
|
||||
let op = Some(2)
|
||||
is_some(op)
|
||||
let op = Some((2, 3, 4))
|
||||
if (is_some(op))
|
||||
thd(force(op)) == 4
|
||||
else
|
||||
false
|
||||
|
||||
contract Cntr =
|
||||
using Nsp
|
||||
@ -24,7 +29,7 @@ contract Cntr =
|
||||
snd(p)
|
||||
|
||||
function g() =
|
||||
using String
|
||||
using String for [concat]
|
||||
|
||||
let s1 = "abc"
|
||||
let s2 = "def"
|
||||
|
8
test/contracts/using_namespace_hidden_parts.aes
Normal file
8
test/contracts/using_namespace_hidden_parts.aes
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Nsp =
|
||||
function f() = 1
|
||||
function g() = 2
|
||||
|
||||
contract Cntr =
|
||||
using Nsp for [f]
|
||||
|
||||
entrypoint init() = g()
|
7
test/contracts/using_namespace_undefined_parts.aes
Normal file
7
test/contracts/using_namespace_undefined_parts.aes
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Nsp =
|
||||
function f() = 1
|
||||
|
||||
contract Cntr =
|
||||
using Nsp for [a]
|
||||
|
||||
entrypoint init() = f()
|
Loading…
x
Reference in New Issue
Block a user