From f2aebf4f0628b016f50fb15f5e89346d095c990e Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Fri, 11 Oct 2019 16:52:58 +0200 Subject: [PATCH] Solve the problem --- src/typechecker.erl | 6 +++++- test/{known_problems => }/should_pass/binary_in_union.erl | 0 2 files changed, 5 insertions(+), 1 deletion(-) rename test/{known_problems => }/should_pass/binary_in_union.erl (100%) diff --git a/src/typechecker.erl b/src/typechecker.erl index 4c511f07d..0e2b96fa8 100644 --- a/src/typechecker.erl +++ b/src/typechecker.erl @@ -2783,7 +2783,11 @@ type_check_comprehension_in(Env, ResTy, bc, Expr, P, []) -> [{integer, erl_anno:new(0), 0}, {integer, erl_anno:new(0), 1}]}; _ -> - throw({type_error, bc, P, ResTy}) + case subtype({type, erl_anno:new(0), binary, []}, ResTy, Env) of + {true, _} -> ResTy; + false -> + throw({type_error, bc, P, ResTy}) + end end, {_VB, Cs} = type_check_expr_in(Env, ExprTy, Expr), {#{}, Cs}; diff --git a/test/known_problems/should_pass/binary_in_union.erl b/test/should_pass/binary_in_union.erl similarity index 100% rename from test/known_problems/should_pass/binary_in_union.erl rename to test/should_pass/binary_in_union.erl