1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: add xor type check

This commit is contained in:
Daren Liang 2019-11-09 12:36:56 -05:00 committed by Alexander Medvednikov
parent ab37081f02
commit c607246218

View File

@ -437,9 +437,9 @@ fn (p mut Parser) expression() string {
p.error('strings only support `+` operator')
}
expr_type := p.term()
if (tok_op in [.pipe, .amp]) && !(is_integer_type(expr_type) &&
if (tok_op in [.pipe, .amp, .xor]) && !(is_integer_type(expr_type) &&
is_integer_type(typ)) {
p.error('operators `&` and `|` are defined only on integer types')
p.error('operator ${tok_op.str()} is defined only on integer types')
}
p.check_types(expr_type, typ)
if (is_str || is_ustr) && tok_op == .plus && !p.is_js {