compiler: prevent string to byte cast
parent
437ba14521
commit
772c0c3f93
|
@ -2920,6 +2920,9 @@ fn (p mut Parser) cast(typ string) string {
|
||||||
p.error('cannot cast `$expr_typ` to `$typ`')
|
p.error('cannot cast `$expr_typ` to `$typ`')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if typ == 'byte' && expr_typ == 'string' {
|
||||||
|
p.error('cannot cast `$expr_typ` to `$typ`, use backquotes `` to create a `$typ` or access the value of an index of `$expr_typ` using []')
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
p.cgen.set_placeholder(pos, '($typ)(')
|
p.cgen.set_placeholder(pos, '($typ)(')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue