1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: improve the wording of the mismatched range types error

This commit is contained in:
Delyan Angelov 2022-09-17 21:05:30 +03:00
parent bd3c9e888d
commit d67aa8d76c
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 2 additions and 2 deletions

View File

@ -174,7 +174,7 @@ fn (mut c Checker) match_exprs(mut node ast.MatchExpr, cond_type_sym ast.TypeSym
} }
} else { } else {
typ := c.table.type_to_str(c.expr(node.cond)) typ := c.table.type_to_str(c.expr(node.cond))
c.error('mismatched range types - trying to match `$node.cond`, which has type `$typ`, to a range of `rune`', c.error('mismatched range types - trying to match `$node.cond`, which has type `$typ`, against a range of `rune`',
low_expr.pos) low_expr.pos)
} }
} else { } else {

View File

@ -1,4 +1,4 @@
vlib/v/checker/tests/match_range_mismatch_type_err.vv:4:3: error: mismatched range types - trying to match `x`, which has type `string`, to a range of `rune` vlib/v/checker/tests/match_range_mismatch_type_err.vv:4:3: error: mismatched range types - trying to match `x`, which has type `string`, against a range of `rune`
2 | x := '1' 2 | x := '1'
3 | match x { 3 | match x {
4 | `0`...`9` { 4 | `0`...`9` {