<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<br><br>This seems related to <a href="http://erlang.org/pipermail/erlang-bugs/2010-July/001904.html">http://erlang.org/pipermail/erlang-bugs/2010-July/001904.html</a> which is allegedly fixed, but the problem described below still exists. I have Erlang R15B02 and Dialyzer reports version v2.5.2. (I couldn't find how to map these numbers to each other.)<br><br>I boiled it down to this:<br><br>%% ======== exporter.erl<br>-module(exporter).<br>-export([traverser/1]).<br>-export_type([trav/0, tree/0]).<br><br>-opaque tree() :: {tuple()}.<br>-opaque trav() :: {non_neg_integer(), tree()}.<br><br>-spec traverser(tree()) -> trav().<br>traverser(Rftree) -><br> {1, Rftree}.<br><br>%% ======== importer.erl<br>-module(importer).<br>-export([foo/1]).<br><br>-spec foo(exporter:tree()) -> float().<br>foo(Rftree) -><br> cwl(exporter:traverser(Rftree)).<br><br>-spec cwl(exporter:trav()) -> float().<br>cwl(_Trav) -> 0.0.<br><br><br>I get the following Dialyzer errors:<br><br>importer.erl:5: Function foo/1 has no local return<br>importer.erl:6: The call importer:cwl(exporter:trav()) contains an opaque term as 1st argument when an opaque term of type exporter:trav() is expected<br>importer.erl:8: Invalid type specification for function importer:cwl/1. The success typing is (exporter:trav()) -> float()<br><br>So it complains about the type specification for cwl but gives me exactly the same as success typing. I got around the problems with the following workaround, which I feel should not be necessary, or at least the error message should be nicer.<br><br>%% ======== workaround exporter.erl<br>-module(exporter).<br>-export([traverser/1]).<br>-export_type([trav/0, tree/0]).<br><br>-define(tree_def, {tuple()}).<br>-opaque tree() :: ?tree_def.<br>-opaque trav() :: {non_neg_integer(), ?tree_def}.<br><br>-spec traverser(tree()) -> trav().<br>traverser(Rftree) -><br> {1, Rftree}.<br><br><br>/Jesper<br></body></html>