Skip to content

Commit

Permalink
Don't validate when there's nothing to validate
Browse files Browse the repository at this point in the history
This would otherwise mean that the consumers would have
to prepare for e.g. validation of empty list, which can
already be done at this level
  • Loading branch information
kivra-pauoli committed Nov 21, 2023
1 parent 5fe6856 commit 2ec464f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/eon_type.erl
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ typecheck(#spec{term=Term0, type=Type, p_have=P_have}) ->
eon_type_rec ->
Term = ?unlift(check_obj(Term0, Type:decl(Term0, P_have))),
case erlang:function_exported(Type, extra_validation, 2) of
true when Term =:= [] ->
Term;
true ->
case Type:extra_validation(Term, P_have) of
ok -> Term;
Expand Down

0 comments on commit 2ec464f

Please sign in to comment.