From 7a43c9fb7e2a38263132d50dfc5cd922a91f7599 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Mon, 21 Mar 2011 18:30:27 +0200 Subject: Add opaque/schuett_bug --- .../test/opaque_SUITE_data/src/schuett_bug.erl | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/dialyzer/test/opaque_SUITE_data/src/schuett_bug.erl (limited to 'lib/dialyzer/test') 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 +%% 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]}. -- cgit v1.2.3