[erlang-questions] incomplete union checks in dialyzer

Motiejus Jakštys desired.mta@REDACTED
Thu Aug 30 11:38:10 CEST 2012


Hi,

-module(gg).
-export([oho/0]).

-type(error_enum() ::
      f01 | f02 | f03 | f04 | f05 | f06 | f07
    | f08 | f09 | f10 | f11 | f12 | f13 | f14
).

-spec oho() -> error_enum().
oho() -> oh_no.


$ erlc +debug_info gg.erl && dialyzer --no_check_plt gg.beam
  Proceeding with analysis... done in 0m0.48s
done (passed successfully)

Which is wrong ('oh_no' is not part of error_enum()). However, if I
remove "| f14`":

$ erlc +debug_info gg.erl && dialyzer --no_check_plt gg.beam
  Proceeding with analysis...
gg.erl:9: Invalid type specification for function gg:oho/0. The
success typing is () -> 'oh_no'
 done in 0m0.51s
done (warnings were emitted)

Which is right. How come?

-- 
Motiejus Jakštys



More information about the erlang-questions mailing list