proper
proper copied to clipboard
Behaviour specs aren't used by check_specs
Given the following behaviour
-module(bar).
-callback behaviour_spec(integer()) -> integer().
and module
-module(foo).
-behaviour(bar).
-export([normal_spec/1, behaviour_spec/1]).
-spec normal_spec(integer()) -> integer().
normal_spec(A) ->
A + 1.
behaviour_spec(A) ->
[A].
Dialyzer gives
~/src/pt $ dialyzer -r .
Checking whether the PLT /Users/puzza/.dialyzer_plt is up-to-date... yes
Proceeding with analysis...
foo.erl:11: The inferred return type of behaviour_spec/1 ([any(),...]) has nothing in common with integer(), which is the expected return type for the callback of bar behaviour
done in 0m5.04s
done (warnings were emitted)
But PropEr gives:
~/src/pt $ erl -pa ../proper/ebin
Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Eshell V5.10.3 (abort with ^G)
1> proper:check_specs(foo).
Testing foo:normal_spec/1
....................................................................................................
OK: Passed 100 test(s).
[]