checker: remove dots from error messages

pull/4518/head
yuyi 2020-04-20 17:57:07 +08:00 committed by GitHub
parent 2805f8d0cc
commit 07f69fab19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -292,12 +292,12 @@ pub fn (c mut Checker) infix_expr(infix_expr mut ast.InfixExpr) table.Type {
} }
if infix_expr.op in [.key_in, .not_in] { if infix_expr.op in [.key_in, .not_in] {
if !(right.kind in [.array, .map, .string]) { if !(right.kind in [.array, .map, .string]) {
c.error('`in` can only be used with an array/map/string.', infix_expr.pos) c.error('`in` can only be used with an array/map/string', infix_expr.pos)
} }
if right.kind == .array { if right.kind == .array {
right_sym := c.table.get_type_symbol(right.array_info().elem_type) right_sym := c.table.get_type_symbol(right.array_info().elem_type)
if left.kind != .alias && left.kind != right_sym.kind { if left.kind != .alias && left.kind != right_sym.kind {
c.error('the data type on the left of `in` does not match the array item type.', infix_expr.pos) c.error('the data type on the left of `in` does not match the array item type', infix_expr.pos)
} }
} }
return table.bool_type return table.bool_type

View File

@ -1,4 +1,4 @@
vlib/v/checker/tests/inout/in_array_mismatch_type.v:2:7: error: the data type on the left of `in` does not match the array item type. vlib/v/checker/tests/inout/in_array_mismatch_type.v:2:7: error: the data type on the left of `in` does not match the array item type
1| fn main() { 1| fn main() {
2| if 1 in ['1', '2'] { 2| if 1 in ['1', '2'] {
~~ ~~