[erlang-questions] Dialyzer vs funs with unknown arity

Magnus Henoch magnus.henoch@REDACTED
Wed Apr 6 17:51:46 CEST 2011


Hi all,

I'm trying to get Dialyzer to accept a type spec containing a fun of
unknown arity.  According to the manual
(http://www.erlang.org/doc/reference_manual/typespec.html) that should
be fun((...) -> ReturnType), but when I run Dialyzer, it gives me an error.

I'm probably missing something obvious but I really can't see
it... Does anyone have an idea?

I'm running Erlang/OTP R14B02, Dialyzer 2.4.2.  Here is my module:


-module(foo).

-export([my_apply/2]).

-spec my_apply(fun((...) -> X), [_]) -> X.
my_apply(Fun, Args) ->
    apply(Fun, Args).


And here is the output:


$ dialyzer --src foo.erl
  Checking whether the PLT /home/magnus/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
dialyzer: Analysis failed with error: Unable to find type 'fun'

Last messages in the log cache:
  Reading files and computing callgraph... done in 0.06 secs
  Removing edges... done in 0.01 secs


Regards,
Magnus



More information about the erlang-questions mailing list