Dialyzer vs re:compile(..., [unicode])

Attila Rajmund Nohl attila.r.nohl@REDACTED
Wed Dec 22 11:16:05 CET 2010


I have this small example code, compiled with OTP R14B01:



f() ->
    {ok, MP} = re:compile("abcd", [unicode]).

when I try to analyze it with dialyzer, I get this error:

d.erl:6: The call re:compile("abcd",['unicode',...]) will never return
since it differs in the 2nd argument from the success typing
arguments: (binary() | maybe_improper_list(binary() |
maybe_improper_list(any(),binary() | []) | byte(),binary() |
[]),['anchored' | 'caseless' | 'dollar_endonly' | 'dotall' |
'dupnames' | 'extended' | 'firstline' | 'multiline' |
'no_auto_capture' | 'ungreedy' | {'newline','anycrlf' | 'cr' | 'crlf'
| 'lf'}])

But according to the documentation the re:compile should (and in
practice does) accept the unicode parameter. Unfortunately this error
cascades up, i.e. dialyzer warns about many code which eventually
calls re:compile with unicode parameter, leading to many false
positives. Is there a simple fix for this?

More information about the erlang-questions mailing list