From 21c16158ce4d68dc98e0d155309fdc19d9ac53fa Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Wed, 18 Aug 2021 17:09:49 +0300 Subject: [PATCH] Add test for wrong scope of using namespace --- test/aeso_compiler_tests.erl | 6 ++++++ .../contracts/using_namespace_wrong_scope.aes | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/contracts/using_namespace_wrong_scope.aes diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index d7f0b30..646177b 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -788,6 +788,12 @@ failing_contracts() -> , <> ]) + , ?TYPE_ERROR(using_namespace_wrong_scope, + [ <> + , <> + ]) ]. -define(Path(File), "code_errors/" ??File). diff --git a/test/contracts/using_namespace_wrong_scope.aes b/test/contracts/using_namespace_wrong_scope.aes new file mode 100644 index 0000000..8e8c298 --- /dev/null +++ b/test/contracts/using_namespace_wrong_scope.aes @@ -0,0 +1,21 @@ +namespace Nsp1 = + function f() = 1 + +namespace Nsp2 = + using Nsp1 + + function g() = 1 + +contract Cntr = + using Nsp2 + + type state = int + + function x() = + using Nsp1 + f() + + function y() = + f() + + entrypoint init() = f()