checker: do not use !in for now

pull/4397/head
Alexander Medvednikov 2020-04-14 04:14:02 +02:00
parent bbc35b1179
commit 5f1b88c2c4
1 changed files with 3 additions and 3 deletions

View File

@ -215,11 +215,11 @@ pub fn (c mut Checker) infix_expr(infix_expr mut ast.InfixExpr) table.Type {
c.error('infix expr: cannot use `$right.name` (right expression) as `$left.name`',
infix_expr.pos)
}
if left_type == table.bool_type && infix_expr.op !in [.eq, .ne, .logical_or, .and] {
if left_type == table.bool_type && !(infix_expr.op in [.eq, .ne, .logical_or, .and]) {
c.error('bool types only have the following operators defined: `==`, `!=`, `||`, and `&&`',
infix_expr.pos)
} else if left_type == table.string_type && !(infix_expr.op in [.plus, .eq, .ne, .lt, .gt, .le,
.ge]) {
} else if left_type == table.string_type && !(infix_expr.op in [.plus, .eq, .ne, .lt, .gt,
.le, .ge]) {
// TODO broken !in
c.error('string types only have the following operators defined: `==`, `!=`, `<`, `>`, `<=`, `>=`, and `&&`',
infix_expr.pos)