mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
parser: do not all string casts
This commit is contained in:
parent
b91a537c35
commit
7fc7c05e9d
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue