checker: update error message for `if 'a' in 'abcd' {`
parent
ba9aad1d92
commit
57fa9768d5
|
@ -623,7 +623,7 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
|
||||||
node.left_type = map_info.key_type
|
node.left_type = map_info.key_type
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c.error('`$node.op.str()` can only be used with an array/map/string',
|
c.error('`$node.op.str()` can only be used with arrays and maps',
|
||||||
node.pos)
|
node.pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,21 @@ vlib/v/checker/tests/in_mismatch_type.vv:13:5: error: left operand to `in` does
|
||||||
| ~~~~~~
|
| ~~~~~~
|
||||||
14 | println('yeah')
|
14 | println('yeah')
|
||||||
15 | }
|
15 | }
|
||||||
vlib/v/checker/tests/in_mismatch_type.vv:16:7: error: `in` can only be used with an array/map/string
|
vlib/v/checker/tests/in_mismatch_type.vv:16:7: error: `in` can only be used with arrays and maps
|
||||||
14 | println('yeah')
|
14 | println('yeah')
|
||||||
15 | }
|
15 | }
|
||||||
16 | if 3 in s {
|
16 | if 3 in s {
|
||||||
| ~~
|
| ~~
|
||||||
17 | println('dope')
|
17 | println('dope')
|
||||||
18 | }
|
18 | }
|
||||||
vlib/v/checker/tests/in_mismatch_type.vv:19:9: error: `in` can only be used with an array/map/string
|
vlib/v/checker/tests/in_mismatch_type.vv:19:9: error: `in` can only be used with arrays and maps
|
||||||
17 | println('dope')
|
17 | println('dope')
|
||||||
18 | }
|
18 | }
|
||||||
19 | if `a` in s {
|
19 | if `a` in s {
|
||||||
| ~~
|
| ~~
|
||||||
20 | println("oh no :'(")
|
20 | println("oh no :'(")
|
||||||
21 | }
|
21 | }
|
||||||
vlib/v/checker/tests/in_mismatch_type.vv:22:7: error: `in` can only be used with an array/map/string
|
vlib/v/checker/tests/in_mismatch_type.vv:22:7: error: `in` can only be used with arrays and maps
|
||||||
20 | println("oh no :'(")
|
20 | println("oh no :'(")
|
||||||
21 | }
|
21 | }
|
||||||
22 | if 1 in 12 {
|
22 | if 1 in 12 {
|
||||||
|
@ -70,8 +70,8 @@ vlib/v/checker/tests/in_mismatch_type.vv:37:5: error: left operand to `!in` does
|
||||||
39 | }
|
39 | }
|
||||||
vlib/v/checker/tests/in_mismatch_type.vv:41:5: error: left operand to `!in` does not match the map key type: expected `string`, not `int literal`
|
vlib/v/checker/tests/in_mismatch_type.vv:41:5: error: left operand to `!in` does not match the map key type: expected `string`, not `int literal`
|
||||||
39 | }
|
39 | }
|
||||||
40 |
|
40 |
|
||||||
41 | if 5 !in m {
|
41 | if 5 !in m {
|
||||||
| ~~~~~~~
|
| ~~~~~~~
|
||||||
42 | println('yay')
|
42 | println('yay')
|
||||||
43 | }
|
43 | }
|
||||||
|
|
Loading…
Reference in New Issue