diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index a3455eb..87dd677 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -1814,6 +1814,10 @@ occurs_check1(R, {tuple_t, _, Ts}) -> occurs_check(R, Ts); occurs_check1(R, {named_arg_t, _, _, T, _}) -> occurs_check(R, T); +occurs_check1(R, {record_t, Fields}) -> + occurs_check(R, Fields); +occurs_check1(R, {field_t, _, _, T}) -> + occurs_check(R, T); occurs_check1(R, [H | T]) -> occurs_check(R, H) orelse occurs_check(R, T); occurs_check1(_, []) -> false. diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index b37ddc4..a894cac 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -114,7 +114,8 @@ compilable_contracts() -> "bitcoin_auth", "address_literals", "bytes_equality", - "address_chain" + "address_chain", + "namespace_bug" ]. not_yet_compilable(fate) -> diff --git a/test/contracts/namespace_bug.aes b/test/contracts/namespace_bug.aes new file mode 100644 index 0000000..62ad202 --- /dev/null +++ b/test/contracts/namespace_bug.aes @@ -0,0 +1,12 @@ + +namespace Foo = + + record bla = {x : int, y : bool} + + function bar() : Foo.bla = {x = 17, y = true} + +contract Bug = + + // Crashed the type checker + function foo () = Foo.bar() +