1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
-module(exact). -export([t1/1, t2/1]). t1(M = #{}) -> any_map(M), case M of #{a := _} -> error(fail); _ -> ok end. any_map(X) -> X#{a => 1, a := 2}. t2(M = #{}) -> has_a(M), case M of #{a := _} -> error(ok); _ -> unreachable end. has_a(M) -> M#{a := 1, a => 2}.