Implement loading namespaces with the using
keyword
#829
@ -798,6 +798,14 @@ failing_contracts() ->
|
|||||||
[<<?Pos(2,3)
|
[<<?Pos(2,3)
|
||||||
"Cannot use undefined namespace MyUndefinedNamespace">>
|
"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).
|
-define(Path(File), "code_errors/" ??File).
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
include "Option.aes"
|
include "Option.aes"
|
||||||
include "Pair.aes"
|
include "Pair.aes"
|
||||||
include "String.aes"
|
include "String.aes"
|
||||||
|
include "Triple.aes"
|
||||||
|
|
||||||
using Pair
|
using Pair
|
||||||
|
using Triple hiding [fst, snd]
|
||||||
|
|
||||||
namespace Nsp =
|
namespace Nsp =
|
||||||
using Option
|
using Option
|
||||||
|
|
||||||
function h() =
|
function h() =
|
||||||
let op = Some(2)
|
let op = Some((2, 3, 4))
|
||||||
is_some(op)
|
if (is_some(op))
|
||||||
|
thd(force(op)) == 4
|
||||||
|
else
|
||||||
|
false
|
||||||
|
|
||||||
contract Cntr =
|
contract Cntr =
|
||||||
using Nsp
|
using Nsp
|
||||||
@ -24,7 +29,7 @@ contract Cntr =
|
|||||||
snd(p)
|
snd(p)
|
||||||
|
|
||||||
function g() =
|
function g() =
|
||||||
using String
|
using String for [concat]
|
||||||
|
|
||||||
let s1 = "abc"
|
let s1 = "abc"
|
||||||
let s2 = "def"
|
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