1
%%-----------------------------------------------------------------------------
2
%% Test that tests overloaded contratcs.
3
%% In December 2008 it works as far as intersection types are concerned (test1)
4
%% However, it does NOT work as far as type variables are concerned (test2)
5
%%-----------------------------------------------------------------------------
7
-export([test1/0, test2/0, foo/2]).
10
{ok, gazonk} = foo({a,b,1}, atom_to_list(gazonk)),
14
{ok, gazonk} = foo(baz, []),
17
-type mod() :: atom().
19
-spec foo(ATM, list()) -> {'ok', ATM} | {'error', _} when is_subtype(ATM, mod())
20
; (MFA, list()) -> {'ok', MFA} | {'error', _} when is_subtype(MFA, mfa()).
22
foo(F, _) when is_atom(F) ->
23
case atom_to_list(F) of
25
_Other -> {error, mod:bar(F)}
29
false -> {ok, {M,F,A}};