aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/opaque_SUITE_data
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2011-03-21 18:30:27 +0200
committerHenrik Nord <[email protected]>2011-05-04 15:06:17 +0200
commit7a43c9fb7e2a38263132d50dfc5cd922a91f7599 (patch)
treed706c5121fdca8483c5f76d83b48f82639865628 /lib/dialyzer/test/opaque_SUITE_data
parentb93b8ea8878090753c6972a1156470e5bbe0a010 (diff)
downloadotp-7a43c9fb7e2a38263132d50dfc5cd922a91f7599.tar.gz
otp-7a43c9fb7e2a38263132d50dfc5cd922a91f7599.tar.bz2
otp-7a43c9fb7e2a38263132d50dfc5cd922a91f7599.zip
Add opaque/schuett_bug
Diffstat (limited to 'lib/dialyzer/test/opaque_SUITE_data')
-rw-r--r--lib/dialyzer/test/opaque_SUITE_data/src/schuett_bug.erl28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/schuett_bug.erl b/lib/dialyzer/test/opaque_SUITE_data/src/schuett_bug.erl
new file mode 100644
index 0000000000..00c1aa57bf
--- /dev/null
+++ b/lib/dialyzer/test/opaque_SUITE_data/src/schuett_bug.erl
@@ -0,0 +1,28 @@
+%%---------------------------------------------------------------------------
+%% From: Thorsten Schuett <[email protected]>
+%% Date: 7 July 2010
+%%
+%% When I run dialyzer of R14A on the attached code, it complains about
+%% the new_neighborhood/1 function:
+%% nodelist.erl:12: Invalid type specification for function
+%% nodelist:new_neighborhood/1. The success typing is (_) -> {[any(),...]}
+%%
+%% However, when I change the type nodelist() from opaque to non-opaque
+%% (see comment), dialyzer accepts the code. The types seem to be correct.
+%% The problem seems to be with nested opaque types.
+%%---------------------------------------------------------------------------
+
+-module(schuett_bug).
+
+-export([new_neighborhood/1]).
+
+-export_type([nodelist/0, neighborhood/0]).
+
+-type node_type() :: 'node_type'.
+
+-opaque nodelist() :: [node_type(),...]. % change to -type
+-opaque neighborhood() :: {nodelist()}.
+
+-spec new_neighborhood(Node::node_type()) -> neighborhood().
+new_neighborhood(Node) ->
+ {[Node]}.