parser: add xor type check

pull/2714/head
Daren Liang 2019-11-09 12:36:56 -05:00 committed by Alexander Medvednikov
parent ab37081f02
commit c607246218
1 changed files with 2 additions and 2 deletions

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 {