Feature request: polymorphic variants support inside untagged variants
https://rescript-lang.org/try?version=v11.0.0-beta.4&code=C4TwDgpgBKkHIEMC20C8UDaAoKUA+UAxAM7ABOAlgHYDmO+RVArkgEYRn0GHXAQ0cuRVgHsRAGwgIqQwiNYArCAGNgshGTIIQs5uPFYAuliwABJlVEAPCABMssaI4D6UdAGVqNSQApHiFABKBgBBTW0fDS0QAB5-ZAgAPkCsIA
type typeName = [
| #string
| #number
| #integer
| #boolean
| #object
| #array
| #null
]
@unboxed
type type_ = Single(typeName) | Array(array<typeName>)
This can be supported in principle, from a semantic viewpoint. Unsure about where it would fit in terms of implementation. In this case, perhaps as a "string" case to cover all the elements.
CC @zth
I guess we could take all those elements and ensure they don't overlap by treating them as we would treat regular constructors but with the polyvariant value as a pretend @as(). | @as("string") String | @as("number") Number etc.
So if one overlaps we'll need to deny it. And if it's open we need to deny it always I guess.