fix(rule_func): refine `+` error info when type implicit conversion

This commit is contained in:
JimMoen 2022-09-29 14:05:40 +08:00
parent d8a022fb45
commit 0a5a0867e4
1 changed files with 7 additions and 1 deletions

View File

@ -338,7 +338,13 @@ null() ->
%% concat 2 strings %% concat 2 strings
'+'(X, Y) when is_binary(X), is_binary(Y) -> '+'(X, Y) when is_binary(X), is_binary(Y) ->
concat(X, Y). concat(X, Y);
%% unsupported type implicit conversion
'+'(X, Y)
when (is_number(X) andalso is_binary(Y)) orelse
(is_binary(X) andalso is_number(Y)) ->
error(unsupported_type_implicit_conversion).
'-'(X, Y) when is_number(X), is_number(Y) -> '-'(X, Y) when is_number(X), is_number(Y) ->
X - Y. X - Y.