Open Beefster09 opened 1 year ago
This appears to affect all functionality of maps with unions of enums as keys.
Here is a minimal code example, does it capture your use case?
A :: enum { A }
B :: enum { B }
U :: union {A, B}
m: map[U][]int
s := make([]int, 3)
s[0] = 123
m[B.B] = s
fmt.printf("%#v\n", m)
It prints the expected values on my end:
map[B=[
123,
0,
0,
]]
However, I'm using the old map implementation. So please test my example code on latest Odin or test your code on an older Odin version - maybe the new map implementation does not handle this case correctly.
(Also note that make([]T, 0)
(when len(inputs) in your code is zero) will create a nil slice)
The map doesn't work on latest version either. My current workaround is to have two separate maps.
Context
Expected Behavior
Assigning a slice to a map[union][]T should work
Current Behavior
the slice is still nil