[erlang-questions] opaque type definition makes dialyzer unhappy even in same module

Hynek Vychodil <>
Sun May 15 22:16:05 CEST 2011


Hi,

I'm playing with dialyzer in mine attempt to fibonacci heap
implementation and I got weird behavior. When I define fib_heap() as
type dialyzer seems happy but when I change it to -opaque it produce
warnings below

$ dialyzer fib_heap.erl
  Checking whether the PLT /home/hynek/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
fib_heap.erl:32: The call fib_heap:reset_min_(H::[any()]) does not
have an opaque term of type fib_heap:fib_heap() as 1st argument
fib_heap.erl:46: The call fib_heap:reset_min_(T::[any()],H::any(),[])
does not have opaque terms as 1st and 3rd arguments
fib_heap.erl:53: The call
fib_heap:reset_min_(T::[any()],H::{_,_},[any(),...]) does not have
opaque terms as 1st and 3rd arguments
fib_heap.erl:55: The call
fib_heap:reset_min_(T::[any()],Min::any(),[any(),...]) does not have
opaque terms as 1st and 3rd arguments
fib_heap.erl:64: The call
fib_heap:compact_(nonempty_maybe_improper_list(),array()) does not
have an opaque term of type fib_heap:fib_heap() as 1st argument
 done in 0m0.72s
done (warnings were emitted)

What is going on? According to documentation: "Types declared as
opaque represent sets of terms whose structure is not supposed to be
visible in any way outside of their defining module (i.e., only the
module defining them is allowed to depend on their term structure)." I
only changed '-type' to '-opaque' on line 8, I stay in same module but
dialyzer emits warnings which I don't understand and don't know how I
should fix or suppress.

-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fib_heap.erl
Type: text/x-erlang
Size: 2005 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110515/6156064a/attachment.bin>


More information about the erlang-questions mailing list