V version: V 0.1.27 f8b2374
OS: 5.4.40-1-MANJARO
What did you do?
Add a test for enum array as struct fields:
struct Abc {
mut:
flags []Flag
}
enum Flag {
flag_one
flag_two
}
fn test_enum_array_field() {
mut a := Abc{}
a.flags << .flag_one
}
Then run v test vlib/v/test/enum_array_field_test.v
What did you expect to see?
Test passing
What did you see instead?
$ v test vlib/v/tests/enum_array_field_test.v
----------------------------------------------------------------------- Testing... ---------------------------------------------------------------------
FAIL 37.446 ms vlib/v/tests/enum_array_field_test.v
vlib/v/tests/enum_array_field_test.v:14:1: error: not an enum
12 | mut a := Abc{}
13 | a.flags << .flag_one
14 | }
| ^
--------------------------------------------------------------------------------------------------------------------------------------------------------
38.368 ms <=== total time spent running V _test.v files
ok, fail, skip, total = 0, 1, 0, 1
Notes
This prevents the net.websocket module from compiling.
As a workaround, use
a.flags << Flag.flag_one
it now works with just .flag_one too in 5825e46
Most helpful comment
it now works with just .flag_one too in 5825e46