checker: c2v rune comparison fix
parent
3732db2bcc
commit
1e9156fd71
|
@ -93,6 +93,8 @@ fn C._execve(cmd_path &char, args voidptr, envs voidptr) int
|
||||||
|
|
||||||
fn C._execvp(cmd_path &char, args &&char) int
|
fn C._execvp(cmd_path &char, args &&char) int
|
||||||
|
|
||||||
|
fn C.strcmp(s1 &char, s2 &char) int
|
||||||
|
|
||||||
[trusted]
|
[trusted]
|
||||||
fn C.fork() int
|
fn C.fork() int
|
||||||
|
|
||||||
|
|
|
@ -648,7 +648,8 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
|
||||||
rs, _ := c.table.type_size(right_type)
|
rs, _ := c.table.type_size(right_type)
|
||||||
// prevent e.g. `u32 == i16` but not `u16 == i32` as max_u16 fits in i32
|
// prevent e.g. `u32 == i16` but not `u16 == i32` as max_u16 fits in i32
|
||||||
// TODO u32 == i32, change < to <=
|
// TODO u32 == i32, change < to <=
|
||||||
if (is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls) {
|
if !c.pref.translated && ((is_left_type_signed && ls < rs)
|
||||||
|
|| (is_right_type_signed && rs < ls)) {
|
||||||
lt := c.table.sym(left_type).name
|
lt := c.table.sym(left_type).name
|
||||||
rt := c.table.sym(right_type).name
|
rt := c.table.sym(right_type).name
|
||||||
c.error('`$lt` cannot be compared with `$rt`', node.pos)
|
c.error('`$lt` cannot be compared with `$rt`', node.pos)
|
||||||
|
|
Loading…
Reference in New Issue