diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 7758a18146..f9e96e6ed0 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -633,8 +633,10 @@ pub fn (c mut Checker) postfix_expr(node ast.PostfixExpr) table.Type { } */ typ := c.expr(node.expr) - if !table.is_number(typ) { - typ_sym := c.table.get_type_symbol(typ) + typ_sym := c.table.get_type_symbol(typ) + // if !table.is_number(typ) { + if !typ_sym.is_number() { + println(typ_sym.kind.str()) c.error('invalid operation: $node.op.str() (non-numeric type `$typ_sym.name`)', node.pos) } return typ diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 1bc2c7172d..721f20f66b 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -799,6 +799,7 @@ pub fn (p mut Parser) expr(precedence int) (ast.Expr,table.Type) { node = ast.PostfixExpr{ op: p.tok.kind expr: node + pos: p.tok.position() } p.next() return node,typ diff --git a/vlib/v/table/types.v b/vlib/v/table/types.v index 0c0cb62cdd..c194e4d3bd 100644 --- a/vlib/v/table/types.v +++ b/vlib/v/table/types.v @@ -101,10 +101,15 @@ pub const ( number_idxs = [int_type_idx, byte_type_idx, u64_type_idx] ) +/* pub fn is_number(typ Type) bool { - idx := type_idx(typ) - return idx in [int_type_idx, byte_type_idx, u64_type_idx] + typ_sym := c.table.get_type_symbol(typ) + return typ_sym.is_int() + //idx := type_idx(typ) + //return idx in [int_type_idx, byte_type_idx, u64_type_idx] } +*/ + pub const ( void_type = new_type(void_type_idx)