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

parser: Update Division or Modulo by Zero Message

This commit is contained in:
Swastik Baranwal 2019-09-28 22:22:52 +05:30 committed by Alexander Medvednikov
parent d59d921e84
commit 7952d591b9

View File

@ -2435,7 +2435,7 @@ fn (p mut Parser) term() string {
p.gen(tok.str())// + ' /*op2*/ ')
p.fgen(' ' + tok.str() + ' ')
if (is_div || is_mod) && p.tok == .number && p.lit == '0' {
p.error('division by zero')
p.error('division or modulo by zero')
}
if is_mod && (is_float_type(typ) || !is_number_type(typ)) {
p.error('operator .mod requires integer types')