Change how data-carrying enums are represented in C# to put the structs for the variants inside a wrapper class. This effectively namespaces the variants such that they won't collide if a variant has the same name as another type in the same namespace.
This also has the added benefit of making data-carrying enums feel a bit more like regular enums on the C# side. For example, the following exported enum:
let value = new MyEnum.Foo();
switch (value)
{
case MyEnum.Foo foo:
// ...
case MyEnum.Bar bar:
// ...
}
In order to better handle naming collisions, I've updated the bits of code that generate type references to fully-qualify the generated type name for all user-defined types. For now that just means prefixing them with global::, but this can be extended to include the full namespace once custom namespaces are supported.
Change how data-carrying enums are represented in C# to put the structs for the variants inside a wrapper class. This effectively namespaces the variants such that they won't collide if a variant has the same name as another type in the same namespace.
This also has the added benefit of making data-carrying enums feel a bit more like regular enums on the C# side. For example, the following exported enum:
Is used like this on the C# side:
In order to better handle naming collisions, I've updated the bits of code that generate type references to fully-qualify the generated type name for all user-defined types. For now that just means prefixing them with
global::
, but this can be extended to include the full namespace once custom namespaces are supported.