Fix the rest of the error messages
This commit is contained in:
parent
c209d51c5a
commit
41ddfd18d3
@ -378,7 +378,7 @@ lookup_env(Env, Kind, Ann, Name) ->
|
|||||||
when_warning(warn_unused_includes, fun() -> used_include(AnnR) end),
|
when_warning(warn_unused_includes, fun() -> used_include(AnnR) end),
|
||||||
Res;
|
Res;
|
||||||
Many ->
|
Many ->
|
||||||
type_error({ambiguous_name, [{qid, A, Q} || {Q, {A, _}} <- Many]}),
|
type_error({ambiguous_name, qid(Ann, Name), [{qid, A, Q} || {Q, {A, _}} <- Many]}),
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
@ -2959,8 +2959,7 @@ mk_error({fundecl_must_have_funtype, _Ann, Id, Type}) ->
|
|||||||
, [pp(Id), pp(instantiate(Type))]),
|
, [pp(Id), pp(instantiate(Type))]),
|
||||||
mk_t_err(pos(Id), Msg);
|
mk_t_err(pos(Id), Msg);
|
||||||
mk_error({cannot_unify, A, B, When}) ->
|
mk_error({cannot_unify, A, B, When}) ->
|
||||||
% TODO(mk_error)
|
Msg = io_lib:format("Cannot unify `~s` and `~s`",
|
||||||
Msg = io_lib:format("Cannot unify ~s\n and ~s\n",
|
|
||||||
[pp(instantiate(A)), pp(instantiate(B))]),
|
[pp(instantiate(A)), pp(instantiate(B))]),
|
||||||
{Pos, Ctxt} = pp_when(When),
|
{Pos, Ctxt} = pp_when(When),
|
||||||
mk_t_err(Pos, Msg, Ctxt);
|
mk_t_err(Pos, Msg, Ctxt);
|
||||||
@ -2980,29 +2979,26 @@ mk_error({not_a_record_type, Type, Why}) ->
|
|||||||
{Pos, Ctxt} = pp_why_record(Why),
|
{Pos, Ctxt} = pp_why_record(Why),
|
||||||
mk_t_err(Pos, Msg, Ctxt);
|
mk_t_err(Pos, Msg, Ctxt);
|
||||||
mk_error({not_a_contract_type, Type, Cxt}) ->
|
mk_error({not_a_contract_type, Type, Cxt}) ->
|
||||||
% TODO(mk_error)
|
|
||||||
Msg =
|
Msg =
|
||||||
case Type of
|
case Type of
|
||||||
{tvar, _, _} ->
|
{tvar, _, _} ->
|
||||||
"Unresolved contract type\n";
|
"Unresolved contract type";
|
||||||
_ ->
|
_ ->
|
||||||
io_lib:format("The type ~s is not a contract type\n", [pp_type(Type)])
|
io_lib:format("The type `~s` is not a contract type", [pp_type(Type)])
|
||||||
end,
|
end,
|
||||||
{Pos, Cxt1} =
|
{Pos, Cxt1} =
|
||||||
case Cxt of
|
case Cxt of
|
||||||
{var_args, Ann, Fun} ->
|
{var_args, Ann, Fun} ->
|
||||||
{pos(Ann),
|
{pos(Ann),
|
||||||
io_lib:format("when calling variadic function\n~s\n", [pp_expr(" ", Fun)])};
|
io_lib:format("when calling variadic function `~s`", [pp_expr(Fun)])};
|
||||||
{contract_literal, Lit} ->
|
{contract_literal, Lit} ->
|
||||||
{pos(Lit),
|
{pos(Lit),
|
||||||
io_lib:format("when checking that the contract literal\n~s\n"
|
io_lib:format("when checking that the contract literal `~s` has the type `~s`",
|
||||||
"has the type\n~s\n",
|
[pp_expr(Lit), pp_type(Type)])};
|
||||||
[pp_expr(" ", Lit), pp_type(" ", Type)])};
|
|
||||||
{address_to_contract, Ann} ->
|
{address_to_contract, Ann} ->
|
||||||
{pos(Ann),
|
{pos(Ann),
|
||||||
io_lib:format("when checking that the call to\n Address.to_contract\n"
|
io_lib:format("when checking that the call to `Address.to_contract` has the type `~s`",
|
||||||
"has the type\n~s\n",
|
[pp_type(Type)])}
|
||||||
[pp_type(" ", Type)])}
|
|
||||||
end,
|
end,
|
||||||
mk_t_err(Pos, Msg, Cxt1);
|
mk_t_err(Pos, Msg, Cxt1);
|
||||||
mk_error({non_linear_pattern, Pattern, Nonlinear}) ->
|
mk_error({non_linear_pattern, Pattern, Nonlinear}) ->
|
||||||
@ -3012,10 +3008,10 @@ mk_error({non_linear_pattern, Pattern, Nonlinear}) ->
|
|||||||
pp_expr(Pattern)]),
|
pp_expr(Pattern)]),
|
||||||
mk_t_err(pos(Pattern), Msg);
|
mk_t_err(pos(Pattern), Msg);
|
||||||
mk_error({ambiguous_record, Fields = [{_, First} | _], Candidates}) ->
|
mk_error({ambiguous_record, Fields = [{_, First} | _], Candidates}) ->
|
||||||
% TODO(mk_error)
|
Msg = io_lib:format("Ambiguous record type with field~s ~s could be one of~s",
|
||||||
Msg = io_lib:format("Ambiguous record type with field~s ~s (at ~s) could be one of\n~s",
|
[plural("", "s", Fields),
|
||||||
[plural("", "s", Fields), string:join([ pp(F) || {_, F} <- Fields ], ", "),
|
string:join([ "`" ++ pp(F) ++ "`" || {_, F} <- Fields ], ", "),
|
||||||
pp_loc(First), [ [" - ", pp(C), " (at ", pp_loc(C), ")\n"] || C <- Candidates ]]),
|
[ ["\n - ", "`" ++ pp(C) ++ "`", " (at ", pp_loc(C), ")"] || C <- Candidates ]]),
|
||||||
mk_t_err(pos(First), Msg);
|
mk_t_err(pos(First), Msg);
|
||||||
mk_error({missing_field, Field, Rec}) ->
|
mk_error({missing_field, Field, Rec}) ->
|
||||||
Msg = io_lib:format("Record type `~s` does not have field `~s`",
|
Msg = io_lib:format("Record type `~s` does not have field `~s`",
|
||||||
@ -3030,13 +3026,12 @@ mk_error({missing_fields, Ann, RecType, Fields}) ->
|
|||||||
mk_error({no_records_with_all_fields, Fields = [{_, First} | _]}) ->
|
mk_error({no_records_with_all_fields, Fields = [{_, First} | _]}) ->
|
||||||
Msg = io_lib:format("No record type with field~s ~s",
|
Msg = io_lib:format("No record type with field~s ~s",
|
||||||
[plural("", "s", Fields),
|
[plural("", "s", Fields),
|
||||||
string:join(lists:map(fun(F) -> "`" ++ F ++ "`" end, [ pp(F) || {_, F} <- Fields ]), ", ")]),
|
string:join([ "`" ++ pp(F) ++ "`" || {_, F} <- Fields ], ", ")]),
|
||||||
mk_t_err(pos(First), Msg);
|
mk_t_err(pos(First), Msg);
|
||||||
mk_error({recursive_types_not_implemented, Types}) ->
|
mk_error({recursive_types_not_implemented, Types}) ->
|
||||||
% TODO(mk_error)
|
|
||||||
S = plural(" is", "s are mutually", Types),
|
S = plural(" is", "s are mutually", Types),
|
||||||
Msg = io_lib:format("The following type~s recursive, which is not yet supported:\n~s",
|
Msg = io_lib:format("The following type~s recursive, which is not yet supported:~s",
|
||||||
[S, [io_lib:format(" - ~s (at ~s)\n", [pp(T), pp_loc(T)]) || T <- Types]]),
|
[S, [io_lib:format("\n - `~s` (at ~s)", [pp(T), pp_loc(T)]) || T <- Types]]),
|
||||||
mk_t_err(pos(hd(Types)), Msg);
|
mk_t_err(pos(hd(Types)), Msg);
|
||||||
mk_error({event_must_be_variant_type, Where}) ->
|
mk_error({event_must_be_variant_type, Where}) ->
|
||||||
Msg = io_lib:format("The event type must be a variant type", []),
|
Msg = io_lib:format("The event type must be a variant type", []),
|
||||||
@ -3058,19 +3053,17 @@ mk_error({event_0_to_1_string_values, Constr}) ->
|
|||||||
[name(Constr)]),
|
[name(Constr)]),
|
||||||
mk_t_err(pos(Constr), Msg);
|
mk_t_err(pos(Constr), Msg);
|
||||||
mk_error({repeated_constructor, Cs}) ->
|
mk_error({repeated_constructor, Cs}) ->
|
||||||
% TODO(mk_error)
|
Msg = io_lib:format("Variant types must have distinct constructor names~s",
|
||||||
Msg = io_lib:format("Variant types must have distinct constructor names\n~s",
|
[[ io_lib:format("\n`~s` (at ~s)", [pp_typed(" - ", C, T), pp_loc(C)]) || {C, T} <- Cs ]]),
|
||||||
[[ io_lib:format("~s (at ~s)\n", [pp_typed(" - ", C, T), pp_loc(C)]) || {C, T} <- Cs ]]),
|
|
||||||
mk_t_err(pos(element(1, hd(Cs))), Msg);
|
mk_t_err(pos(element(1, hd(Cs))), Msg);
|
||||||
mk_error({bad_named_argument, [], Name}) ->
|
mk_error({bad_named_argument, [], Name}) ->
|
||||||
Msg = io_lib:format("Named argument ~s supplied to function expecting no named arguments.",
|
Msg = io_lib:format("Named argument ~s supplied to function expecting no named arguments.",
|
||||||
[pp(Name)]),
|
[pp(Name)]),
|
||||||
mk_t_err(pos(Name), Msg);
|
mk_t_err(pos(Name), Msg);
|
||||||
mk_error({bad_named_argument, Args, Name}) ->
|
mk_error({bad_named_argument, Args, Name}) ->
|
||||||
% TODO(mk_error)
|
Msg = io_lib:format("Named argument `~s` is not one of the expected named arguments~s",
|
||||||
Msg = io_lib:format("Named argument ~s (at ~s) is not one of the expected named arguments\n~s",
|
[pp(Name),
|
||||||
[pp(Name), pp_loc(Name),
|
[ io_lib:format("\n - `~s`", [pp_typed("", Arg, Type)])
|
||||||
[ io_lib:format("~s\n", [pp_typed(" - ", Arg, Type)])
|
|
||||||
|| {named_arg_t, _, Arg, Type, _} <- Args ]]),
|
|| {named_arg_t, _, Arg, Type, _} <- Args ]]),
|
||||||
mk_t_err(pos(Name), Msg);
|
mk_t_err(pos(Name), Msg);
|
||||||
mk_error({unsolved_named_argument_constraint, #named_argument_constraint{name = Name, type = Type}}) ->
|
mk_error({unsolved_named_argument_constraint, #named_argument_constraint{name = Name, type = Type}}) ->
|
||||||
@ -3082,9 +3075,8 @@ mk_error({reserved_entrypoint, Name, Def}) ->
|
|||||||
"top-level contract function.", [Name]),
|
"top-level contract function.", [Name]),
|
||||||
mk_t_err(pos(Def), Msg);
|
mk_t_err(pos(Def), Msg);
|
||||||
mk_error({duplicate_definition, Name, Locs}) ->
|
mk_error({duplicate_definition, Name, Locs}) ->
|
||||||
% TODO(mk_error)
|
Msg = io_lib:format("Duplicate definitions of `~s` at~s",
|
||||||
Msg = io_lib:format("Duplicate definitions of ~s at\n~s",
|
[Name, [ ["\n - ", pp_loc(L)] || L <- Locs ]]),
|
||||||
[Name, [ [" - ", pp_loc(L), "\n"] || L <- Locs ]]),
|
|
||||||
mk_t_err(pos(lists:last(Locs)), Msg);
|
mk_t_err(pos(lists:last(Locs)), Msg);
|
||||||
mk_error({duplicate_scope, Kind, Name, OtherKind, L}) ->
|
mk_error({duplicate_scope, Kind, Name, OtherKind, L}) ->
|
||||||
Msg = io_lib:format("The ~p `~s` has the same name as a ~p at ~s",
|
Msg = io_lib:format("The ~p `~s` has the same name as a ~p at ~s",
|
||||||
@ -3123,11 +3115,10 @@ mk_error({value_arg_not_allowed, Value, Fun}) ->
|
|||||||
[pp_expr(Value), pp(Fun)]),
|
[pp_expr(Value), pp(Fun)]),
|
||||||
mk_t_err(pos(Value), Msg);
|
mk_t_err(pos(Value), Msg);
|
||||||
mk_error({init_depends_on_state, Which, [_Init | Chain]}) ->
|
mk_error({init_depends_on_state, Which, [_Init | Chain]}) ->
|
||||||
% TODO(mk_error)
|
|
||||||
WhichCalls = fun("put") -> ""; ("state") -> ""; (_) -> ", which calls" end,
|
WhichCalls = fun("put") -> ""; ("state") -> ""; (_) -> ", which calls" end,
|
||||||
Msg = io_lib:format("The init function should return the initial state as its result and cannot ~s the state,\nbut it calls\n~s",
|
Msg = io_lib:format("The `init` function should return the initial state as its result and cannot ~s the state, but it calls~s",
|
||||||
[if Which == put -> "write"; true -> "read" end,
|
[if Which == put -> "write"; true -> "read" end,
|
||||||
[ io_lib:format(" - ~s (at ~s)~s\n", [Fun, pp_loc(Ann), WhichCalls(Fun)])
|
[ io_lib:format("\n - `~s` (at ~s)~s", [Fun, pp_loc(Ann), WhichCalls(Fun)])
|
||||||
|| {[_, Fun], Ann} <- Chain]]),
|
|| {[_, Fun], Ann} <- Chain]]),
|
||||||
mk_t_err(pos(element(2, hd(Chain))), Msg);
|
mk_t_err(pos(element(2, hd(Chain))), Msg);
|
||||||
mk_error({missing_body_for_let, Ann}) ->
|
mk_error({missing_body_for_let, Ann}) ->
|
||||||
@ -3187,7 +3178,7 @@ mk_error({new_tuple_syntax, Ann, Ts}) ->
|
|||||||
[pp_type({args_t, Ann, Ts}), pp_type({tuple_t, Ann, Ts})]),
|
[pp_type({args_t, Ann, Ts}), pp_type({tuple_t, Ann, Ts})]),
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Ann), Msg);
|
||||||
mk_error({map_in_map_key, Ann, KeyType}) ->
|
mk_error({map_in_map_key, Ann, KeyType}) ->
|
||||||
Msg = io_lib:format("Invalid key type:~s", [pp_type(" ", KeyType)]),
|
Msg = io_lib:format("Invalid key type `~s`", [pp_type(KeyType)]),
|
||||||
Cxt = "Map keys cannot contain other maps.",
|
Cxt = "Map keys cannot contain other maps.",
|
||||||
mk_t_err(pos(Ann), Msg, Cxt);
|
mk_t_err(pos(Ann), Msg, Cxt);
|
||||||
mk_error({cannot_call_init_function, Ann}) ->
|
mk_error({cannot_call_init_function, Ann}) ->
|
||||||
@ -3211,16 +3202,14 @@ mk_error({unknown_byte_length, Type}) ->
|
|||||||
Msg = io_lib:format("Cannot resolve length of byte array.", []),
|
Msg = io_lib:format("Cannot resolve length of byte array.", []),
|
||||||
mk_t_err(pos(Type), Msg);
|
mk_t_err(pos(Type), Msg);
|
||||||
mk_error({unsolved_bytes_constraint, Ann, concat, A, B, C}) ->
|
mk_error({unsolved_bytes_constraint, Ann, concat, A, B, C}) ->
|
||||||
% TODO(mk_error)
|
|
||||||
Msg = io_lib:format("Failed to resolve byte array lengths in call to Bytes.concat with arguments of type\n"
|
Msg = io_lib:format("Failed to resolve byte array lengths in call to Bytes.concat with arguments of type\n"
|
||||||
"~s (at ~s)\n~s (at ~s)\nand result type\n~s (at ~s)\n",
|
"~s (at ~s)\n~s (at ~s)\nand result type\n~s (at ~s)",
|
||||||
[pp_type(" - ", A), pp_loc(A), pp_type(" - ", B),
|
[pp_type(" - ", A), pp_loc(A), pp_type(" - ", B),
|
||||||
pp_loc(B), pp_type(" - ", C), pp_loc(C)]),
|
pp_loc(B), pp_type(" - ", C), pp_loc(C)]),
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Ann), Msg);
|
||||||
mk_error({unsolved_bytes_constraint, Ann, split, A, B, C}) ->
|
mk_error({unsolved_bytes_constraint, Ann, split, A, B, C}) ->
|
||||||
% TODO(mk_error)
|
|
||||||
Msg = io_lib:format("Failed to resolve byte array lengths in call to Bytes.split with argument of type\n"
|
Msg = io_lib:format("Failed to resolve byte array lengths in call to Bytes.split with argument of type\n"
|
||||||
"~s (at ~s)\nand result types\n~s (at ~s)\n~s (at ~s)\n",
|
"~s (at ~s)\nand result types\n~s (at ~s)\n~s (at ~s)",
|
||||||
[ pp_type(" - ", C), pp_loc(C), pp_type(" - ", A), pp_loc(A),
|
[ pp_type(" - ", C), pp_loc(C), pp_type(" - ", A), pp_loc(A),
|
||||||
pp_type(" - ", B), pp_loc(B)]),
|
pp_type(" - ", B), pp_loc(B)]),
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Ann), Msg);
|
||||||
@ -3257,26 +3246,24 @@ mk_error({multiple_main_contracts, Ann}) ->
|
|||||||
Msg = "Only one main contract can be defined.",
|
Msg = "Only one main contract can be defined.",
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Ann), Msg);
|
||||||
mk_error({unify_varargs, When}) ->
|
mk_error({unify_varargs, When}) ->
|
||||||
% TODO(mk_error)
|
Msg = "Cannot unify variable argument list.",
|
||||||
Msg = "Cannot unify variable argument list.\n",
|
|
||||||
{Pos, Ctxt} = pp_when(When),
|
{Pos, Ctxt} = pp_when(When),
|
||||||
mk_t_err(Pos, Msg, Ctxt);
|
mk_t_err(Pos, Msg, Ctxt);
|
||||||
mk_error({clone_no_contract, Ann}) ->
|
mk_error({clone_no_contract, Ann}) ->
|
||||||
Msg = "Chain.clone requires `ref` named argument of contract type.",
|
Msg = "Chain.clone requires `ref` named argument of contract type.",
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Ann), Msg);
|
||||||
mk_error({contract_lacks_definition, Type, When}) ->
|
mk_error({contract_lacks_definition, Type, When}) ->
|
||||||
% TODO(mk_error)
|
|
||||||
Msg = io_lib:format(
|
Msg = io_lib:format(
|
||||||
"~s is not implemented.\n",
|
"~s is not implemented.",
|
||||||
[pp_type(Type)]
|
[pp_type(Type)]
|
||||||
),
|
),
|
||||||
{Pos, Ctxt} = pp_when(When),
|
{Pos, Ctxt} = pp_when(When),
|
||||||
mk_t_err(Pos, Msg, Ctxt);
|
mk_t_err(Pos, Msg, Ctxt);
|
||||||
mk_error({ambiguous_name, QIds = [{qid, Ann, _} | _]}) ->
|
mk_error({ambiguous_name, Name, QIds}) ->
|
||||||
% TODO(mk_error)
|
Msg = io_lib:format("Ambiguous name `~s` could be one of~s",
|
||||||
Names = lists:map(fun(QId) -> io_lib:format("~s at ~s\n", [pp(QId), pp_loc(QId)]) end, QIds),
|
[pp(Name),
|
||||||
Msg = "Ambiguous name: " ++ lists:concat(Names),
|
[io_lib:format("\n - `~s` (at ~s)", [pp(QId), pp_loc(QId)]) || QId <- QIds]]),
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Name), Msg);
|
||||||
mk_error({using_undefined_namespace, Ann, Namespace}) ->
|
mk_error({using_undefined_namespace, Ann, Namespace}) ->
|
||||||
Msg = io_lib:format("Cannot use undefined namespace ~s", [Namespace]),
|
Msg = io_lib:format("Cannot use undefined namespace ~s", [Namespace]),
|
||||||
mk_t_err(pos(Ann), Msg);
|
mk_t_err(pos(Ann), Msg);
|
||||||
@ -3292,34 +3279,34 @@ mk_error(Err) ->
|
|||||||
mk_t_err(pos(0, 0), Msg).
|
mk_t_err(pos(0, 0), Msg).
|
||||||
|
|
||||||
mk_warning({unused_include, FileName, SrcFile}) ->
|
mk_warning({unused_include, FileName, SrcFile}) ->
|
||||||
Msg = io_lib:format("The file ~s is included but not used", [FileName]),
|
Msg = io_lib:format("The file `~s` is included but not used.", [FileName]),
|
||||||
aeso_warnings:new(aeso_errors:pos(SrcFile, 0, 0), Msg);
|
aeso_warnings:new(aeso_errors:pos(SrcFile, 0, 0), Msg);
|
||||||
mk_warning({unused_stateful, Ann, FunName}) ->
|
mk_warning({unused_stateful, Ann, FunName}) ->
|
||||||
Msg = io_lib:format("The function ~s is unnecessarily marked as stateful at ~s", [name(FunName), pp_loc(Ann)]),
|
Msg = io_lib:format("The function `~s` is unnecessarily marked as stateful.", [name(FunName)]),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({unused_variable, Ann, _Namespace, _Fun, VarName}) ->
|
mk_warning({unused_variable, Ann, _Namespace, _Fun, VarName}) ->
|
||||||
Msg = io_lib:format("The variable ~s is defined at ~s but never used", [VarName, pp_loc(Ann)]),
|
Msg = io_lib:format("The variable `~s` is defined but never used.", [VarName]),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({unused_typedef, Ann, QName, _Arity}) ->
|
mk_warning({unused_typedef, Ann, QName, _Arity}) ->
|
||||||
Msg = io_lib:format("The type ~s is defined at ~s but never used", [lists:last(QName), pp_loc(Ann)]),
|
Msg = io_lib:format("The type `~s` is defined but never used.", [lists:last(QName)]),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({unused_return_value, Ann}) ->
|
mk_warning({unused_return_value, Ann}) ->
|
||||||
Msg = io_lib:format("Unused return value at ~s", [pp_loc(Ann)]),
|
Msg = io_lib:format("Unused return value.", []),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({unused_function, Ann, FunName}) ->
|
mk_warning({unused_function, Ann, FunName}) ->
|
||||||
Msg = io_lib:format("The function ~s is defined at ~s but never used", [FunName, pp_loc(Ann)]),
|
Msg = io_lib:format("The function `~s` is defined but never used.", [FunName]),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({shadowing, Ann, VarName, AnnOld}) ->
|
mk_warning({shadowing, Ann, VarName, AnnOld}) ->
|
||||||
Msg = io_lib:format("The definition of ~s at ~s shadows an older definition at ~s", [VarName, pp_loc(Ann), pp_loc(AnnOld)]),
|
Msg = io_lib:format("The definition of `~s` shadows an older definition at ~s.", [VarName, pp_loc(AnnOld)]),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({division_by_zero, Ann}) ->
|
mk_warning({division_by_zero, Ann}) ->
|
||||||
Msg = io_lib:format("Division by zero at ~s", [pp_loc(Ann)]),
|
Msg = io_lib:format("Division by zero.", []),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning({negative_spend, Ann}) ->
|
mk_warning({negative_spend, Ann}) ->
|
||||||
Msg = io_lib:format("Negative spend at ~s", [pp_loc(Ann)]),
|
Msg = io_lib:format("Negative spend.", []),
|
||||||
aeso_warnings:new(pos(Ann), Msg);
|
aeso_warnings:new(pos(Ann), Msg);
|
||||||
mk_warning(Warn) ->
|
mk_warning(Warn) ->
|
||||||
Msg = io_lib:format("Unknown warning: ~p\n", [Warn]),
|
Msg = io_lib:format("Unknown warning: ~p", [Warn]),
|
||||||
aeso_warnings:new(Msg).
|
aeso_warnings:new(Msg).
|
||||||
|
|
||||||
mk_entrypoint(Decl) ->
|
mk_entrypoint(Decl) ->
|
||||||
@ -3328,25 +3315,24 @@ mk_entrypoint(Decl) ->
|
|||||||
aeso_syntax:get_ann(Decl))) -- [public, private]],
|
aeso_syntax:get_ann(Decl))) -- [public, private]],
|
||||||
aeso_syntax:set_ann(Ann, Decl).
|
aeso_syntax:set_ann(Ann, Decl).
|
||||||
|
|
||||||
pp_when({todo, What}) -> {pos(0, 0), io_lib:format("[TODO] ~p\n", [What])};
|
pp_when({todo, What}) -> {pos(0, 0), io_lib:format("[TODO] ~p", [What])};
|
||||||
pp_when({at, Ann}) -> {pos(Ann), io_lib:format("at ~s\n", [pp_loc(Ann)])};
|
pp_when({at, Ann}) -> {pos(Ann), io_lib:format("at ~s", [pp_loc(Ann)])};
|
||||||
pp_when({check_typesig, Name, Inferred, Given}) ->
|
pp_when({check_typesig, Name, Inferred, Given}) ->
|
||||||
{pos(Given),
|
{pos(Given),
|
||||||
io_lib:format("when checking the definition of ~s (at ~s)\n"
|
io_lib:format("when checking the definition of `~s`\n"
|
||||||
" inferred type: ~s\n"
|
" inferred type: `~s`\n"
|
||||||
" given type: ~s\n",
|
" given type: `~s`",
|
||||||
[Name, pp_loc(Given), pp(instantiate(Inferred)), pp(instantiate(Given))])};
|
[Name, pp(instantiate(Inferred)), pp(instantiate(Given))])};
|
||||||
pp_when({infer_app, Fun, NamedArgs, Args, Inferred0, ArgTypes0}) ->
|
pp_when({infer_app, Fun, NamedArgs, Args, Inferred0, ArgTypes0}) ->
|
||||||
Inferred = instantiate(Inferred0),
|
Inferred = instantiate(Inferred0),
|
||||||
ArgTypes = instantiate(ArgTypes0),
|
ArgTypes = instantiate(ArgTypes0),
|
||||||
{pos(Fun),
|
{pos(Fun),
|
||||||
io_lib:format("when checking the application at ~s of\n"
|
io_lib:format("when checking the application of\n"
|
||||||
"~s\n"
|
" `~s`\n"
|
||||||
"to arguments\n~s",
|
"to arguments~s",
|
||||||
[pp_loc(Fun),
|
[pp_typed("", Fun, Inferred),
|
||||||
pp_typed(" ", Fun, Inferred),
|
[ ["\n ", "`" ++ pp_expr(NamedArg) ++ "`"] || NamedArg <- NamedArgs ] ++
|
||||||
[ [pp_expr(" ", NamedArg), "\n"] || NamedArg <- NamedArgs ] ++
|
[ ["\n ", "`" ++ pp_typed("", Arg, ArgT) ++ "`"]
|
||||||
[ [pp_typed(" ", Arg, ArgT), "\n"]
|
|
||||||
|| {Arg, ArgT} <- lists:zip(Args, ArgTypes) ] ])};
|
|| {Arg, ArgT} <- lists:zip(Args, ArgTypes) ] ])};
|
||||||
pp_when({field_constraint, FieldType0, InferredType0, Fld}) ->
|
pp_when({field_constraint, FieldType0, InferredType0, Fld}) ->
|
||||||
FieldType = instantiate(FieldType0),
|
FieldType = instantiate(FieldType0),
|
||||||
@ -3360,20 +3346,17 @@ pp_when({field_constraint, FieldType0, InferredType0, Fld}) ->
|
|||||||
pp_type(" ", InferredType)
|
pp_type(" ", InferredType)
|
||||||
]);
|
]);
|
||||||
{field, _Ann, LV, Id, E} ->
|
{field, _Ann, LV, Id, E} ->
|
||||||
io_lib:format("when checking the assignment of the field\n~s (at ~s)\nto the old value ~s and the new value\n~s\n",
|
io_lib:format("when checking the assignment of the field `~s` to the old value `~s` and the new value `~s`",
|
||||||
[pp_typed(" ", {lvalue, [], LV}, FieldType),
|
[pp_typed("", {lvalue, [], LV}, FieldType),
|
||||||
pp_loc(Fld),
|
|
||||||
pp(Id),
|
pp(Id),
|
||||||
pp_typed(" ", E, InferredType)]);
|
pp_typed("", E, InferredType)]);
|
||||||
{field, _Ann, LV, E} ->
|
{field, _Ann, LV, E} ->
|
||||||
io_lib:format("when checking the assignment of the field\n~s (at ~s)\nto the value\n~s\n",
|
io_lib:format("when checking the assignment of the field `~s` to the value `~s`",
|
||||||
[pp_typed(" ", {lvalue, [], LV}, FieldType),
|
[pp_typed("", {lvalue, [], LV}, FieldType),
|
||||||
pp_loc(Fld),
|
pp_typed("", E, InferredType)]);
|
||||||
pp_typed(" ", E, InferredType)]);
|
|
||||||
{proj, _Ann, _Rec, _Fld} ->
|
{proj, _Ann, _Rec, _Fld} ->
|
||||||
io_lib:format("when checking the record projection at ~s\n~s\nagainst the expected type\n~s\n",
|
io_lib:format("when checking the record projection `~s` against the expected type `~s`",
|
||||||
[pp_loc(Fld),
|
[pp_typed(" ", Fld, FieldType),
|
||||||
pp_typed(" ", Fld, FieldType),
|
|
||||||
pp_type(" ", InferredType)])
|
pp_type(" ", InferredType)])
|
||||||
end};
|
end};
|
||||||
pp_when({record_constraint, RecType0, InferredType0, Fld}) ->
|
pp_when({record_constraint, RecType0, InferredType0, Fld}) ->
|
||||||
@ -3384,23 +3367,23 @@ pp_when({record_constraint, RecType0, InferredType0, Fld}) ->
|
|||||||
{var_args, _Ann, _Fun} ->
|
{var_args, _Ann, _Fun} ->
|
||||||
{Pos,
|
{Pos,
|
||||||
io_lib:format("when checking that contract construction of type\n~s\n~s\n"
|
io_lib:format("when checking that contract construction of type\n~s\n~s\n"
|
||||||
"matches the expected type\n~s\n",
|
"matches the expected type\n~s",
|
||||||
[pp_type(" ", RecType), WhyRec, pp_type(" ", InferredType)]
|
[pp_type(" ", RecType), WhyRec, pp_type(" ", InferredType)]
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
{field, _Ann, _LV, _Id, _E} ->
|
{field, _Ann, _LV, _Id, _E} ->
|
||||||
{Pos,
|
{Pos,
|
||||||
io_lib:format("when checking that the record type\n~s\n~s\n"
|
io_lib:format("when checking that the record type\n~s\n~s\n"
|
||||||
"matches the expected type\n~s\n",
|
"matches the expected type\n~s",
|
||||||
[pp_type(" ", RecType), WhyRec, pp_type(" ", InferredType)])};
|
[pp_type(" ", RecType), WhyRec, pp_type(" ", InferredType)])};
|
||||||
{field, _Ann, _LV, _E} ->
|
{field, _Ann, _LV, _E} ->
|
||||||
{Pos,
|
{Pos,
|
||||||
io_lib:format("when checking that the record type\n~s\n~s\n"
|
io_lib:format("when checking that the record type\n~s\n~s\n"
|
||||||
"matches the expected type\n~s\n",
|
"matches the expected type\n~s",
|
||||||
[pp_type(" ", RecType), WhyRec, pp_type(" ", InferredType)])};
|
[pp_type(" ", RecType), WhyRec, pp_type(" ", InferredType)])};
|
||||||
{proj, _Ann, Rec, _FldName} ->
|
{proj, _Ann, Rec, _FldName} ->
|
||||||
{pos(Rec),
|
{pos(Rec),
|
||||||
io_lib:format("when checking that the expression\n~s (at ~s)\nhas type\n~s\n~s\n",
|
io_lib:format("when checking that the expression\n~s (at ~s)\nhas type\n~s\n~s",
|
||||||
[pp_typed(" ", Rec, InferredType), pp_loc(Rec),
|
[pp_typed(" ", Rec, InferredType), pp_loc(Rec),
|
||||||
pp_type(" ", RecType), WhyRec])}
|
pp_type(" ", RecType), WhyRec])}
|
||||||
end;
|
end;
|
||||||
@ -3414,53 +3397,48 @@ pp_when({if_branches, Then, ThenType0, Else, ElseType0}) ->
|
|||||||
pp_when({case_pat, Pat, PatType0, ExprType0}) ->
|
pp_when({case_pat, Pat, PatType0, ExprType0}) ->
|
||||||
{PatType, ExprType} = instantiate({PatType0, ExprType0}),
|
{PatType, ExprType} = instantiate({PatType0, ExprType0}),
|
||||||
{pos(Pat),
|
{pos(Pat),
|
||||||
io_lib:format("when checking the type of the pattern at ~s\n~s\n"
|
io_lib:format("when checking the type of the pattern `~s` against the expected type `~s`",
|
||||||
"against the expected type\n~s\n",
|
[pp_typed("", Pat, PatType),
|
||||||
[pp_loc(Pat), pp_typed(" ", Pat, PatType),
|
pp_type(ExprType)])};
|
||||||
pp_type(" ", ExprType)])};
|
|
||||||
pp_when({check_expr, Expr, Inferred0, Expected0}) ->
|
pp_when({check_expr, Expr, Inferred0, Expected0}) ->
|
||||||
{Inferred, Expected} = instantiate({Inferred0, Expected0}),
|
{Inferred, Expected} = instantiate({Inferred0, Expected0}),
|
||||||
{pos(Expr),
|
{pos(Expr),
|
||||||
io_lib:format("when checking the type of the expression at ~s\n~s\n"
|
io_lib:format("when checking the type of the expression `~s` against the expected type `~s`",
|
||||||
"against the expected type\n~s\n",
|
[pp_typed("", Expr, Inferred), pp_type(Expected)])};
|
||||||
[pp_loc(Expr), pp_typed(" ", Expr, Inferred),
|
|
||||||
pp_type(" ", Expected)])};
|
|
||||||
pp_when({checking_init_type, Ann}) ->
|
pp_when({checking_init_type, Ann}) ->
|
||||||
{pos(Ann),
|
{pos(Ann),
|
||||||
io_lib:format("when checking that 'init' returns a value of type 'state' at ~s\n",
|
io_lib:format("when checking that `init` returns a value of type `state`", [])};
|
||||||
[pp_loc(Ann)])};
|
|
||||||
pp_when({list_comp, BindExpr, Inferred0, Expected0}) ->
|
pp_when({list_comp, BindExpr, Inferred0, Expected0}) ->
|
||||||
{Inferred, Expected} = instantiate({Inferred0, Expected0}),
|
{Inferred, Expected} = instantiate({Inferred0, Expected0}),
|
||||||
{pos(BindExpr),
|
{pos(BindExpr),
|
||||||
io_lib:format("when checking rvalue of list comprehension binding at ~s\n~s\n"
|
io_lib:format("when checking rvalue of list comprehension binding `~s` against type `~s`",
|
||||||
"against type \n~s\n",
|
[pp_typed("", BindExpr, Inferred), pp_type(Expected)])};
|
||||||
[pp_loc(BindExpr), pp_typed(" ", BindExpr, Inferred), pp_type(" ", Expected)])};
|
|
||||||
pp_when({check_named_arg_constraint, C}) ->
|
pp_when({check_named_arg_constraint, C}) ->
|
||||||
{id, _, Name} = Arg = C#named_argument_constraint.name,
|
{id, _, Name} = Arg = C#named_argument_constraint.name,
|
||||||
[Type | _] = [ Type || {named_arg_t, _, {id, _, Name1}, Type, _} <- C#named_argument_constraint.args, Name1 == Name ],
|
[Type | _] = [ Type || {named_arg_t, _, {id, _, Name1}, Type, _} <- C#named_argument_constraint.args, Name1 == Name ],
|
||||||
Err = io_lib:format("when checking named argument\n~s\nagainst inferred type\n~s",
|
Err = io_lib:format("when checking named argument `~s` against inferred type `~s`",
|
||||||
[pp_typed(" ", Arg, Type), pp_type(" ", C#named_argument_constraint.type)]),
|
[pp_typed("", Arg, Type), pp_type(C#named_argument_constraint.type)]),
|
||||||
{pos(Arg), Err};
|
{pos(Arg), Err};
|
||||||
pp_when({checking_init_args, Ann, Con0, ArgTypes0}) ->
|
pp_when({checking_init_args, Ann, Con0, ArgTypes0}) ->
|
||||||
Con = instantiate(Con0),
|
Con = instantiate(Con0),
|
||||||
ArgTypes = instantiate(ArgTypes0),
|
ArgTypes = instantiate(ArgTypes0),
|
||||||
{pos(Ann),
|
{pos(Ann),
|
||||||
io_lib:format("when checking arguments of ~s's init entrypoint to match\n(~s)",
|
io_lib:format("when checking arguments of `~s`'s init entrypoint to match\n(~s)",
|
||||||
[pp_type(Con), string:join([pp_type(A) || A <- ArgTypes], ", ")])
|
[pp_type(Con), string:join([pp_type(A) || A <- ArgTypes], ", ")])
|
||||||
};
|
};
|
||||||
pp_when({return_contract, App, Con0}) ->
|
pp_when({return_contract, App, Con0}) ->
|
||||||
Con = instantiate(Con0),
|
Con = instantiate(Con0),
|
||||||
{pos(App)
|
{pos(App)
|
||||||
, io_lib:format("when checking that expression returns contract of type\n~s", [pp_type(" ", Con)])
|
, io_lib:format("when checking that expression returns contract of type `~s`", [pp_type(Con)])
|
||||||
};
|
};
|
||||||
pp_when({arg_name, Id1, Id2, When}) ->
|
pp_when({arg_name, Id1, Id2, When}) ->
|
||||||
{Pos, Ctx} = pp_when(When),
|
{Pos, Ctx} = pp_when(When),
|
||||||
{Pos
|
{Pos
|
||||||
, io_lib:format("when unifying names of named arguments: ~s and ~s\n~s", [pp_expr(Id1), pp_expr(Id2), Ctx])
|
, io_lib:format("when unifying names of named arguments: `~s` and `~s`\n~s", [pp_expr(Id1), pp_expr(Id2), Ctx])
|
||||||
};
|
};
|
||||||
pp_when({var_args, Ann, Fun}) ->
|
pp_when({var_args, Ann, Fun}) ->
|
||||||
{pos(Ann)
|
{pos(Ann)
|
||||||
, io_lib:format("when resolving arguments of variadic function\n~s\n", [pp_expr(" ", Fun)])
|
, io_lib:format("when resolving arguments of variadic function `~s`", [pp_expr(Fun)])
|
||||||
};
|
};
|
||||||
pp_when(unknown) -> {pos(0,0), ""}.
|
pp_when(unknown) -> {pos(0,0), ""}.
|
||||||
|
|
||||||
@ -3499,12 +3477,12 @@ pp_typed(Label, Expr, Type) ->
|
|||||||
pp_expr(Expr) ->
|
pp_expr(Expr) ->
|
||||||
pp_expr("", Expr).
|
pp_expr("", Expr).
|
||||||
pp_expr(Label, Expr) ->
|
pp_expr(Label, Expr) ->
|
||||||
prettypr:format(prettypr:beside(prettypr:text(Label), aeso_pretty:expr(Expr, [show_generated]))).
|
prettypr:format(prettypr:beside(prettypr:text(Label), aeso_pretty:expr(Expr, [show_generated])), 80, 80).
|
||||||
|
|
||||||
pp_type(Type) ->
|
pp_type(Type) ->
|
||||||
pp_type("", Type).
|
pp_type("", Type).
|
||||||
pp_type(Label, Type) ->
|
pp_type(Label, Type) ->
|
||||||
prettypr:format(prettypr:beside(prettypr:text(Label), aeso_pretty:type(Type, [show_generated]))).
|
prettypr:format(prettypr:beside(prettypr:text(Label), aeso_pretty:type(Type, [show_generated])), 80, 80).
|
||||||
|
|
||||||
src_file(T) -> aeso_syntax:get_ann(file, T, no_file).
|
src_file(T) -> aeso_syntax:get_ann(file, T, no_file).
|
||||||
line_number(T) -> aeso_syntax:get_ann(line, T, 0).
|
line_number(T) -> aeso_syntax:get_ann(line, T, 0).
|
||||||
|
@ -11,21 +11,21 @@
|
|||||||
-export([format/1, pos/1]).
|
-export([format/1, pos/1]).
|
||||||
|
|
||||||
format({last_declaration_must_be_main_contract, Decl = {Kind, _, {con, _, C}, _}}) ->
|
format({last_declaration_must_be_main_contract, Decl = {Kind, _, {con, _, C}, _}}) ->
|
||||||
Msg = io_lib:format("Expected a main contract as the last declaration instead of the ~p '~s'\n",
|
Msg = io_lib:format("Expected a main contract as the last declaration instead of the ~p '~s'",
|
||||||
[Kind, C]),
|
[Kind, C]),
|
||||||
mk_err(pos(Decl), Msg);
|
mk_err(pos(Decl), Msg);
|
||||||
format({missing_init_function, Con}) ->
|
format({missing_init_function, Con}) ->
|
||||||
Msg = io_lib:format("Missing init function for the contract '~s'.\n", [pp_expr(Con)]),
|
Msg = io_lib:format("Missing init function for the contract '~s'.", [pp_expr(Con)]),
|
||||||
Cxt = "The 'init' function can only be omitted if the state type is 'unit'.\n",
|
Cxt = "The 'init' function can only be omitted if the state type is 'unit'.",
|
||||||
mk_err(pos(Con), Msg, Cxt);
|
mk_err(pos(Con), Msg, Cxt);
|
||||||
format({missing_definition, Id}) ->
|
format({missing_definition, Id}) ->
|
||||||
Msg = io_lib:format("Missing definition of function '~s'.\n", [pp_expr(Id)]),
|
Msg = io_lib:format("Missing definition of function '~s'.", [pp_expr(Id)]),
|
||||||
mk_err(pos(Id), Msg);
|
mk_err(pos(Id), Msg);
|
||||||
format({parameterized_state, Decl}) ->
|
format({parameterized_state, Decl}) ->
|
||||||
Msg = "The state type cannot be parameterized.\n",
|
Msg = "The state type cannot be parameterized.",
|
||||||
mk_err(pos(Decl), Msg);
|
mk_err(pos(Decl), Msg);
|
||||||
format({parameterized_event, Decl}) ->
|
format({parameterized_event, Decl}) ->
|
||||||
Msg = "The event type cannot be parameterized.\n",
|
Msg = "The event type cannot be parameterized.",
|
||||||
mk_err(pos(Decl), Msg);
|
mk_err(pos(Decl), Msg);
|
||||||
format({invalid_entrypoint, Why, Ann, {id, _, Name}, Thing}) ->
|
format({invalid_entrypoint, Why, Ann, {id, _, Name}, Thing}) ->
|
||||||
What = case Why of higher_order -> "higher-order (contains function types)";
|
What = case Why of higher_order -> "higher-order (contains function types)";
|
||||||
@ -38,54 +38,54 @@ format({invalid_entrypoint, Why, Ann, {id, _, Name}, Thing}) ->
|
|||||||
{argument, _, _} -> io_lib:format("has a ~s type", [What]);
|
{argument, _, _} -> io_lib:format("has a ~s type", [What]);
|
||||||
{result, _} -> io_lib:format("is ~s", [What])
|
{result, _} -> io_lib:format("is ~s", [What])
|
||||||
end,
|
end,
|
||||||
Msg = io_lib:format("The ~sof entrypoint '~s' ~s.\n",
|
Msg = io_lib:format("The ~sof entrypoint '~s' ~s.",
|
||||||
[ThingS, Name, Bad]),
|
[ThingS, Name, Bad]),
|
||||||
case Why of
|
case Why of
|
||||||
polymorphic -> mk_err(pos(Ann), Msg, "Use the FATE backend if you want polymorphic entrypoints.\n");
|
polymorphic -> mk_err(pos(Ann), Msg, "Use the FATE backend if you want polymorphic entrypoints.\n");
|
||||||
higher_order -> mk_err(pos(Ann), Msg)
|
higher_order -> mk_err(pos(Ann), Msg)
|
||||||
end;
|
end;
|
||||||
format({cant_compare_type_aevm, Ann, Op, Type}) ->
|
format({cant_compare_type_aevm, Ann, Op, Type}) ->
|
||||||
StringAndTuple = [ "- type string\n"
|
StringAndTuple = [ "\n- type string"
|
||||||
"- tuple or record of word type\n" || lists:member(Op, ['==', '!=']) ],
|
"\n- tuple or record of word type" || lists:member(Op, ['==', '!=']) ],
|
||||||
Msg = io_lib:format("Cannot compare values of type\n"
|
Msg = io_lib:format("Cannot compare values of type\n"
|
||||||
"~s\n"
|
"~s\n"
|
||||||
"The AEVM only supports '~s' on values of\n"
|
"The AEVM only supports '~s' on values of\n"
|
||||||
"- word type (int, bool, bits, address, oracle(_, _), etc)\n"
|
"- word type (int, bool, bits, address, oracle(_, _), etc)"
|
||||||
"~s",
|
"~s",
|
||||||
[pp_type(2, Type), Op, StringAndTuple]),
|
[pp_type(2, Type), Op, StringAndTuple]),
|
||||||
Cxt = "Use FATE if you need to compare arbitrary types.\n",
|
Cxt = "Use FATE if you need to compare arbitrary types.",
|
||||||
mk_err(pos(Ann), Msg, Cxt);
|
mk_err(pos(Ann), Msg, Cxt);
|
||||||
format({invalid_aens_resolve_type, Ann, T}) ->
|
format({invalid_aens_resolve_type, Ann, T}) ->
|
||||||
Msg = io_lib:format("Invalid return type of AENS.resolve:\n"
|
Msg = io_lib:format("Invalid return type of AENS.resolve:\n"
|
||||||
"~s\n"
|
"~s\n"
|
||||||
"It must be a string or a pubkey type (address, oracle, etc).\n",
|
"It must be a string or a pubkey type (address, oracle, etc).",
|
||||||
[pp_type(2, T)]),
|
[pp_type(2, T)]),
|
||||||
mk_err(pos(Ann), Msg);
|
mk_err(pos(Ann), Msg);
|
||||||
format({unapplied_contract_call, Contract}) ->
|
format({unapplied_contract_call, Contract}) ->
|
||||||
Msg = io_lib:format("The AEVM does not support unapplied contract call to\n"
|
Msg = io_lib:format("The AEVM does not support unapplied contract call to\n"
|
||||||
"~s\n", [pp_expr(2, Contract)]),
|
"~s", [pp_expr(2, Contract)]),
|
||||||
Cxt = "Use FATE if you need this.\n",
|
Cxt = "Use FATE if you need this.",
|
||||||
mk_err(pos(Contract), Msg, Cxt);
|
mk_err(pos(Contract), Msg, Cxt);
|
||||||
format({unapplied_builtin, Id}) ->
|
format({unapplied_builtin, Id}) ->
|
||||||
Msg = io_lib:format("The AEVM does not support unapplied use of ~s.\n", [pp_expr(0, Id)]),
|
Msg = io_lib:format("The AEVM does not support unapplied use of ~s.", [pp_expr(0, Id)]),
|
||||||
Cxt = "Use FATE if you need this.\n",
|
Cxt = "Use FATE if you need this.",
|
||||||
mk_err(pos(Id), Msg, Cxt);
|
mk_err(pos(Id), Msg, Cxt);
|
||||||
format({invalid_map_key_type, Why, Ann, Type}) ->
|
format({invalid_map_key_type, Why, Ann, Type}) ->
|
||||||
Msg = io_lib:format("Invalid map key type\n~s\n", [pp_type(2, Type)]),
|
Msg = io_lib:format("Invalid map key type\n~s", [pp_type(2, Type)]),
|
||||||
Cxt = case Why of
|
Cxt = case Why of
|
||||||
polymorphic -> "Map keys cannot be polymorphic in the AEVM. Use FATE if you need this.\n";
|
polymorphic -> "Map keys cannot be polymorphic in the AEVM. Use FATE if you need this.";
|
||||||
function -> "Map keys cannot be higher-order.\n"
|
function -> "Map keys cannot be higher-order."
|
||||||
end,
|
end,
|
||||||
mk_err(pos(Ann), Msg, Cxt);
|
mk_err(pos(Ann), Msg, Cxt);
|
||||||
format({invalid_oracle_type, Why, What, Ann, Type}) ->
|
format({invalid_oracle_type, Why, What, Ann, Type}) ->
|
||||||
WhyS = case Why of higher_order -> "higher-order (contain function types)";
|
WhyS = case Why of higher_order -> "higher-order (contain function types)";
|
||||||
polymorphic -> "polymorphic (contain type variables)" end,
|
polymorphic -> "polymorphic (contain type variables)" end,
|
||||||
Msg = io_lib:format("Invalid oracle type\n~s\n", [pp_type(2, Type)]),
|
Msg = io_lib:format("Invalid oracle type\n~s", [pp_type(2, Type)]),
|
||||||
Cxt = io_lib:format("The ~s type must not be ~s.\n", [What, WhyS]),
|
Cxt = io_lib:format("The ~s type must not be ~s.", [What, WhyS]),
|
||||||
mk_err(pos(Ann), Msg, Cxt);
|
mk_err(pos(Ann), Msg, Cxt);
|
||||||
format({higher_order_state, {type_def, Ann, _, _, State}}) ->
|
format({higher_order_state, {type_def, Ann, _, _, State}}) ->
|
||||||
Msg = io_lib:format("Invalid state type\n~s\n", [pp_type(2, State)]),
|
Msg = io_lib:format("Invalid state type\n~s", [pp_type(2, State)]),
|
||||||
Cxt = "The state cannot contain functions in the AEVM. Use FATE if you need this.\n",
|
Cxt = "The state cannot contain functions in the AEVM. Use FATE if you need this.",
|
||||||
mk_err(pos(Ann), Msg, Cxt);
|
mk_err(pos(Ann), Msg, Cxt);
|
||||||
format({var_args_not_set, Expr}) ->
|
format({var_args_not_set, Expr}) ->
|
||||||
mk_err( pos(Expr), "Could not deduce type of variable arguments list"
|
mk_err( pos(Expr), "Could not deduce type of variable arguments list"
|
||||||
|
@ -66,7 +66,7 @@ throw(#err{} = Err) ->
|
|||||||
erlang:throw({error, [Err]}).
|
erlang:throw({error, [Err]}).
|
||||||
|
|
||||||
msg(#err{ message = Msg, context = none }) -> Msg;
|
msg(#err{ message = Msg, context = none }) -> Msg;
|
||||||
msg(#err{ message = Msg, context = Ctxt }) -> Msg ++ Ctxt.
|
msg(#err{ message = Msg, context = Ctxt }) -> Msg ++ "\n" ++ Ctxt.
|
||||||
|
|
||||||
err_msg(#err{ pos = Pos } = Err) ->
|
err_msg(#err{ pos = Pos } = Err) ->
|
||||||
lists:flatten(io_lib:format("~s~s", [str_pos(Pos), msg(Err)])).
|
lists:flatten(io_lib:format("~s~s", [str_pos(Pos), msg(Err)])).
|
||||||
|
@ -91,9 +91,11 @@ encode_calldata_neg_test() ->
|
|||||||
Code = [ "contract Foo =\n"
|
Code = [ "contract Foo =\n"
|
||||||
" entrypoint x(y : int) : string = \"hello\"\n" ],
|
" entrypoint x(y : int) : string = \"hello\"\n" ],
|
||||||
|
|
||||||
ExpErr1 = "Type error at line 5, col 34:\nCannot unify int\n and bool\n"
|
ExpErr1 = "Type error at line 5, col 34:\nCannot unify `int` and `bool`\n"
|
||||||
"when checking the application at line 5, column 34 of\n"
|
"when checking the application of\n"
|
||||||
" x : (int) => string\nto arguments\n true : bool\n",
|
" `x : (int) => string`\n"
|
||||||
|
"to arguments\n"
|
||||||
|
" `true : bool`",
|
||||||
{error, [Err1]} = aeso_compiler:create_calldata(Code, "x", ["true"]),
|
{error, [Err1]} = aeso_compiler:create_calldata(Code, "x", ["true"]),
|
||||||
?assertEqual(ExpErr1, aeso_errors:pp(Err1)),
|
?assertEqual(ExpErr1, aeso_errors:pp(Err1)),
|
||||||
{error, [Err2]} = aeso_compiler:create_calldata(Code, "x", ["true"], [{backend, fate}]),
|
{error, [Err2]} = aeso_compiler:create_calldata(Code, "x", ["true"], [{backend, fate}]),
|
||||||
|
@ -257,33 +257,33 @@ debug_mode_contracts() ->
|
|||||||
warnings() ->
|
warnings() ->
|
||||||
?WARNING(warnings,
|
?WARNING(warnings,
|
||||||
[<<?PosW(0, 0)
|
[<<?PosW(0, 0)
|
||||||
"The file Triple.aes is included but not used">>,
|
"The file `Triple.aes` is included but not used.">>,
|
||||||
<<?PosW(13, 3)
|
<<?PosW(13, 3)
|
||||||
"The function h is defined at line 13, column 3 but never used">>,
|
"The function `h` is defined but never used.">>,
|
||||||
<<?PosW(19, 3)
|
<<?PosW(19, 3)
|
||||||
"The type unused_type is defined at line 19, column 3 but never used">>,
|
"The type `unused_type` is defined but never used.">>,
|
||||||
<<?PosW(23, 54)
|
<<?PosW(23, 54)
|
||||||
"Negative spend at line 23, column 54">>,
|
"Negative spend.">>,
|
||||||
<<?PosW(27, 9)
|
<<?PosW(27, 9)
|
||||||
"The definition of x at line 27, column 9 shadows an older definition at line 26, column 9">>,
|
"The definition of `x` shadows an older definition at line 26, column 9.">>,
|
||||||
<<?PosW(30, 36)
|
<<?PosW(30, 36)
|
||||||
"Division by zero at line 30, column 36">>,
|
"Division by zero.">>,
|
||||||
<<?PosW(32, 3)
|
<<?PosW(32, 3)
|
||||||
"The function unused_stateful is unnecessarily marked as stateful at line 32, column 3">>,
|
"The function `unused_stateful` is unnecessarily marked as stateful.">>,
|
||||||
<<?PosW(35, 31)
|
<<?PosW(35, 31)
|
||||||
"The variable unused_arg is defined at line 35, column 31 but never used">>,
|
"The variable `unused_arg` is defined but never used.">>,
|
||||||
<<?PosW(36, 9)
|
<<?PosW(36, 9)
|
||||||
"The variable unused_var is defined at line 36, column 9 but never used">>,
|
"The variable `unused_var` is defined but never used.">>,
|
||||||
<<?PosW(41, 3)
|
<<?PosW(41, 3)
|
||||||
"The function unused_function is defined at line 41, column 3 but never used">>,
|
"The function `unused_function` is defined but never used.">>,
|
||||||
<<?PosW(42, 3)
|
<<?PosW(42, 3)
|
||||||
"The function recursive_unused_function is defined at line 42, column 3 but never used">>,
|
"The function `recursive_unused_function` is defined but never used.">>,
|
||||||
<<?PosW(43, 3)
|
<<?PosW(43, 3)
|
||||||
"The function called_unused_function1 is defined at line 43, column 3 but never used">>,
|
"The function `called_unused_function1` is defined but never used.">>,
|
||||||
<<?PosW(44, 3)
|
<<?PosW(44, 3)
|
||||||
"The function called_unused_function2 is defined at line 44, column 3 but never used">>,
|
"The function `called_unused_function2` is defined but never used.">>,
|
||||||
<<?PosW(48, 5)
|
<<?PosW(48, 5)
|
||||||
"Unused return value at line 48, column 5">>
|
"Unused return value.">>
|
||||||
]).
|
]).
|
||||||
|
|
||||||
failing_contracts() ->
|
failing_contracts() ->
|
||||||
@ -301,82 +301,65 @@ failing_contracts() ->
|
|||||||
%% Type errors
|
%% Type errors
|
||||||
, ?TYPE_ERROR(name_clash,
|
, ?TYPE_ERROR(name_clash,
|
||||||
[<<?Pos(14, 3)
|
[<<?Pos(14, 3)
|
||||||
"Duplicate definitions of abort at\n"
|
"Duplicate definitions of `abort` at\n"
|
||||||
" - (builtin location)\n"
|
" - (builtin location)\n"
|
||||||
" - line 14, column 3">>,
|
" - line 14, column 3">>,
|
||||||
<<?Pos(15, 3)
|
<<?Pos(15, 3)
|
||||||
"Duplicate definitions of require at\n"
|
"Duplicate definitions of `require` at\n"
|
||||||
" - (builtin location)\n"
|
" - (builtin location)\n"
|
||||||
" - line 15, column 3">>,
|
" - line 15, column 3">>,
|
||||||
<<?Pos(11, 3)
|
<<?Pos(11, 3)
|
||||||
"Duplicate definitions of double_def at\n"
|
"Duplicate definitions of `double_def` at\n"
|
||||||
" - line 10, column 3\n"
|
" - line 10, column 3\n"
|
||||||
" - line 11, column 3">>,
|
" - line 11, column 3">>,
|
||||||
<<?Pos(5, 3)
|
<<?Pos(5, 3)
|
||||||
"Duplicate definitions of double_proto at\n"
|
"Duplicate definitions of `double_proto` at\n"
|
||||||
" - line 4, column 3\n"
|
" - line 4, column 3\n"
|
||||||
" - line 5, column 3">>,
|
" - line 5, column 3">>,
|
||||||
<<?Pos(8, 3)
|
<<?Pos(8, 3)
|
||||||
"Duplicate definitions of proto_and_def at\n"
|
"Duplicate definitions of `proto_and_def` at\n"
|
||||||
" - line 7, column 3\n"
|
" - line 7, column 3\n"
|
||||||
" - line 8, column 3">>,
|
" - line 8, column 3">>,
|
||||||
<<?Pos(16, 3)
|
<<?Pos(16, 3)
|
||||||
"Duplicate definitions of put at\n"
|
"Duplicate definitions of `put` at\n"
|
||||||
" - (builtin location)\n"
|
" - (builtin location)\n"
|
||||||
" - line 16, column 3">>,
|
" - line 16, column 3">>,
|
||||||
<<?Pos(17, 3)
|
<<?Pos(17, 3)
|
||||||
"Duplicate definitions of state at\n"
|
"Duplicate definitions of `state` at\n"
|
||||||
" - (builtin location)\n"
|
" - (builtin location)\n"
|
||||||
" - line 17, column 3">>])
|
" - line 17, column 3">>])
|
||||||
, ?TYPE_ERROR(type_errors,
|
, ?TYPE_ERROR(type_errors,
|
||||||
[<<?Pos(17, 23)
|
[<<?Pos(17, 23)
|
||||||
"Unbound variable `zz`">>,
|
"Unbound variable `zz`">>,
|
||||||
<<?Pos(26, 9)
|
<<?Pos(26, 9)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `list(int)`\n"
|
||||||
" and list(int)\n"
|
"when checking the application of\n"
|
||||||
"when checking the application at line 26, column 9 of\n"
|
" `(::) : (int, list(int)) => list(int)`\n"
|
||||||
" (::) : (int, list(int)) => list(int)\n"
|
|
||||||
"to arguments\n"
|
"to arguments\n"
|
||||||
" x : int\n"
|
" `x : int`\n"
|
||||||
" x : int">>,
|
" `x : int`">>,
|
||||||
<<?Pos(9, 48)
|
<<?Pos(9, 48)
|
||||||
"Cannot unify string\n"
|
"Cannot unify `string` and `int`\n"
|
||||||
" and int\n"
|
"when checking the assignment of the field `x : map(string, string)` "
|
||||||
"when checking the assignment of the field\n"
|
"to the old value `__x` and the new value `__x {[\"foo\"] @ x = x + 1} : map(string, int)`">>,
|
||||||
" x : map(string, string) (at line 9, column 48)\n"
|
|
||||||
"to the old value __x and the new value\n"
|
|
||||||
" __x {[\"foo\"] @ x = x + 1} : map(string, int)">>,
|
|
||||||
<<?Pos(34, 47)
|
<<?Pos(34, 47)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `string`\n"
|
||||||
" and string\n"
|
"when checking the type of the expression `1 : int` "
|
||||||
"when checking the type of the expression at line 34, column 47\n"
|
"against the expected type `string`">>,
|
||||||
" 1 : int\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" string">>,
|
|
||||||
<<?Pos(34, 52)
|
<<?Pos(34, 52)
|
||||||
"Cannot unify string\n"
|
"Cannot unify `string` and `int`\n"
|
||||||
" and int\n"
|
"when checking the type of the expression `\"bla\" : string` "
|
||||||
"when checking the type of the expression at line 34, column 52\n"
|
"against the expected type `int`">>,
|
||||||
" \"bla\" : string\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" int">>,
|
|
||||||
<<?Pos(32, 18)
|
<<?Pos(32, 18)
|
||||||
"Cannot unify string\n"
|
"Cannot unify `string` and `int`\n"
|
||||||
" and int\n"
|
"when checking the type of the expression `\"x\" : string` "
|
||||||
"when checking the type of the expression at line 32, column 18\n"
|
"against the expected type `int`">>,
|
||||||
" \"x\" : string\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" int">>,
|
|
||||||
<<?Pos(11, 58)
|
<<?Pos(11, 58)
|
||||||
"Cannot unify string\n"
|
"Cannot unify `string` and `int`\n"
|
||||||
" and int\n"
|
"when checking the type of the expression `\"foo\" : string` "
|
||||||
"when checking the type of the expression at line 11, column 58\n"
|
"against the expected type `int`">>,
|
||||||
" \"foo\" : string\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" int">>,
|
|
||||||
<<?Pos(38, 13)
|
<<?Pos(38, 13)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `string`\n"
|
||||||
" and string\n"
|
|
||||||
"when comparing the types of the if-branches\n"
|
"when comparing the types of the if-branches\n"
|
||||||
" - w : int (at line 38, column 13)\n"
|
" - w : int (at line 38, column 13)\n"
|
||||||
" - z : string (at line 39, column 10)">>,
|
" - z : string (at line 39, column 10)">>,
|
||||||
@ -393,27 +376,21 @@ failing_contracts() ->
|
|||||||
"Not a record type: `string`\n"
|
"Not a record type: `string`\n"
|
||||||
"arising from an assignment of the field `y`">>,
|
"arising from an assignment of the field `y`">>,
|
||||||
<<?Pos(13, 27)
|
<<?Pos(13, 27)
|
||||||
"Ambiguous record type with field y (at line 13, column 27) could be one of\n"
|
"Ambiguous record type with field `y` could be one of\n"
|
||||||
" - r (at line 4, column 10)\n"
|
" - `r` (at line 4, column 10)\n"
|
||||||
" - r' (at line 5, column 10)">>,
|
" - `r'` (at line 5, column 10)">>,
|
||||||
<<?Pos(26, 7)
|
<<?Pos(26, 7)
|
||||||
"Repeated name `x` in the pattern `x :: x`">>,
|
"Repeated name `x` in the pattern `x :: x`">>,
|
||||||
<<?Pos(44, 14)
|
<<?Pos(44, 14)
|
||||||
"Repeated names `x`, `y` in the pattern `(x : int, y, x : string, y : bool)`">>,
|
"Repeated names `x`, `y` in the pattern `(x : int, y, x : string, y : bool)`">>,
|
||||||
<<?Pos(44, 39)
|
<<?Pos(44, 39)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `string`\n"
|
||||||
" and string\n"
|
"when checking the type of the expression `x : int` "
|
||||||
"when checking the type of the expression at line 44, column 39\n"
|
"against the expected type `string`">>,
|
||||||
" x : int\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" string">>,
|
|
||||||
<<?Pos(44, 72)
|
<<?Pos(44, 72)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `string`\n"
|
||||||
" and string\n"
|
"when checking the type of the expression `x : int` "
|
||||||
"when checking the type of the expression at line 44, column 72\n"
|
"against the expected type `string`">>,
|
||||||
" x : int\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" string">>,
|
|
||||||
<<?Pos(14, 24)
|
<<?Pos(14, 24)
|
||||||
"No record type with fields `y`, `z`">>,
|
"No record type with fields `y`, `z`">>,
|
||||||
<<?Pos(15, 26)
|
<<?Pos(15, 26)
|
||||||
@ -429,22 +406,17 @@ failing_contracts() ->
|
|||||||
<<?Pos(58, 5)
|
<<?Pos(58, 5)
|
||||||
"Let binding must be followed by an expression.">>,
|
"Let binding must be followed by an expression.">>,
|
||||||
<<?Pos(63, 5)
|
<<?Pos(63, 5)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `bool`\n"
|
||||||
" and bool\n"
|
"when checking the type of the expression `id(n) : int` "
|
||||||
"when checking the type of the expression at line 63, column 5\n"
|
"against the expected type `bool`">>])
|
||||||
" id(n) : int\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" bool">>])
|
|
||||||
, ?TYPE_ERROR(init_type_error,
|
, ?TYPE_ERROR(init_type_error,
|
||||||
[<<?Pos(7, 3)
|
[<<?Pos(7, 3)
|
||||||
"Cannot unify string\n"
|
"Cannot unify `string` and `map(int, int)`\n"
|
||||||
" and map(int, int)\n"
|
"when checking that `init` returns a value of type `state`">>])
|
||||||
"when checking that 'init' returns a value of type 'state' at line 7, column 3">>])
|
|
||||||
, ?TYPE_ERROR(missing_state_type,
|
, ?TYPE_ERROR(missing_state_type,
|
||||||
[<<?Pos(5, 3)
|
[<<?Pos(5, 3)
|
||||||
"Cannot unify string\n"
|
"Cannot unify `string` and `unit`\n"
|
||||||
" and unit\n"
|
"when checking that `init` returns a value of type `state`">>])
|
||||||
"when checking that 'init' returns a value of type 'state' at line 5, column 3">>])
|
|
||||||
, ?TYPE_ERROR(missing_fields_in_record_expression,
|
, ?TYPE_ERROR(missing_fields_in_record_expression,
|
||||||
[<<?Pos(7, 42)
|
[<<?Pos(7, 42)
|
||||||
"The field `x` is missing when constructing an element of type `r('a)`">>,
|
"The field `x` is missing when constructing an element of type `r('a)`">>,
|
||||||
@ -467,12 +439,9 @@ failing_contracts() ->
|
|||||||
"The event constructor `BadEvent2` has too many indexed values (max 3)">>])
|
"The event constructor `BadEvent2` has too many indexed values (max 3)">>])
|
||||||
, ?TYPE_ERROR(type_clash,
|
, ?TYPE_ERROR(type_clash,
|
||||||
[<<?Pos(12, 42)
|
[<<?Pos(12, 42)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `string`\n"
|
||||||
" and string\n"
|
"when checking the type of the expression `r.foo() : map(int, string)` "
|
||||||
"when checking the type of the expression at line 12, column 42\n"
|
"against the expected type `map(string, int)`">>])
|
||||||
" r.foo() : map(int, string)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" map(string, int)">>])
|
|
||||||
, ?TYPE_ERROR(not_toplevel_include,
|
, ?TYPE_ERROR(not_toplevel_include,
|
||||||
[<<?Pos(2, 11)
|
[<<?Pos(2, 11)
|
||||||
"Include of `included.aes` is not allowed, include only allowed at top level.">>])
|
"Include of `included.aes` is not allowed, include only allowed at top level.">>])
|
||||||
@ -484,98 +453,66 @@ failing_contracts() ->
|
|||||||
"Nested contracts are not allowed. Contract `Con` is not defined at top level.">>])
|
"Nested contracts are not allowed. Contract `Con` is not defined at top level.">>])
|
||||||
, ?TYPE_ERROR(bad_address_literals,
|
, ?TYPE_ERROR(bad_address_literals,
|
||||||
[<<?Pos(11, 5)
|
[<<?Pos(11, 5)
|
||||||
"Cannot unify address\n"
|
"Cannot unify `address` and `oracle(int, bool)`\n"
|
||||||
" and oracle(int, bool)\n"
|
"when checking the type of the expression `ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt : address` "
|
||||||
"when checking the type of the expression at line 11, column 5\n"
|
"against the expected type `oracle(int, bool)`">>,
|
||||||
" ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt : address\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" oracle(int, bool)">>,
|
|
||||||
<<?Pos(9, 5)
|
<<?Pos(9, 5)
|
||||||
"Cannot unify address\n"
|
"Cannot unify `address` and `Remote`\n"
|
||||||
" and Remote\n"
|
"when checking the type of the expression `ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt : address` "
|
||||||
"when checking the type of the expression at line 9, column 5\n"
|
"against the expected type `Remote`">>,
|
||||||
" ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt : address\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" Remote">>,
|
|
||||||
<<?Pos(7, 5)
|
<<?Pos(7, 5)
|
||||||
"Cannot unify address\n"
|
"Cannot unify `address` and `bytes(32)`\n"
|
||||||
" and bytes(32)\n"
|
"when checking the type of the expression `ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt : address` "
|
||||||
"when checking the type of the expression at line 7, column 5\n"
|
"against the expected type `bytes(32)`">>,
|
||||||
" ak_2gx9MEFxKvY9vMG5YnqnXWv1hCsX7rgnfvBLJS4aQurustR1rt : address\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" bytes(32)">>,
|
|
||||||
<<?Pos(14, 5)
|
<<?Pos(14, 5)
|
||||||
"Cannot unify oracle('a, 'b)\n"
|
"Cannot unify `oracle('a, 'b)` and `oracle_query(int, bool)`\n"
|
||||||
" and oracle_query(int, bool)\n"
|
"when checking the type of the expression "
|
||||||
"when checking the type of the expression at line 14, column 5\n"
|
"`ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 : oracle('a, 'b)` "
|
||||||
" ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 :\n"
|
"against the expected type `oracle_query(int, bool)`">>,
|
||||||
" oracle('a, 'b)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" oracle_query(int, bool)">>,
|
|
||||||
<<?Pos(16, 5)
|
<<?Pos(16, 5)
|
||||||
"Cannot unify oracle('c, 'd)\n"
|
"Cannot unify `oracle('c, 'd)` and `bytes(32)`\n"
|
||||||
" and bytes(32)\n"
|
"when checking the type of the expression "
|
||||||
"when checking the type of the expression at line 16, column 5\n"
|
"`ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 : oracle('c, 'd)` "
|
||||||
" ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 :\n"
|
"against the expected type `bytes(32)`">>,
|
||||||
" oracle('c, 'd)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" bytes(32)">>,
|
|
||||||
<<?Pos(18, 5)
|
<<?Pos(18, 5)
|
||||||
"Cannot unify oracle('e, 'f)\n"
|
"Cannot unify `oracle('e, 'f)` and `Remote`\n"
|
||||||
" and Remote\n"
|
"when checking the type of the expression "
|
||||||
"when checking the type of the expression at line 18, column 5\n"
|
"`ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 : oracle('e, 'f)` "
|
||||||
" ok_2YNyxd6TRJPNrTcEDCe9ra59SVUdp9FR9qWC5msKZWYD9bP9z5 :\n"
|
"against the expected type `Remote`">>,
|
||||||
" oracle('e, 'f)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" Remote">>,
|
|
||||||
<<?Pos(21, 5)
|
<<?Pos(21, 5)
|
||||||
"Cannot unify oracle_query('g, 'h)\n"
|
"Cannot unify `oracle_query('g, 'h)` and `oracle(int, bool)`\n"
|
||||||
" and oracle(int, bool)\n"
|
"when checking the type of the expression "
|
||||||
"when checking the type of the expression at line 21, column 5\n"
|
"`oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY : oracle_query('g, 'h)` "
|
||||||
" oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY :\n"
|
"against the expected type `oracle(int, bool)`">>,
|
||||||
" oracle_query('g, 'h)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" oracle(int, bool)">>,
|
|
||||||
<<?Pos(23, 5)
|
<<?Pos(23, 5)
|
||||||
"Cannot unify oracle_query('i, 'j)\n"
|
"Cannot unify `oracle_query('i, 'j)` and `bytes(32)`\n"
|
||||||
" and bytes(32)\n"
|
"when checking the type of the expression "
|
||||||
"when checking the type of the expression at line 23, column 5\n"
|
"`oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY : oracle_query('i, 'j)` "
|
||||||
" oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY :\n"
|
"against the expected type `bytes(32)`">>,
|
||||||
" oracle_query('i, 'j)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" bytes(32)">>,
|
|
||||||
<<?Pos(25, 5)
|
<<?Pos(25, 5)
|
||||||
"Cannot unify oracle_query('k, 'l)\n"
|
"Cannot unify `oracle_query('k, 'l)` and `Remote`\n"
|
||||||
" and Remote\n"
|
"when checking the type of the expression "
|
||||||
"when checking the type of the expression at line 25, column 5\n"
|
"`oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY : oracle_query('k, 'l)` "
|
||||||
" oq_2oRvyowJuJnEkxy58Ckkw77XfWJrmRgmGaLzhdqb67SKEL1gPY :\n"
|
"against the expected type `Remote`">>,
|
||||||
" oracle_query('k, 'l)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" Remote">>,
|
|
||||||
<<?Pos(28, 5)
|
<<?Pos(28, 5)
|
||||||
"The type address is not a contract type\n"
|
"The type `address` is not a contract type\n"
|
||||||
"when checking that the contract literal\n"
|
"when checking that the contract literal "
|
||||||
" ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ\n"
|
"`ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ` "
|
||||||
"has the type\n"
|
"has the type `address`">>,
|
||||||
" address">>,
|
|
||||||
<<?Pos(30, 5)
|
<<?Pos(30, 5)
|
||||||
"The type oracle(int, bool) is not a contract type\n"
|
"The type `oracle(int, bool)` is not a contract type\n"
|
||||||
"when checking that the contract literal\n"
|
"when checking that the contract literal "
|
||||||
" ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ\n"
|
"`ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ` "
|
||||||
"has the type\n"
|
"has the type `oracle(int, bool)`">>,
|
||||||
" oracle(int, bool)">>,
|
|
||||||
<<?Pos(32, 5)
|
<<?Pos(32, 5)
|
||||||
"The type bytes(32) is not a contract type\n"
|
"The type `bytes(32)` is not a contract type\n"
|
||||||
"when checking that the contract literal\n"
|
"when checking that the contract literal "
|
||||||
" ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ\n"
|
"`ct_Ez6MyeTMm17YnTnDdHTSrzMEBKmy7Uz2sXu347bTDPgVH2ifJ` "
|
||||||
"has the type\n"
|
"has the type `bytes(32)`">>,
|
||||||
" bytes(32)">>,
|
|
||||||
<<?Pos(34, 5),
|
<<?Pos(34, 5),
|
||||||
"The type address is not a contract type\n"
|
"The type `address` is not a contract type\n"
|
||||||
"when checking that the call to\n"
|
"when checking that the call to `Address.to_contract` "
|
||||||
" Address.to_contract\n"
|
"has the type `address`">>])
|
||||||
"has the type\n"
|
|
||||||
" address">>])
|
|
||||||
, ?TYPE_ERROR(stateful,
|
, ?TYPE_ERROR(stateful,
|
||||||
[<<?Pos(13, 35)
|
[<<?Pos(13, 35)
|
||||||
"Cannot reference stateful function `Chain.spend` in the definition of non-stateful function `fail1`.">>,
|
"Cannot reference stateful function `Chain.spend` in the definition of non-stateful function `fail1`.">>,
|
||||||
@ -595,20 +532,20 @@ failing_contracts() ->
|
|||||||
"Cannot pass non-zero value argument `1000` in the definition of non-stateful function `fail8`.">>])
|
"Cannot pass non-zero value argument `1000` in the definition of non-stateful function `fail8`.">>])
|
||||||
, ?TYPE_ERROR(bad_init_state_access,
|
, ?TYPE_ERROR(bad_init_state_access,
|
||||||
[<<?Pos(11, 5)
|
[<<?Pos(11, 5)
|
||||||
"The init function should return the initial state as its result and cannot write the state,\n"
|
"The `init` function should return the initial state as its result and cannot write the state, "
|
||||||
"but it calls\n"
|
"but it calls\n"
|
||||||
" - set_state (at line 11, column 5), which calls\n"
|
" - `set_state` (at line 11, column 5), which calls\n"
|
||||||
" - roundabout (at line 8, column 38), which calls\n"
|
" - `roundabout` (at line 8, column 38), which calls\n"
|
||||||
" - put (at line 7, column 39)">>,
|
" - `put` (at line 7, column 39)">>,
|
||||||
<<?Pos(12, 5)
|
<<?Pos(12, 5)
|
||||||
"The init function should return the initial state as its result and cannot read the state,\n"
|
"The `init` function should return the initial state as its result and cannot read the state, "
|
||||||
"but it calls\n"
|
"but it calls\n"
|
||||||
" - new_state (at line 12, column 5), which calls\n"
|
" - `new_state` (at line 12, column 5), which calls\n"
|
||||||
" - state (at line 5, column 29)">>,
|
" - `state` (at line 5, column 29)">>,
|
||||||
<<?Pos(13, 13)
|
<<?Pos(13, 13)
|
||||||
"The init function should return the initial state as its result and cannot read the state,\n"
|
"The `init` function should return the initial state as its result and cannot read the state, "
|
||||||
"but it calls\n"
|
"but it calls\n"
|
||||||
" - state (at line 13, column 13)">>])
|
" - `state` (at line 13, column 13)">>])
|
||||||
, ?TYPE_ERROR(modifier_checks,
|
, ?TYPE_ERROR(modifier_checks,
|
||||||
[<<?Pos(11, 3)
|
[<<?Pos(11, 3)
|
||||||
"The function `all_the_things` cannot be both public and private.">>,
|
"The function `all_the_things` cannot be both public and private.">>,
|
||||||
@ -628,15 +565,18 @@ failing_contracts() ->
|
|||||||
"Use `entrypoint` instead of `function` for public function `foo`: `entrypoint foo : () => unit`">>])
|
"Use `entrypoint` instead of `function` for public function `foo`: `entrypoint foo : () => unit`">>])
|
||||||
, ?TYPE_ERROR(list_comp_not_a_list,
|
, ?TYPE_ERROR(list_comp_not_a_list,
|
||||||
[<<?Pos(2, 36)
|
[<<?Pos(2, 36)
|
||||||
"Cannot unify int\n and list('a)\nwhen checking rvalue of list comprehension binding at line 2, column 36\n 1 : int\nagainst type \n list('a)">>
|
"Cannot unify `int` and `list('a)`\n"
|
||||||
|
"when checking rvalue of list comprehension binding `1 : int` against type `list('a)`">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(list_comp_if_not_bool,
|
, ?TYPE_ERROR(list_comp_if_not_bool,
|
||||||
[<<?Pos(2, 44)
|
[<<?Pos(2, 44)
|
||||||
"Cannot unify int\n and bool\nwhen checking the type of the expression at line 2, column 44\n 3 : int\nagainst the expected type\n bool">>
|
"Cannot unify `int` and `bool`\n"
|
||||||
|
"when checking the type of the expression `3 : int` against the expected type `bool`">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(list_comp_bad_shadow,
|
, ?TYPE_ERROR(list_comp_bad_shadow,
|
||||||
[<<?Pos(2, 53)
|
[<<?Pos(2, 53)
|
||||||
"Cannot unify int\n and string\nwhen checking the type of the pattern at line 2, column 53\n x : int\nagainst the expected type\n string">>
|
"Cannot unify `int` and `string`\n"
|
||||||
|
"when checking the type of the pattern `x : int` against the expected type `string`">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(map_as_map_key,
|
, ?TYPE_ERROR(map_as_map_key,
|
||||||
[<<?Pos(5, 47)
|
[<<?Pos(5, 47)
|
||||||
@ -656,7 +596,7 @@ failing_contracts() ->
|
|||||||
[<<?Pos(1, 1) "The definition of 'square' must appear inside a contract or namespace.">>])
|
[<<?Pos(1, 1) "The definition of 'square' must appear inside a contract or namespace.">>])
|
||||||
, ?TYPE_ERROR(missing_event_type,
|
, ?TYPE_ERROR(missing_event_type,
|
||||||
[<<?Pos(3, 5)
|
[<<?Pos(3, 5)
|
||||||
"Unbound variable `Chain.event`"
|
"Unbound variable `Chain.event`\n"
|
||||||
"Did you forget to define the event type?">>])
|
"Did you forget to define the event type?">>])
|
||||||
, ?TYPE_ERROR(bad_bytes_concat,
|
, ?TYPE_ERROR(bad_bytes_concat,
|
||||||
[<<?Pos(12, 40)
|
[<<?Pos(12, 40)
|
||||||
@ -672,12 +612,9 @@ failing_contracts() ->
|
|||||||
"and result type\n"
|
"and result type\n"
|
||||||
" - 'f (at line 13, column 14)">>,
|
" - 'f (at line 13, column 14)">>,
|
||||||
<<?Pos(15, 5)
|
<<?Pos(15, 5)
|
||||||
"Cannot unify bytes(26)\n"
|
"Cannot unify `bytes(26)` and `bytes(25)`\n"
|
||||||
" and bytes(25)\n"
|
"when checking the type of the expression `Bytes.concat(x, y) : bytes(26)` "
|
||||||
"when checking the type of the expression at line 15, column 5\n"
|
"against the expected type `bytes(25)`">>,
|
||||||
" Bytes.concat(x, y) : bytes(26)\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" bytes(25)">>,
|
|
||||||
<<?Pos(17, 5)
|
<<?Pos(17, 5)
|
||||||
"Failed to resolve byte array lengths in call to Bytes.concat with arguments of type\n"
|
"Failed to resolve byte array lengths in call to Bytes.concat with arguments of type\n"
|
||||||
" - bytes(6) (at line 16, column 24)\n"
|
" - bytes(6) (at line 16, column 24)\n"
|
||||||
@ -736,21 +673,15 @@ failing_contracts() ->
|
|||||||
[<<?Pos(3, 20)
|
[<<?Pos(3, 20)
|
||||||
"Arity for id doesn't match. Expected 1, got 0">>,
|
"Arity for id doesn't match. Expected 1, got 0">>,
|
||||||
<<?Pos(3, 25)
|
<<?Pos(3, 25)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `id`\n"
|
||||||
" and id\n"
|
"when checking the type of the expression `123 : int` "
|
||||||
"when checking the type of the expression at line 3, column 25\n"
|
"against the expected type `id`">>,
|
||||||
" 123 : int\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" id">>,
|
|
||||||
<<?Pos(4, 20)
|
<<?Pos(4, 20)
|
||||||
"Arity for id doesn't match. Expected 1, got 2">>,
|
"Arity for id doesn't match. Expected 1, got 2">>,
|
||||||
<<?Pos(4, 35)
|
<<?Pos(4, 35)
|
||||||
"Cannot unify int\n"
|
"Cannot unify `int` and `id(int, int)`\n"
|
||||||
" and id(int, int)\n"
|
"when checking the type of the expression `123 : int` "
|
||||||
"when checking the type of the expression at line 4, column 35\n"
|
"against the expected type `id(int, int)`">>])
|
||||||
" 123 : int\n"
|
|
||||||
"against the expected type\n"
|
|
||||||
" id(int, int)">>])
|
|
||||||
, ?TYPE_ERROR(bad_unnamed_map_update_default,
|
, ?TYPE_ERROR(bad_unnamed_map_update_default,
|
||||||
[<<?Pos(4, 17)
|
[<<?Pos(4, 17)
|
||||||
"Invalid map update with default">>])
|
"Invalid map update with default">>])
|
||||||
@ -783,25 +714,23 @@ failing_contracts() ->
|
|||||||
])
|
])
|
||||||
, ?TYPE_ERROR(bad_number_of_args,
|
, ?TYPE_ERROR(bad_number_of_args,
|
||||||
[<<?Pos(3, 39)
|
[<<?Pos(3, 39)
|
||||||
"Cannot unify () => unit\n"
|
"Cannot unify `() => unit` and `(int) => 'a`\n",
|
||||||
" and (int) => 'a\n",
|
"when checking the application of\n"
|
||||||
"when checking the application at line 3, column 39 of\n"
|
" `f : () => unit`\n"
|
||||||
" f : () => unit\n"
|
|
||||||
"to arguments\n"
|
"to arguments\n"
|
||||||
" 1 : int">>,
|
" `1 : int`">>,
|
||||||
<<?Pos(4, 20)
|
<<?Pos(4, 20)
|
||||||
"Cannot unify (int, string) => 'e\n"
|
"Cannot unify `(int, string) => 'e` and `(int) => 'd`\n"
|
||||||
" and (int) => 'd\n"
|
"when checking the application of\n"
|
||||||
"when checking the application at line 4, column 20 of\n"
|
" `g : (int, string) => 'e`\n"
|
||||||
" g : (int, string) => 'e\n"
|
|
||||||
"to arguments\n"
|
"to arguments\n"
|
||||||
" 1 : int">>,
|
" `1 : int`">>,
|
||||||
<<?Pos(5, 20)
|
<<?Pos(5, 20)
|
||||||
"Cannot unify (int, string) => 'c\n"
|
"Cannot unify `(int, string) => 'c` and `(string) => 'b`\n"
|
||||||
" and (string) => 'b\n"
|
"when checking the application of\n"
|
||||||
"when checking the application at line 5, column 20 of\n"
|
" `g : (int, string) => 'c`\n"
|
||||||
" g : (int, string) => 'c\nto arguments\n"
|
"to arguments\n"
|
||||||
" \"Litwo, ojczyzno moja\" : string">>
|
" `\"Litwo, ojczyzno moja\" : string`">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(bad_state,
|
, ?TYPE_ERROR(bad_state,
|
||||||
[<<?Pos(4, 16)
|
[<<?Pos(4, 16)
|
||||||
@ -810,22 +739,22 @@ failing_contracts() ->
|
|||||||
[<<?Pos(10,18)
|
[<<?Pos(10,18)
|
||||||
"Chain.clone requires `ref` named argument of contract type.">>,
|
"Chain.clone requires `ref` named argument of contract type.">>,
|
||||||
<<?Pos(11,18)
|
<<?Pos(11,18)
|
||||||
"Cannot unify (gas : int, value : int, protected : bool) => if(protected, option(void), void)\n and (gas : int, value : int, protected : bool, int, bool) => 'b\n"
|
"Cannot unify `(gas : int, value : int, protected : bool) => if(protected, option(void), void)` and `(gas : int, value : int, protected : bool, int, bool) => 'b`\n"
|
||||||
"when checking contract construction of type\n (gas : int, value : int, protected : bool) =>\n if(protected, option(void), void) (at line 11, column 18)\nagainst the expected type\n (gas : int, value : int, protected : bool, int, bool) => 'b">>,
|
"when checking contract construction of type\n (gas : int, value : int, protected : bool) =>\n if(protected, option(void), void) (at line 11, column 18)\nagainst the expected type\n (gas : int, value : int, protected : bool, int, bool) => 'b">>,
|
||||||
<<?Pos(12,37)
|
<<?Pos(12,37)
|
||||||
"Cannot unify int\n and bool\n"
|
"Cannot unify `int` and `bool`\n"
|
||||||
"when checking named argument\n gas : int\nagainst inferred type\n bool">>,
|
"when checking named argument `gas : int` against inferred type `bool`">>,
|
||||||
<<?Pos(13,18),
|
<<?Pos(13,18),
|
||||||
"Kaboom is not implemented.\n"
|
"Kaboom is not implemented.\n"
|
||||||
"when resolving arguments of variadic function\n Chain.create">>,
|
"when resolving arguments of variadic function `Chain.create`">>,
|
||||||
<<?Pos(18,18)
|
<<?Pos(18,18)
|
||||||
"Cannot unify (gas : int, value : int, protected : bool, int, bool) => if(protected, option(void), void)\n and (gas : int, value : int, protected : bool) => 'a\n"
|
"Cannot unify `(gas : int, value : int, protected : bool, int, bool) => if(protected, option(void), void)` and `(gas : int, value : int, protected : bool) => 'a`\n"
|
||||||
"when checking contract construction of type\n (gas : int, value : int, protected : bool, int, bool) =>\n if(protected, option(void), void) (at line 18, column 18)\nagainst the expected type\n (gas : int, value : int, protected : bool) => 'a">>,
|
"when checking contract construction of type\n (gas : int, value : int, protected : bool, int, bool) =>\n if(protected, option(void), void) (at line 18, column 18)\nagainst the expected type\n (gas : int, value : int, protected : bool) => 'a">>,
|
||||||
<<?Pos(19,42),
|
<<?Pos(19,42),
|
||||||
"Named argument protected (at line 19, column 42) is not one of the expected named arguments\n - value : int">>,
|
"Named argument `protected` is not one of the expected named arguments\n - `value : int`">>,
|
||||||
<<?Pos(20,42),
|
<<?Pos(20,42),
|
||||||
"Cannot unify int\n and bool\n"
|
"Cannot unify `int` and `bool`\n"
|
||||||
"when checking named argument\n value : int\nagainst inferred type\n bool">>
|
"when checking named argument `value : int` against inferred type `bool`">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(ambiguous_main,
|
, ?TYPE_ERROR(ambiguous_main,
|
||||||
[<<?Pos(1,1)
|
[<<?Pos(1,1)
|
||||||
@ -840,8 +769,10 @@ failing_contracts() ->
|
|||||||
"Only one main contract can be defined.">>
|
"Only one main contract can be defined.">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(using_namespace_ambiguous_name,
|
, ?TYPE_ERROR(using_namespace_ambiguous_name,
|
||||||
[ <<?Pos(2,3)
|
[ <<?Pos(13,23)
|
||||||
"Ambiguous name: Xa.f at line 2, column 3\nXb.f at line 5, column 3">>
|
"Ambiguous name `A.f` could be one of\n"
|
||||||
|
" - `Xa.f` (at line 2, column 3)\n"
|
||||||
|
" - `Xb.f` (at line 5, column 3)">>
|
||||||
, <<?Pos(13,23)
|
, <<?Pos(13,23)
|
||||||
"Unbound variable `A.f`">>
|
"Unbound variable `A.f`">>
|
||||||
])
|
])
|
||||||
@ -869,37 +800,39 @@ failing_contracts() ->
|
|||||||
])
|
])
|
||||||
, ?TYPE_ERROR(non_boolean_pattern_guard,
|
, ?TYPE_ERROR(non_boolean_pattern_guard,
|
||||||
[<<?Pos(4,24)
|
[<<?Pos(4,24)
|
||||||
"Cannot unify string\n and bool\nwhen checking the type of the expression at line 4, column 24\n \"y\" : string\nagainst the expected type\n bool">>
|
"Cannot unify `string` and `bool`\n"
|
||||||
|
"when checking the type of the expression `\"y\" : string` "
|
||||||
|
"against the expected type `bool`">>
|
||||||
])
|
])
|
||||||
, ?TYPE_ERROR(warnings,
|
, ?TYPE_ERROR(warnings,
|
||||||
[<<?Pos(0, 0)
|
[<<?Pos(0, 0)
|
||||||
"The file Triple.aes is included but not used">>,
|
"The file `Triple.aes` is included but not used.">>,
|
||||||
<<?Pos(13, 3)
|
<<?Pos(13, 3)
|
||||||
"The function h is defined at line 13, column 3 but never used">>,
|
"The function `h` is defined but never used.">>,
|
||||||
<<?Pos(19, 3)
|
<<?Pos(19, 3)
|
||||||
"The type unused_type is defined at line 19, column 3 but never used">>,
|
"The type `unused_type` is defined but never used.">>,
|
||||||
<<?Pos(23, 54)
|
<<?Pos(23, 54)
|
||||||
"Negative spend at line 23, column 54">>,
|
"Negative spend.">>,
|
||||||
<<?Pos(27, 9)
|
<<?Pos(27, 9)
|
||||||
"The definition of x at line 27, column 9 shadows an older definition at line 26, column 9">>,
|
"The definition of `x` shadows an older definition at line 26, column 9.">>,
|
||||||
<<?Pos(30, 36)
|
<<?Pos(30, 36)
|
||||||
"Division by zero at line 30, column 36">>,
|
"Division by zero.">>,
|
||||||
<<?Pos(32, 3)
|
<<?Pos(32, 3)
|
||||||
"The function unused_stateful is unnecessarily marked as stateful at line 32, column 3">>,
|
"The function `unused_stateful` is unnecessarily marked as stateful.">>,
|
||||||
<<?Pos(35, 31)
|
<<?Pos(35, 31)
|
||||||
"The variable unused_arg is defined at line 35, column 31 but never used">>,
|
"The variable `unused_arg` is defined but never used.">>,
|
||||||
<<?Pos(36, 9)
|
<<?Pos(36, 9)
|
||||||
"The variable unused_var is defined at line 36, column 9 but never used">>,
|
"The variable `unused_var` is defined but never used.">>,
|
||||||
<<?Pos(41, 3)
|
<<?Pos(41, 3)
|
||||||
"The function unused_function is defined at line 41, column 3 but never used">>,
|
"The function `unused_function` is defined but never used.">>,
|
||||||
<<?Pos(42, 3)
|
<<?Pos(42, 3)
|
||||||
"The function recursive_unused_function is defined at line 42, column 3 but never used">>,
|
"The function `recursive_unused_function` is defined but never used.">>,
|
||||||
<<?Pos(43, 3)
|
<<?Pos(43, 3)
|
||||||
"The function called_unused_function1 is defined at line 43, column 3 but never used">>,
|
"The function `called_unused_function1` is defined but never used.">>,
|
||||||
<<?Pos(44, 3)
|
<<?Pos(44, 3)
|
||||||
"The function called_unused_function2 is defined at line 44, column 3 but never used">>,
|
"The function `called_unused_function2` is defined but never used.">>,
|
||||||
<<?Pos(48, 5)
|
<<?Pos(48, 5)
|
||||||
"Unused return value at line 48, column 5">>
|
"Unused return value.">>
|
||||||
])
|
])
|
||||||
].
|
].
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user