Skip to content

Commit 4d929e6

Browse files
committed
tests: compare a flag enum as an int in enum_method_duplicated_err
The fixture is about a method that duplicates a builtin method of an enum, but that method's body compared a flag enum with an int literal, `f & f2 > 0`, which V1 rejects too and which this check now reports, before the error the fixture is about. The body casts to int, as V asks, and the fixture shows its own error only.
1 parent 4cec3a8 commit 4d929e6

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎vlib/v/parser/tests/enum_method_duplicated_err.out‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ vlib/v/parser/tests/enum_method_duplicated_err.vv:13:14: error: duplicate method
33
12 |
44
13 | fn (f Flags) has(f2 Flags) bool {
55
| ~~~
6-
14 | return f & f2 > 0
6+
14 | return int(f & f2) > 0
77
15 | }

‎vlib/v/parser/tests/enum_method_duplicated_err.vv‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ enum Flags {
1111
}
1212

1313
fn (f Flags) has(f2 Flags) bool {
14-
return f & f2 > 0
14+
return int(f & f2) > 0
1515
}
1616

1717
fn main() {}

0 commit comments

Comments
 (0)