From 41554aafa7a592b2e90df1579020adfaaeb76ca0 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sat, 9 Apr 2022 15:46:25 +0100 Subject: [PATCH] fmt --- vlib/v/ast/types.v | 22 +++++++++++----------- vlib/v/checker/checker.v | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index 9b48ea7a9e..073efd1d3e 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -376,17 +376,17 @@ pub fn (typ Type) is_unsigned() bool { pub fn (typ Type) flip_signedness() Type { r := match typ { - i8_type {byte_type} - i16_type {u16_type} - int_type {u32_type} - isize_type {usize_type} - i64_type {u64_type} - byte_type {i8_type} - u16_type {i16_type} - u32_type {int_type} - usize_type {isize_type} - u64_type {i64_type} - else {typ} + ast.i8_type { ast.byte_type } + ast.i16_type { ast.u16_type } + ast.int_type { ast.u32_type } + ast.isize_type { ast.usize_type } + ast.i64_type { ast.u64_type } + ast.byte_type { ast.i8_type } + ast.u16_type { ast.i16_type } + ast.u32_type { ast.int_type } + ast.usize_type { ast.isize_type } + ast.u64_type { ast.i64_type } + else { typ } } return r } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 4379c0ec60..f2a9b40671 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -636,8 +636,8 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type { rt := c.table.sym(right_type).name c.error('negative value cannot be compared with `$rt`', node.left.pos) } - } else if is_left_type_signed != is_right_type_signed && - left_type.flip_signedness() != right_type { + } else if is_left_type_signed != is_right_type_signed + && left_type.flip_signedness() != right_type { // prevent e.g. `u16(-1) == int(-1)` which is false in C if (is_right_type_signed && left_type in ast.int_promoted_type_idxs) || (is_left_type_signed && right_type in ast.int_promoted_type_idxs) {