mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: do not allow casting strings
This commit is contained in:
parent
e245e22875
commit
6e4ae5a5e6
@ -1686,6 +1686,9 @@ pub fn (mut c Checker) expr(node ast.Expr) table.Type {
|
||||
type_name := c.table.type_to_str(it.expr_type)
|
||||
c.error('cannot cast type `$type_name` to string, use `x.str()` instead', it.pos)
|
||||
}
|
||||
if it.expr_type == table.string_type {
|
||||
c.error('cannot cast a string', it.pos)
|
||||
}
|
||||
if it.has_arg {
|
||||
c.expr(it.arg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user