diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index 676814d..950131c 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -2263,8 +2263,8 @@ mk_t_err(Pos, Msg, Ctxt) -> aeso_errors:new(type_error, Pos, lists:flatten(Msg), lists:flatten(Ctxt)). mk_error({higher_kinded_typevar, T}) -> - Msg = io_lib:format("Type ~s is higher kinded (takes a type argument that takes\n" - "a type argument)\n", [pp(instantiate(T))] + Msg = io_lib:format("Type ~s is a higher kinded type variable\n" + "(takes another type as an argument)\n", [pp(instantiate(T))] ), mk_t_err(pos(T), Msg); mk_error({wrong_type_arguments, X, ArityGiven, ArityReal}) -> diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index 4b83d0e..c6f5b9f 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -375,11 +375,15 @@ failing_contracts() -> " r.foo : (gas : int, value : int) => Remote.themap\n" "against the expected type\n" " (gas : int, value : int) => map(string, int)">>]) - , ?TYPE_ERROR(bad_include_and_ns, - [<>, - <>]) + , ?TYPE_ERROR(not_toplevel_include, + [<>]) + , ?TYPE_ERROR(not_toplevel_namespace, + [<>]) + , ?TYPE_ERROR(not_toplevel_contract, + [<>]) , ?TYPE_ERROR(bad_address_literals, [< [<>]) + , ?TYPE_ERROR(toplevel_let, + [<>]) + , ?TYPE_ERROR(empty_typedecl, + [<>]) + , ?TYPE_ERROR(higher_kinded_type, + [<>]) + , ?TYPE_ERROR(bad_arity, + [<>, + <>, + <>, + <>]) + , ?TYPE_ERROR(bad_unnamed_map_update_default, + [<>]) + , ?TYPE_ERROR(non_functional_entrypoint, + [<>]) , ?TYPE_ERROR(bad_records, [< 'm('a * 's) + entrypoint s() = 123 \ No newline at end of file diff --git a/test/contracts/non_functional_entrypoint.aes b/test/contracts/non_functional_entrypoint.aes new file mode 100644 index 0000000..4162e38 --- /dev/null +++ b/test/contracts/non_functional_entrypoint.aes @@ -0,0 +1,5 @@ +contract C1 = + entrypoint f : int + +contract C = + entrypoint f() = 123 \ No newline at end of file diff --git a/test/contracts/not_toplevel_contract.aes b/test/contracts/not_toplevel_contract.aes new file mode 100644 index 0000000..4d2c579 --- /dev/null +++ b/test/contracts/not_toplevel_contract.aes @@ -0,0 +1,6 @@ +namespace BadNs = + contract Con = + entrypoint e : () => int + +contract Con = + entrypoint foo() = 43 diff --git a/test/contracts/not_toplevel_include.aes b/test/contracts/not_toplevel_include.aes new file mode 100644 index 0000000..0b08c88 --- /dev/null +++ b/test/contracts/not_toplevel_include.aes @@ -0,0 +1,5 @@ +namespace BadNs = + include "included.aes" + +contract Con = + entrypoint foo() = 43 diff --git a/test/contracts/bad_include_and_ns.aes b/test/contracts/not_toplevel_namespace.aes similarity index 62% rename from test/contracts/bad_include_and_ns.aes rename to test/contracts/not_toplevel_namespace.aes index 42ebe67..df27823 100644 --- a/test/contracts/bad_include_and_ns.aes +++ b/test/contracts/not_toplevel_namespace.aes @@ -1,5 +1,4 @@ -contract Bad = - include "included.aes" +contract BadCon = namespace Foo = function foo() = 42 diff --git a/test/contracts/toplevel_let.aes b/test/contracts/toplevel_let.aes new file mode 100644 index 0000000..adca04c --- /dev/null +++ b/test/contracts/toplevel_let.aes @@ -0,0 +1,3 @@ +contract C = + let this_is_illegal = 2/0 + entrypoint this_is_legal() = 2/0 \ No newline at end of file