diff options
author | Stavros Aronis <[email protected]> | 2011-11-11 16:35:28 +0100 |
---|---|---|
committer | Stavros Aronis <[email protected]> | 2011-11-18 15:06:46 +0100 |
commit | 8682e6b3db55f7f021e529b2134f223b4cc70ace (patch) | |
tree | d2d45e62bd65229a2bd6f9dffa067357c16255a8 /lib/dialyzer/src/dialyzer.erl | |
parent | fc075ff9064eccd3ea2da0c067ec9ef01aaeb183 (diff) | |
download | otp-8682e6b3db55f7f021e529b2134f223b4cc70ace.tar.gz otp-8682e6b3db55f7f021e529b2134f223b4cc70ace.tar.bz2 otp-8682e6b3db55f7f021e529b2134f223b4cc70ace.zip |
Detection of callback-spec discrepancies
Diffstat (limited to 'lib/dialyzer/src/dialyzer.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/dialyzer/src/dialyzer.erl b/lib/dialyzer/src/dialyzer.erl index acbe574e2b..487a12b252 100644 --- a/lib/dialyzer/src/dialyzer.erl +++ b/lib/dialyzer/src/dialyzer.erl @@ -442,14 +442,18 @@ message_to_string({opaque_type_test, [Fun, Opaque]}) -> message_to_string({race_condition, [M, F, Args, Reason]}) -> io_lib:format("The call ~w:~w~s ~s\n", [M, F, Args, Reason]); %%----- Warnings for behaviour errors -------------------- -message_to_string({callback_type_mismatch, [B, F, A, O]}) -> +message_to_string({callback_type_mismatch, [B, F, A, T]}) -> io_lib:format("The inferred return type for ~w/~w is ~s which is not valid" " return for the callback of the ~w behaviour\n", - [F, A, erl_types:t_to_string(O), B]); -message_to_string({callback_arg_type_mismatch, [B, F, A, N, O]}) -> + [F, A, T, B]); +message_to_string({callback_arg_type_mismatch, [B, F, A, N, T]}) -> io_lib:format("The inferred type for the ~s argument of ~w/~w is ~s which is" " not valid for the callback of the ~w behaviour" - "\n", [ordinal(N), F, A, erl_types:t_to_string(O), B]); + "\n", [ordinal(N), F, A, T, B]); +message_to_string({callback_spec_type_mismatch, [B, F, A, ST, CT]}) -> + io_lib:format("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_missing, [B, F, A]}) -> io_lib:format("Undefined callback function ~w/~w (behaviour '~w')\n", [F, A, B]); |