diff options
author | Stavros Aronis <[email protected]> | 2011-03-21 18:33:31 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-05-04 15:06:16 +0200 |
commit | 35984f11f0411b09bc945273d7faa0b4ed8b6e66 (patch) | |
tree | 6f9bed8dbfe93e1d0693239d6e753da022f15ac2 /lib/dialyzer/test/small_SUITE_data | |
parent | f78931dbd401f39a88c375c205fabf2c5bd83581 (diff) | |
download | otp-35984f11f0411b09bc945273d7faa0b4ed8b6e66.tar.gz otp-35984f11f0411b09bc945273d7faa0b4ed8b6e66.tar.bz2 otp-35984f11f0411b09bc945273d7faa0b4ed8b6e66.zip |
Add small/blame_contract_range
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/results/blame_contract_range | 4 | ||||
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/blame_contract_range.erl | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/blame_contract_range b/lib/dialyzer/test/small_SUITE_data/results/blame_contract_range new file mode 100644 index 0000000000..0c1c58ac8e --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/blame_contract_range @@ -0,0 +1,4 @@ + +blame_contract_range.erl:11: Function foo/0 has no local return +blame_contract_range.erl:14: The contract blame_contract_range:bar(atom()) -> 'a' cannot be right because the inferred return for bar('b') on line 12 is 'b' +blame_contract_range.erl:15: The pattern 'a' can never match the type 'b' diff --git a/lib/dialyzer/test/small_SUITE_data/src/blame_contract_range.erl b/lib/dialyzer/test/small_SUITE_data/src/blame_contract_range.erl new file mode 100644 index 0000000000..efd3332b44 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/blame_contract_range.erl @@ -0,0 +1,16 @@ +%%----------------------------------------------------------------------- +%% A test where the contract is wrongly specified by the programmer; +%% however, this is found only by refinement. +%% Dialyzer in R14B01 and prior gave a confusing (if not bogus) warning +%% for this case. Corrected in R14B02. +%%----------------------------------------------------------------------- +-module(blame_contract_range). + +-export([foo/0]). + +foo() -> + bar(b). + +-spec bar(atom()) -> a. +bar(a) -> a; +bar(b) -> b. |