aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2011-02-08 16:58:46 +0200
committerStavros Aronis <[email protected]>2011-02-09 20:41:14 +0200
commit405342e5adac19e4522bff90ffd4bda39f742c9a (patch)
treeb5d77a133652daa5fd92745a42a3efd0f23acd75
parentd8aca1e414c1c39be7fe8292762fbd6a370b37c6 (diff)
downloadotp-405342e5adac19e4522bff90ffd4bda39f742c9a.tar.gz
otp-405342e5adac19e4522bff90ffd4bda39f742c9a.tar.bz2
otp-405342e5adac19e4522bff90ffd4bda39f742c9a.zip
Add '--show_success_typings' option
With '--show_success_typings' Typer will print/use the final success typings from Dialyzer and ignore/overwrite any existing contracts.
-rw-r--r--lib/typer/src/typer.erl15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl
index 05cc873c2c..a194770182 100644
--- a/lib/typer/src/typer.erl
+++ b/lib/typer/src/typer.erl
@@ -57,6 +57,7 @@
files = [] :: files(), % absolute names
plt = none :: 'none' | file:filename(),
no_spec = false :: boolean(),
+ show_succ = false :: boolean(),
%% For choosing between specs or edoc @spec comments
edoc = false :: boolean(),
%% Files in 'fms' are compilable with option 'to_pp'; we keep them
@@ -386,9 +387,18 @@ get_types(Module, Analysis, Records) ->
{value, List} -> List
end,
CodeServer = Analysis#analysis.codeserver,
- TypeInfoList = [get_type(I, CodeServer, Records) || I <- TypeInfo],
+ TypeInfoList =
+ case Analysis#analysis.show_succ of
+ true ->
+ [convert_type_info(I) || I <- TypeInfo];
+ false ->
+ [get_type(I, CodeServer, Records) || I <- TypeInfo]
+ end,
map__from_list(TypeInfoList).
+convert_type_info({{_M, F, A}, Range, Arg}) ->
+ {{F, A}, {Range, Arg}}.
+
get_type({{M, F, A} = MFA, Range, Arg}, CodeServer, Records) ->
case dialyzer_codeserver:lookup_mfa_contract(MFA, CodeServer) of
error ->
@@ -589,6 +599,7 @@ cl(["--edoc"|Opts]) -> {edoc, Opts};
cl(["--show"|Opts]) -> {{mode, ?SHOW}, Opts};
cl(["--show_exported"|Opts]) -> {{mode, ?SHOW_EXPORTED}, Opts};
cl(["--show-exported"|Opts]) -> {{mode, ?SHOW_EXPORTED}, Opts};
+cl(["--show-success-typings"|Opts]) -> {show_succ, Opts};
cl(["--annotate"|Opts]) -> {{mode, ?ANNOTATE}, Opts};
cl(["--annotate-inc-files"|Opts]) -> {{mode, ?ANNOTATE_INC_FILES}, Opts};
cl(["--no_spec"|Opts]) -> {no_spec, Opts};
@@ -656,6 +667,8 @@ analyze_result({inc, Val}, Args, Analysis) ->
{Args, Analysis#analysis{includes = NewVal}};
analyze_result({plt, Plt}, Args, Analysis) ->
{Args, Analysis#analysis{plt = Plt}};
+analyze_result(show_succ, Args, Analysis) ->
+ {Args, Analysis#analysis{show_succ = true}};
analyze_result(no_spec, Args, Analysis) ->
{Args, Analysis#analysis{no_spec = true}}.