Hi all (Hi dialyzer people especially :))<br><br>I have been having a heated debate with dialyzer over the return value of rpc:pmap/3. The following code demonstrates the issue:<br><br>----------------------------------------------<br>
-module(dialyzer_test).<br><br>-export([run/0, f/1]).<br><br>run() -><br> A = [{a, a}, {b, b}],<br> B = [X || {a, X} <- A],<br><br> C = rpc:pmap({?MODULE, f}, [], A),<br> D = [X || {a, X} <- C],<br> {B, D}.<br>
<br>f(X) -> X.<br>----------------------------------------------<br><br>Basically I have a list, A, and an rpc:pmap call to the identity function with A as the list - this quite correctly returns A (stored in C). Next, I run a filter list comprehension over A and C to grab just the tuples with 'a' as their first element. The code all works fine (returning {[a], [a]}) but dialyzer complains:<br>
<br>dialyzer_test.erl:10: The pattern [{'a', X} | _] can never match the type ['timeout' | {'value',_}]<br><br>Line 10 is the "D =..." line. It looks like the return value of rpc:pmap is being inferred incorrectly, but the -spec for it in rpc.erl gives the return type as [term()] which is what I'd expect.<br>
<br>Any hints? Something obvious I've missed?<br><br>Cheers,<br><br>Bernard<br>