-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Enumerations in PowerShell appear to be limited to Int32. Ideally enums should allow inheritance-style setting of the underlying type.
Steps to reproduce
PowerShell does not appear to allow an underlying type to be defined for an enum. All values are coerced to Int32.
The statement below will raise an exception:
enum Fruit { Apple = 0x0FFFFFFFFFFFFFFF }Expected behavior
An enumeration wiith underlying type set to [Int64] to be created.
enum Fruit { Apple = 0x0FFFFFFFFFFFFFFF }
[Fruit].GetEnumUnderlyingType() -eq [Int64]Actual behavior
An exception is throw when the attempt to cast fails.
Enumerator value is too large for a System.Int.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime