aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/contract34
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/bs_constraints.erl32
2 files changed, 34 insertions, 2 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/contract3 b/lib/dialyzer/test/small_SUITE_data/results/contract3
index 44b49e745a..6e111f87d9 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/contract3
+++ b/lib/dialyzer/test/small_SUITE_data/results/contract3
@@ -1,3 +1,3 @@
-contract3.erl:17: Overloaded contract has overlapping domains; such contracts are currently unsupported and are simply ignored
-contract3.erl:29: Overloaded contract has overlapping domains; such contracts are currently unsupported and are simply ignored
+contract3.erl:17: Overloaded contract for contract3:t1/1 has overlapping domains; such contracts are currently unsupported and are simply ignored
+contract3.erl:29: Overloaded contract for contract3:t3/3 has overlapping domains; such contracts are currently unsupported and are simply ignored
diff --git a/lib/dialyzer/test/small_SUITE_data/src/bs_constraints.erl b/lib/dialyzer/test/small_SUITE_data/src/bs_constraints.erl
new file mode 100644
index 0000000000..08dfb0808d
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/bs_constraints.erl
@@ -0,0 +1,32 @@
+%% Program which shows that the handling of binaries was not correct.
+%% The success typing inferred was:
+%% -spec bits1(<<_:3>>) -> <<_:3>>.
+%% while it should be:
+%% -spec bits1(<<_:3,_:_*1>>) -> <<_:3>>.
+%% because the only constraint which exists for the head variable is
+%% that it must be a bitstring of bit size at least 3, not a bitstring
+%% of bit size 3.
+-module(bs_constraints).
+
+-export([bits1/1, bits2/1, bits3/1, bins/1, test/0]).
+
+bits1(B) ->
+ <<B:3/bits>>.
+
+bits2(B) ->
+ <<B:4/bits>>.
+
+bits3(B) ->
+ {bits1(B), bits2(B)}.
+
+%% Same problem with the one below. The success typing should be:
+%% -spec bins(<<_:16,_:_*1>>) -> <<_:16>>.
+bins(B) ->
+ <<B:2/binary>>.
+
+%% Same problem, when unit size is a variable:
+test() ->
+ foo(8, 0, <<42>>).
+
+foo(N, S, A) ->
+ <<A:S/binary-unit:1, A:(N-S)/binary-unit:1>>.