[erlang-bugs] re type spec problem (not recognizing { capture, none })

Sverker Eriksson sverker@REDACTED
Mon Jul 20 11:02:05 CEST 2009


Looks like a simple omission. Will be fixed in R13B02.

Thanks.
/Sverker, Erlang/OTP

Paul Mineiro wrote:
> the module documentation doesn't list { capture, none } as a possibility
> in the types section (but refers to it in the function description),
> so i perhaps this is not dialyzer's fault (GIGO?).
>
> easy workaround: specify { capture, [] } instead of { capture, none }.
>
> cheers,
>
> -- p
>
> -------
> -module (diabug).
> -export ([f/0]).
>
> f () ->
>   re:run ("yo", "yo", [ { capture, none } ]).
> -------
>
> % erl
> Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [kernel-poll:false]
>
> Eshell V5.6.5  (abort with ^G)
> 1> c (diabug), diabug:f ().
> match
> 2>
> User switch command
>  --> q
> % dialyzer --src -c diabug.erl
>   Checking whether the PLT /home/pmineiro/.dialyzer_plt is up-to-date... yes
>   Proceeding with analysis...
> diabug.erl:4: Function f/0 has no local return
> diabug.erl:5: The call re:run("yo","yo",[{'capture','none'},...]) will never return since it differs in argument position 3 from the success typing arguments: (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []) | {'re_pattern',integer(),integer(),binary()},[atom() | {'capture','all' | 'all_but_first' | 'first' | [atom() | string() | integer()]} | {'newline','anycrlf' | 'cr' | 'crlf' | 'lf'} | {'offset',integer()} | {'capture','all' | 'all_but_first' | 'first' | [atom() | string() | integer()],'binary' | 'index' | 'list'}])
>  done in 0m0.22s
> done (warnings were emitted)
>
> ________________________________________________________________
> erlang-bugs mailing list. See http://www.erlang.org/faq.html
> erlang-bugs (at) erlang.org
>
>   



More information about the erlang-bugs mailing list