diff options
author | Hans Bolinder <[email protected]> | 2019-04-22 13:54:12 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-04-29 12:00:31 +0200 |
commit | a1e51d125944ad840a306d0cddec681848808f4c (patch) | |
tree | e491a87f73e5082bfaed365226cea3329e56085d /lib/dialyzer/test/small_SUITE_data/src | |
parent | 19e8e534cc26d890378265907ff0a56c101f2625 (diff) | |
download | otp-a1e51d125944ad840a306d0cddec681848808f4c.tar.gz otp-a1e51d125944ad840a306d0cddec681848808f4c.tar.bz2 otp-a1e51d125944ad840a306d0cddec681848808f4c.zip |
dialyzer: Add parentheses around annotated union elements
In contracts, annotated elements of unions are printed with
parentheses around them. They are not parseable otherwise.
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/union_paren.erl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/union_paren.erl b/lib/dialyzer/test/small_SUITE_data/src/union_paren.erl new file mode 100644 index 0000000000..4691a57d98 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/union_paren.erl @@ -0,0 +1,24 @@ +-module(union_paren). + +-compile(export_all). + +t1() -> + t1(3.14). + +-spec t1((A :: integer()) | (B :: atom())) -> integer(). +t1(A) -> + fy:bar(A). + +t2() -> + t2(3.14). + +-spec t2(integer() | atom()) -> integer(). +t2(A) -> + fy:bar(A). + +t3() -> + 3.14 = t3(foo). + +-spec t3(_) -> (I :: integer()) | (A :: atom()). +t3(A) when is_atom(A) -> A; +t3(I) when is_integer(I) -> I. |