Odin
Odin copied to clipboard
Getting error "A union with #no_nil must have at least 2 variants" for a polymorphic union, even when it has 2 variants
Context
Odin: dev-2023-03:fe533fb8
OS: Windows 10 Home Basic (version: 21H2), build 19044.2728
CPU: Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
RAM: 16246 MiB
Expected Behavior
This "#no_nil union must have 2+ variants" is only fired in the situation that it describes
Current Behavior
The following union causes the error, even though it does have two variants:
BadUnion :: union($T: typeid) #no_nil {
int,
f32,
}
As shown above, the error is thrown whenever the union has the (T) parameter - even if the T type isn't actually used in any of the variants.
Failure Information (for bugs)
Steps to Reproduce
Compile an otherwise-empty project (just a no-op main() procedure) which defines the above BadUnion(T) type