Skip to content

Tests for float- and double- backed Enums #29266

@filipnavara

Description

@filipnavara

There are numerous test for Enum types backed by float or double in EnumTests.cs and EnumTests.netcoreapp.cs.

The ECMA specification doesn't allow these Enum types:

The symbols of an enum are represented by an underlying integer type: one of { bool, char, int8, unsigned int8, int16, unsigned int16, int32, unsigned int32, int64, unsigned int64, native int, unsigned native int }

(ECMA CLR standard, §II.14.3)

Moreover, in many cases the tests actually expect a broken behaviour like incorrect parsing of values or Enum.GetNames/Enum.GetValues not returning results sorted by the values:

https://github.com/dotnet/corefx/blob/10d7d6f812295a572eb148aedb19efd2f96fbe17/src/System.Runtime/tests/System/EnumTests.cs#L90-L96

I believe these tests should be removed, CoreCLR should not allow float- and double- backed enums and there should be test verifying that such enums cannot be created.

/cc @jkotas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions