parser: fix expected type enum error pos (#7265)
parent
25153490e1
commit
597c2249e0
|
@ -1448,11 +1448,12 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr {
|
|||
// `.green`
|
||||
// `pref.BuildMode.default_mode`
|
||||
fn (mut p Parser) enum_val() ast.EnumVal {
|
||||
start_pos := p.tok.position()
|
||||
p.check(.dot)
|
||||
val := p.check_name()
|
||||
return ast.EnumVal{
|
||||
val: val
|
||||
pos: p.tok.position()
|
||||
pos: start_pos.extend(p.prev_tok.position())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
vlib/v/parser/tests/expected_type_enum_err.vv:6:12: error: expected type is not an enum (`rune`)
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | if `c` == .bar {}
|
||||
| ~~~~
|
||||
7 | }
|
|
@ -0,0 +1,7 @@
|
|||
module main
|
||||
|
||||
enum Test { bar }
|
||||
|
||||
fn main() {
|
||||
if `c` == .bar {}
|
||||
}
|
Loading…
Reference in New Issue