diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index dd50909..a35d395 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -4287,7 +4287,7 @@ pp({tuple_t, _, []}) -> "unit"; pp({tuple_t, _, Cpts}) -> ["(", string:join(lists:map(fun pp/1, Cpts), " * "), ")"]; -pp({bytes_t, _, any}) -> "bytes(_)"; +pp({bytes_t, _, any}) -> "bytes()"; pp({bytes_t, _, Len}) -> ["bytes(", integer_to_list(Len), ")"]; pp({app_t, _, T, []}) -> diff --git a/src/aeso_parser.erl b/src/aeso_parser.erl index c89f1bd..1d9a0ac 100644 --- a/src/aeso_parser.erl +++ b/src/aeso_parser.erl @@ -264,10 +264,11 @@ type300() -> type400() -> choice( [?RULE(typeAtom(), optional(type_args()), - case _2 of - none -> _1; - {ok, Args} -> {app_t, get_ann(_1), _1, Args} - end), + any_bytes( + case _2 of + none -> _1; + {ok, Args} -> {app_t, get_ann(_1), _1, Args} + end)), ?RULE(id("bytes"), parens(token(int)), {bytes_t, get_ann(_1), element(3, _2)}) ]). @@ -792,3 +793,7 @@ auto_imports(L) when is_list(L) -> auto_imports(T) when is_tuple(T) -> auto_imports(tuple_to_list(T)); auto_imports(_) -> []. + +any_bytes({id, Ann, "bytes"}) -> {bytes_t, Ann, any}; +any_bytes({app_t, _, {id, Ann, "bytes"}, []}) -> {bytes_t, Ann, any}; +any_bytes(Type) -> Type.