mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix mod type check
This commit is contained in:
parent
ca259331e4
commit
6afd7d50a6
@ -2522,9 +2522,12 @@ fn (p mut Parser) term() string {
|
||||
p.error('division or modulo by zero')
|
||||
}
|
||||
expr_type := p.unary()
|
||||
if is_mod {
|
||||
if !(is_integer_type(expr_type) && is_integer_type(typ)) {
|
||||
p.error('operator `mod` requires integer types')
|
||||
}
|
||||
} else {
|
||||
p.check_types(expr_type, typ)
|
||||
if is_mod && (!is_integer_type(expr_type) || !is_integer_type(typ)) {
|
||||
p.error('operator % requires integer types')
|
||||
}
|
||||
}
|
||||
return typ
|
||||
|
Loading…
Reference in New Issue
Block a user