mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix mod assign type check
This commit is contained in:
parent
fbd71e1539
commit
df6bdf59e6
@ -1296,6 +1296,14 @@ fn ($v.name mut $v.typ) $p.cur_fn.name (...) {
|
||||
p.error_with_token_index( 'cannot use non-integer type `$expr_type` as shift argument', errtok)
|
||||
}
|
||||
}
|
||||
else if tok == .mod_assign {
|
||||
if !is_integer_type(p.assigned_type) {
|
||||
p.error_with_token_index( 'cannot use modulo operator on non-integer type `$p.assigned_type`', errtok)
|
||||
}
|
||||
if !is_integer_type(expr_type) {
|
||||
p.error_with_token_index( 'cannot use non-integer type `$expr_type` as modulo argument', errtok)
|
||||
}
|
||||
}
|
||||
else if !p.builtin_mod && !p.check_types_no_throw(expr_type, p.assigned_type) {
|
||||
p.error_with_token_index( 'cannot use type `$expr_type` as type `$p.assigned_type` in assignment', errtok)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user