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

parser: do not all string casts

This commit is contained in:
Alexander Medvednikov 2019-11-05 20:41:02 +03:00
parent b91a537c35
commit 7fc7c05e9d

View File

@ -523,6 +523,10 @@ fn (p mut Parser) cast(typ string) {
}
p.error('cannot cast `$expr_typ` to `bool`')
}
// Strings can't be cast
if expr_typ == 'string' {
p.error('cannot cast `$expr_typ` to `$typ`')
}
p.cgen.set_placeholder(pos, '($typ)(')
}
p.check(.rpar)