|
|
@ -48,195 +48,195 @@ format_warning({_Tag, {File, Line}, Msg}, FOpt) when is_list(File), |
|
|
|
%%----- Warnings for general discrepancies ---------------- |
|
|
|
message_to_string({apply, [Args, ArgNs, FailReason, |
|
|
|
SigArgs, SigRet, Contract]}) -> |
|
|
|
fmt("~!WFun application with arguments ~!!~s ", |
|
|
|
fmt("~!^Fun application with arguments ~!!~s ", |
|
|
|
[bad_arg(ArgNs, Args)]) ++ |
|
|
|
call_or_apply_to_string(ArgNs, FailReason, SigArgs, SigRet, Contract); |
|
|
|
message_to_string({app_call, [M, F, Args, Culprit, ExpectedType, FoundType]}) -> |
|
|
|
fmt("~!WThe call~!! ~s:~s~s ~!Wrequires that" |
|
|
|
"~!! ~s ~!Wis of type ~!g~s~!W not ~!r~s" |
|
|
|
fmt("~!^The call~!! ~s:~s~s ~!^requires that" |
|
|
|
"~!! ~s ~!^is of type ~!g~s~!^ not ~!r~s" |
|
|
|
"~!!\n", |
|
|
|
[M, F, Args, Culprit, ExpectedType, FoundType]); |
|
|
|
message_to_string({bin_construction, [Culprit, Size, Seg, Type]}) -> |
|
|
|
fmt("~!WBinary construction will fail since the ~!b~s~!W field~!!" |
|
|
|
" ~s~!W in segment~!! ~s~!W has type~!! ~s\n", |
|
|
|
fmt("~!^Binary construction will fail since the ~!b~s~!^ field~!!" |
|
|
|
" ~s~!^ in segment~!! ~s~!^ has type~!! ~s\n", |
|
|
|
[Culprit, Size, Seg, Type]); |
|
|
|
message_to_string({call, [M, F, Args, ArgNs, FailReason, |
|
|
|
SigArgs, SigRet, Contract]}) -> |
|
|
|
fmt("~!WThe call~!! ~w:~w~s ", [M, F, bad_arg(ArgNs, Args)]) ++ |
|
|
|
fmt("~!^The call~!! ~w:~w~s ", [M, F, bad_arg(ArgNs, Args)]) ++ |
|
|
|
call_or_apply_to_string(ArgNs, FailReason, SigArgs, SigRet, Contract); |
|
|
|
message_to_string({call_to_missing, [M, F, A]}) -> |
|
|
|
fmt("~!WCall to missing or unexported function ~!!~w:~w/~w\n", |
|
|
|
fmt("~!^Call to missing or unexported function ~!!~w:~w/~w\n", |
|
|
|
[M, F, A]); |
|
|
|
message_to_string({exact_eq, [Type1, Op, Type2]}) -> |
|
|
|
fmt("~!WThe test ~!!~s ~s ~s~!W can never evaluate to 'true'\n", |
|
|
|
fmt("~!^The test ~!!~s ~s ~s~!^ can never evaluate to 'true'\n", |
|
|
|
[Type1, Op, Type2]); |
|
|
|
message_to_string({fun_app_args, [Args, Type]}) -> |
|
|
|
fmt("~!WFun application with arguments ~!!~s~!W will fail" |
|
|
|
fmt("~!^Fun application with arguments ~!!~s~!^ will fail" |
|
|
|
" since the function has type ~!!~s\n", [Args, Type]); |
|
|
|
message_to_string({fun_app_no_fun, [Op, Type, Arity]}) -> |
|
|
|
fmt("~!WFun application will fail since ~!!~s ~!W::~!! ~s" |
|
|
|
fmt("~!^Fun application will fail since ~!!~s ~!^::~!! ~s" |
|
|
|
" is not a function of arity ~!!~w\n", [Op, Type, Arity]); |
|
|
|
message_to_string({guard_fail, []}) -> |
|
|
|
"~!WClause guard cannot succeed.\n~!!"; |
|
|
|
"~!^Clause guard cannot succeed.\n~!!"; |
|
|
|
message_to_string({guard_fail, [Arg1, Infix, Arg2]}) -> |
|
|
|
fmt("~!WGuard test ~!!~s ~s ~s~!W can never succeed\n", |
|
|
|
fmt("~!^Guard test ~!!~s ~s ~s~!^ can never succeed\n", |
|
|
|
[Arg1, Infix, Arg2]); |
|
|
|
message_to_string({neg_guard_fail, [Arg1, Infix, Arg2]}) -> |
|
|
|
fmt("~!WGuard test not(~!!~s ~s ~s~!W) can never succeed\n", |
|
|
|
fmt("~!^Guard test not(~!!~s ~s ~s~!^) can never succeed\n", |
|
|
|
[Arg1, Infix, Arg2]); |
|
|
|
message_to_string({guard_fail, [Guard, Args]}) -> |
|
|
|
fmt("~!WGuard test ~!!~w~s~!W can never succeed\n", |
|
|
|
fmt("~!^Guard test ~!!~w~s~!^ can never succeed\n", |
|
|
|
[Guard, Args]); |
|
|
|
message_to_string({neg_guard_fail, [Guard, Args]}) -> |
|
|
|
fmt("~!WGuard test not(~!!~w~s~!W) can never succeed\n", |
|
|
|
fmt("~!^Guard test not(~!!~w~s~!^) can never succeed\n", |
|
|
|
[Guard, Args]); |
|
|
|
message_to_string({guard_fail_pat, [Pat, Type]}) -> |
|
|
|
fmt("~!WClause guard cannot succeed. The ~!!~s~!W was matched" |
|
|
|
fmt("~!^Clause guard cannot succeed. The ~!!~s~!^ was matched" |
|
|
|
" against the type ~!!~s\n", [Pat, Type]); |
|
|
|
message_to_string({improper_list_constr, [TlType]}) -> |
|
|
|
fmt("~!WCons will produce an improper list" |
|
|
|
" since its ~!b2~!!nd~!W argument is~!! ~s\n", [TlType]); |
|
|
|
fmt("~!^Cons will produce an improper list" |
|
|
|
" since its ~!b2~!!nd~!^ argument is~!! ~s\n", [TlType]); |
|
|
|
message_to_string({no_return, [Type|Name]}) -> |
|
|
|
NameString = |
|
|
|
case Name of |
|
|
|
[] -> fmt("~!WThe created fun "); |
|
|
|
[F, A] -> fmt("~!WFunction ~!r~w/~w ", [F, A]) |
|
|
|
[] -> fmt("~!^The created fun "); |
|
|
|
[F, A] -> fmt("~!^Function ~!r~w/~w ", [F, A]) |
|
|
|
end, |
|
|
|
case Type of |
|
|
|
no_match -> fmt("~s~!Whas no clauses that will ever match\n",[NameString]); |
|
|
|
only_explicit -> fmt("~s~!Wonly terminates with explicit exception\n", [NameString]); |
|
|
|
only_normal -> fmt("~s~!Whas no local return\n", [NameString]); |
|
|
|
both -> fmt("~s~!Whas no local return\n", [NameString]) |
|
|
|
no_match -> fmt("~s~!^has no clauses that will ever match\n",[NameString]); |
|
|
|
only_explicit -> fmt("~s~!^only terminates with explicit exception\n", [NameString]); |
|
|
|
only_normal -> fmt("~s~!^has no local return\n", [NameString]); |
|
|
|
both -> fmt("~s~!^has no local return\n", [NameString]) |
|
|
|
end; |
|
|
|
message_to_string({record_constr, [RecConstr, FieldDiffs]}) -> |
|
|
|
fmt("~!WRecord construction ~!!~s~!W violates the" |
|
|
|
fmt("~!^Record construction ~!!~s~!^ violates the" |
|
|
|
" declared type of field ~!!~s\n", [RecConstr, FieldDiffs]); |
|
|
|
message_to_string({record_constr, [Name, Field, Type]}) -> |
|
|
|
fmt("~!WRecord construction violates the declared type for ~!!#~w{}~!W" |
|
|
|
" since ~!!~s~!W cannot be of type ~!!~s\n", |
|
|
|
fmt("~!^Record construction violates the declared type for ~!!#~w{}~!^" |
|
|
|
" since ~!!~s~!^ cannot be of type ~!!~s\n", |
|
|
|
[Name, Field, Type]); |
|
|
|
message_to_string({record_matching, [String, Name]}) -> |
|
|
|
fmt("~!WThe ~!!~s~!W violates the" |
|
|
|
fmt("~!^The ~!!~s~!^ violates the" |
|
|
|
" declared type for ~!!#~w{}\n", [String, Name]); |
|
|
|
message_to_string({record_match, [Pat, Type]}) -> |
|
|
|
fmt("~!WMatching of ~!!~s~!W tagged with a record name violates the" |
|
|
|
fmt("~!^Matching of ~!!~s~!^ tagged with a record name violates the" |
|
|
|
" declared type of ~!!~s\n", [Pat, Type]); |
|
|
|
message_to_string({pattern_match, [Pat, Type]}) -> |
|
|
|
fmt("~!WThe ~s~!W can never match the type ~!g~s\n", |
|
|
|
fmt("~!^The ~s~!^ can never match the type ~!g~s\n", |
|
|
|
[bad_pat(Pat), Type]); |
|
|
|
message_to_string({pattern_match_cov, [Pat, Type]}) -> |
|
|
|
fmt("~!WThe ~s~!W can never match since previous" |
|
|
|
fmt("~!^The ~s~!^ can never match since previous" |
|
|
|
" clauses completely covered the type ~!g~s\n", |
|
|
|
[bad_pat(Pat), Type]); |
|
|
|
message_to_string({unmatched_return, [Type]}) -> |
|
|
|
fmt("~!WExpression produces a value of type ~!!~s~!W," |
|
|
|
fmt("~!^Expression produces a value of type ~!!~s~!^," |
|
|
|
" but this value is unmatched\n", [Type]); |
|
|
|
message_to_string({unused_fun, [F, A]}) -> |
|
|
|
fmt("~!WFunction ~!r~w/~w~!W will never be called\n", [F, A]); |
|
|
|
fmt("~!^Function ~!r~w/~w~!^ will never be called\n", [F, A]); |
|
|
|
%%----- Warnings for specs and contracts ------------------- |
|
|
|
message_to_string({contract_diff, [M, F, _A, Contract, Sig]}) -> |
|
|
|
fmt("~!WType specification ~!!~w:~w~s~!W" |
|
|
|
fmt("~!^Type specification ~!!~w:~w~s~!^" |
|
|
|
" is not equal to the success typing: ~!!~w:~w~s\n", |
|
|
|
[M, F, Contract, M, F, Sig]); |
|
|
|
message_to_string({contract_subtype, [M, F, _A, Contract, Sig]}) -> |
|
|
|
fmt("~!WType specification ~!!~w:~w~s~!W" |
|
|
|
fmt("~!^Type specification ~!!~w:~w~s~!^" |
|
|
|
" is a subtype of the success typing: ~!!~w:~w~s\n", |
|
|
|
[M, F, Contract, M, F, Sig]); |
|
|
|
message_to_string({contract_supertype, [M, F, _A, Contract, Sig]}) -> |
|
|
|
fmt("~!WType specification ~!!~w:~w~s~!W" |
|
|
|
fmt("~!^Type specification ~!!~w:~w~s~!^" |
|
|
|
" is a supertype of the success typing: ~!!~w:~w~s\n", |
|
|
|
[M, F, Contract, M, F, Sig]); |
|
|
|
message_to_string({contract_range, [Contract, M, F, ArgStrings, Line, CRet]}) -> |
|
|
|
fmt("~!WThe contract ~!!~w:~w~s~!W cannot be right because the" |
|
|
|
" inferred return for ~!!~w~s~!W on line ~!!~w~!W is ~!!~s\n", |
|
|
|
fmt("~!^The contract ~!!~w:~w~s~!^ cannot be right because the" |
|
|
|
" inferred return for ~!!~w~s~!^ on line ~!!~w~!^ is ~!!~s\n", |
|
|
|
[M, F, Contract, F, ArgStrings, Line, CRet]); |
|
|
|
message_to_string({invalid_contract, [M, F, A, Sig]}) -> |
|
|
|
fmt("~!WInvalid type specification for function~!! ~w:~w/~w." |
|
|
|
"~!W The success typing is~!! ~s\n", [M, F, A, Sig]); |
|
|
|
fmt("~!^Invalid type specification for function~!! ~w:~w/~w." |
|
|
|
"~!^ The success typing is~!! ~s\n", [M, F, A, Sig]); |
|
|
|
message_to_string({extra_range, [M, F, A, ExtraRanges, SigRange]}) -> |
|
|
|
fmt("~!WThe specification for ~!!~w:~w/~w~!W states that the function" |
|
|
|
" might also return ~!!~s~!W but the inferred return is ~!!~s\n", |
|
|
|
fmt("~!^The specification for ~!!~w:~w/~w~!^ states that the function" |
|
|
|
" might also return ~!!~s~!^ but the inferred return is ~!!~s\n", |
|
|
|
[M, F, A, ExtraRanges, SigRange]); |
|
|
|
message_to_string({overlapping_contract, [M, F, A]}) -> |
|
|
|
fmt("~!WOverloaded contract for ~!!~w:~w/~w~!W has overlapping" |
|
|
|
fmt("~!^Overloaded contract for ~!!~w:~w/~w~!^ has overlapping" |
|
|
|
" domains; such contracts are currently unsupported and are simply " |
|
|
|
"ignored\n", [M, F, A]); |
|
|
|
message_to_string({spec_missing_fun, [M, F, A]}) -> |
|
|
|
fmt("~!WContract for function that does not exist: ~!!~w:~w/~w\n", |
|
|
|
fmt("~!^Contract for function that does not exist: ~!!~w:~w/~w\n", |
|
|
|
[M, F, A]); |
|
|
|
%%----- Warnings for opaque type violations ------------------- |
|
|
|
message_to_string({call_with_opaque, [M, F, Args, ArgNs, ExpArgs]}) -> |
|
|
|
fmt("~!WThe call ~!!~w:~w~s~!W contains ~!!~s~!W when ~!!~s\n", |
|
|
|
fmt("~!^The call ~!!~w:~w~s~!^ contains ~!!~s~!^ when ~!!~s\n", |
|
|
|
[M, F, Args, form_positions(ArgNs), form_expected(ExpArgs)]); |
|
|
|
message_to_string({call_without_opaque, [M, F, Args, [{N,_,_}|_] = ExpectedTriples]}) -> |
|
|
|
fmt("~!WThe call ~!!~w:~w~s ~!Wdoes not have~!! ~s\n", |
|
|
|
fmt("~!^The call ~!!~w:~w~s ~!^does not have~!! ~s\n", |
|
|
|
[M, F, bad_arg(N, Args), form_expected_without_opaque(ExpectedTriples)]); |
|
|
|
message_to_string({opaque_eq, [Type, _Op, OpaqueType]}) -> |
|
|
|
fmt("~!WAttempt to test for equality between a term of type ~!!~s~!W" |
|
|
|
fmt("~!^Attempt to test for equality between a term of type ~!!~s~!^" |
|
|
|
" and a term of opaque type ~!!~s\n", [Type, OpaqueType]); |
|
|
|
message_to_string({opaque_guard, [Arg1, Infix, Arg2, ArgNs]}) -> |
|
|
|
fmt("~!WGuard test ~!!~s ~s ~s~!W contains ~!!~s\n", |
|
|
|
fmt("~!^Guard test ~!!~s ~s ~s~!^ contains ~!!~s\n", |
|
|
|
[Arg1, Infix, Arg2, form_positions(ArgNs)]); |
|
|
|
message_to_string({opaque_guard, [Guard, Args]}) -> |
|
|
|
fmt("~!WGuard test ~!!~w~s~!W breaks the opaqueness of its" |
|
|
|
fmt("~!^Guard test ~!!~w~s~!^ breaks the opaqueness of its" |
|
|
|
" argument\n", [Guard, Args]); |
|
|
|
message_to_string({opaque_match, [Pat, OpaqueType, OpaqueTerm]}) -> |
|
|
|
Term = if OpaqueType =:= OpaqueTerm -> "the term"; |
|
|
|
true -> OpaqueTerm |
|
|
|
end, |
|
|
|
fmt("~!WThe attempt to match a term of type ~!!~s~!W against the" |
|
|
|
"~!! ~s~!W breaks the opaqueness of ~!!~s\n", |
|
|
|
fmt("~!^The attempt to match a term of type ~!!~s~!^ against the" |
|
|
|
"~!! ~s~!^ breaks the opaqueness of ~!!~s\n", |
|
|
|
[OpaqueType, Pat, Term]); |
|
|
|
message_to_string({opaque_neq, [Type, _Op, OpaqueType]}) -> |
|
|
|
fmt("~!WAttempt to test for inequality between a term of type ~!!~s" |
|
|
|
"~!W and a term of opaque type ~!!~s\n", [Type, OpaqueType]); |
|
|
|
fmt("~!^Attempt to test for inequality between a term of type ~!!~s" |
|
|
|
"~!^ and a term of opaque type ~!!~s\n", [Type, OpaqueType]); |
|
|
|
message_to_string({opaque_type_test, [Fun, Args, Arg, ArgType]}) -> |
|
|
|
fmt("~!WThe type test ~!!~s~s~!W breaks the opaqueness of the term " |
|
|
|
fmt("~!^The type test ~!!~s~s~!^ breaks the opaqueness of the term " |
|
|
|
"~!!~s~s\n", [Fun, Args, Arg, ArgType]); |
|
|
|
message_to_string({opaque_size, [SizeType, Size]}) -> |
|
|
|
fmt("~!WThe size ~!!~s~!W breaks the opaqueness of ~!!~s\n", |
|
|
|
fmt("~!^The size ~!!~s~!^ breaks the opaqueness of ~!!~s\n", |
|
|
|
[SizeType, Size]); |
|
|
|
message_to_string({opaque_call, [M, F, Args, Culprit, OpaqueType]}) -> |
|
|
|
fmt("~!WThe call ~!!~s:~s~s~!W breaks the opaqueness of the term~!!" |
|
|
|
fmt("~!^The call ~!!~s:~s~s~!^ breaks the opaqueness of the term~!!" |
|
|
|
" ~s :: ~s\n", [M, F, Args, Culprit, OpaqueType]); |
|
|
|
%%----- Warnings for concurrency errors -------------------- |
|
|
|
message_to_string({race_condition, [M, F, Args, Reason]}) -> |
|
|
|
fmt("~!WThe call ~!!~w:~w~s ~s\n", [M, F, Args, Reason]); |
|
|
|
fmt("~!^The call ~!!~w:~w~s ~s\n", [M, F, Args, Reason]); |
|
|
|
%%----- Warnings for behaviour errors -------------------- |
|
|
|
message_to_string({callback_type_mismatch, [B, F, A, ST, CT]}) -> |
|
|
|
fmt("~!WThe inferred return type of~!! ~w/~w (~s) ~!W" |
|
|
|
"has nothing in common with~!! ~s, ~!Wwhich is the expected" |
|
|
|
" return type for the callback of~!! ~w ~!Wbehaviour\n", |
|
|
|
fmt("~!^The inferred return type of~!! ~w/~w (~s) ~!^" |
|
|
|
"has nothing in common with~!! ~s, ~!^which is the expected" |
|
|
|
" return type for the callback of~!! ~w ~!^behaviour\n", |
|
|
|
[F, A, ST, CT, B]); |
|
|
|
message_to_string({callback_arg_type_mismatch, [B, F, A, N, ST, CT]}) -> |
|
|
|
fmt("~!WThe inferred type for the~!! ~s ~!Wargument of~!!" |
|
|
|
" ~w/~w (~s) ~!Wis not a supertype of~!! ~s~!W, which is" |
|
|
|
fmt("~!^The inferred type for the~!! ~s ~!^argument of~!!" |
|
|
|
" ~w/~w (~s) ~!^is not a supertype of~!! ~s~!^, which is" |
|
|
|
"expected type for this argument in the callback of the~!! ~w " |
|
|
|
"~!Wbehaviour\n", |
|
|
|
"~!^behaviour\n", |
|
|
|
[ordinal(N), F, A, ST, CT, B]); |
|
|
|
message_to_string({callback_spec_type_mismatch, [B, F, A, ST, CT]}) -> |
|
|
|
fmt("~!WThe return type ~!!~s~!W in the specification of ~!!" |
|
|
|
"~w/~w~!W is not a subtype of ~!!~s~!W, which is the expected" |
|
|
|
" return type for the callback of ~!!~w~!W behaviour\n", |
|
|
|
fmt("~!^The return type ~!!~s~!^ in the specification of ~!!" |
|
|
|
"~w/~w~!^ is not a subtype of ~!!~s~!^, which is the expected" |
|
|
|
" return type for the callback of ~!!~w~!^ behaviour\n", |
|
|
|
[ST, F, A, CT, B]); |
|
|
|
message_to_string({callback_spec_arg_type_mismatch, [B, F, A, N, ST, CT]}) -> |
|
|
|
fmt("~!WThe specified type for the ~!!~s~!W argument of ~!!" |
|
|
|
"~w/~w (~s)~!W is not a supertype of ~!!~s~!W, which is" |
|
|
|
fmt("~!^The specified type for the ~!!~s~!^ argument of ~!!" |
|
|
|
"~w/~w (~s)~!^ is not a supertype of ~!!~s~!^, which is" |
|
|
|
" expected type for this argument in the callback of the ~!!~w" |
|
|
|
"~!W behaviour\n", [ordinal(N), F, A, ST, CT, B]); |
|
|
|
"~!^ behaviour\n", [ordinal(N), F, A, ST, CT, B]); |
|
|
|
message_to_string({callback_missing, [B, F, A]}) -> |
|
|
|
fmt("~!WUndefined callback function ~!!~w/~w~!W (behaviour ~!!" |
|
|
|
"'~w'~!W)\n",[F, A, B]); |
|
|
|
fmt("~!^Undefined callback function ~!!~w/~w~!^ (behaviour ~!!" |
|
|
|
"'~w'~!^)\n",[F, A, B]); |
|
|
|
message_to_string({callback_info_missing, [B]}) -> |
|
|
|
fmt("~!WCallback info about the ~!r~w~!W" |
|
|
|
fmt("~!^Callback info about the ~!r~w~!^" |
|
|
|
" behaviour is not available\n", [B]); |
|
|
|
%%----- Warnings for unknown functions, types, and behaviours ------------- |
|
|
|
message_to_string({unknown_type, {M, F, A}}) -> |
|
|
|
fmt("~!WUnknown type ~!r~w:~w/~w", [M, F, A]); |
|
|
|
fmt("~!^Unknown type ~!r~w:~w/~w", [M, F, A]); |
|
|
|
message_to_string({unknown_function, {M, F, A}}) -> |
|
|
|
fmt("~!WUnknown function ~!r~w:~w/~w", [M, F, A]); |
|
|
|
fmt("~!^Unknown function ~!r~w:~w/~w", [M, F, A]); |
|
|
|
message_to_string({unknown_behaviour, B}) -> |
|
|
|
fmt("~!WUnknown behaviour ~!r~w", [B]). |
|
|
|
fmt("~!^Unknown behaviour ~!r~w", [B]). |
|
|
|
|
|
|
|
%%----------------------------------------------------------------------------- |
|
|
|
%% Auxiliary functions below |
|
|
@ -250,11 +250,11 @@ call_or_apply_to_string(ArgNs, FailReason, SigArgs, SigRet, |
|
|
|
case ArgNs =:= [] of |
|
|
|
true -> |
|
|
|
%% We do not know which argument(s) caused the failure |
|
|
|
fmt("~!Wwill never return since the success typing arguments" |
|
|
|
fmt("~!^will never return since the success typing arguments" |
|
|
|
" are ~!!~s\n", [SigArgs]); |
|
|
|
false -> |
|
|
|
fmt("~!Wwill never return since it differs in the~!!" |
|
|
|
" ~s ~!Wargument from the success typing" |
|
|
|
fmt("~!^will never return since it differs in the~!!" |
|
|
|
" ~s ~!^argument from the success typing" |
|
|
|
" arguments:~!! ~s\n", |
|
|
|
[PositionString, good_arg(ArgNs, SigArgs)]) |
|
|
|
end; |
|
|
@ -262,15 +262,15 @@ call_or_apply_to_string(ArgNs, FailReason, SigArgs, SigRet, |
|
|
|
case (ArgNs =:= []) orelse IsOverloaded of |
|
|
|
true -> |
|
|
|
%% We do not know which arguments caused the failure |
|
|
|
fmt("~!Wbreaks the contract~!! ~s\n", [good_arg(ArgNs, Contract)]); |
|
|
|
fmt("~!^breaks the contract~!! ~s\n", [good_arg(ArgNs, Contract)]); |
|
|
|
false -> |
|
|
|
fmt("~!Wbreaks the contract~!! ~s ~!Win the~!!" |
|
|
|
" ~s ~!Wargument\n", |
|
|
|
fmt("~!^breaks the contract~!! ~s ~!^in the~!!" |
|
|
|
" ~s ~!^argument\n", |
|
|
|
[good_arg(ArgNs, Contract), PositionString]) |
|
|
|
end; |
|
|
|
both -> |
|
|
|
fmt("~!Wwill never return since the success typing is " |
|
|
|
"~!!~s ~!W->~!! ~s ~!Wand the contract is ~!!~s\n", |
|
|
|
fmt("~!^will never return since the success typing is " |
|
|
|
"~!!~s ~!^->~!! ~s ~!^and the contract is ~!!~s\n", |
|
|
|
[good_arg(ArgNs, SigArgs), SigRet, |
|
|
|
good_arg(ArgNs, Contract)]) |
|
|
|
end. |
|
|
@ -290,10 +290,10 @@ form_positions(ArgNs) -> |
|
|
|
form_expected_without_opaque([{N, T, TStr}]) -> |
|
|
|
FStr = case erl_types:t_is_opaque(T) of |
|
|
|
true -> |
|
|
|
"~!Wan opaque term of type~!g ~s ~!Was "; |
|
|
|
"~!^an opaque term of type~!g ~s ~!^as "; |
|
|
|
false -> |
|
|
|
"~!Wa term of type ~!g~s ~!W(with opaque subterms) as " |
|
|
|
end ++ form_position_string([N]) ++ "~!W argument", |
|
|
|
"~!^a term of type ~!g~s ~!^(with opaque subterms) as " |
|
|
|
end ++ form_position_string([N]) ++ "~!^ argument", |
|
|
|
fmt(FStr, [TStr]); |
|
|
|
|
|
|
|
form_expected_without_opaque(ExpectedTriples) -> %% TODO: can do much better here |
|
|
@ -305,12 +305,12 @@ form_expected(ExpectedArgs) -> |
|
|
|
[T] -> |
|
|
|
TS = erl_types:t_to_string(T), |
|
|
|
case erl_types:t_is_opaque(T) of |
|
|
|
true -> fmt("~!Wan opaque term of type ~!!~s~!W is" |
|
|
|
true -> fmt("~!^an opaque term of type ~!!~s~!^ is" |
|
|
|
" expected", [TS]); |
|
|
|
false -> fmt("~!Wa structured term of type ~!!~s~!W is" |
|
|
|
false -> fmt("~!^a structured term of type ~!!~s~!^ is" |
|
|
|
" expected", [TS]) |
|
|
|
end; |
|
|
|
[_,_|_] -> fmt("~!Wterms of different types are expected in these" |
|
|
|
[_,_|_] -> fmt("~!^terms of different types are expected in these" |
|
|
|
" positions", []) |
|
|
|
end. |
|
|
|
|
|
|
|