Title: enum: Underlying type · Issue #8028 · PowerShell/PowerShell · GitHub
Open Graph Title: enum: Underlying type · Issue #8028 · PowerShell/PowerShell
X Title: enum: Underlying type · Issue #8028 · PowerShell/PowerShell
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. A...
Open Graph 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 unde...
X 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 unde...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8028
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"enum: Underlying type","articleBody":"Enumerations in PowerShell appear to be limited to Int32. Ideally enums should allow inheritance-style setting of the underlying type.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\nPowerShell does not appear to allow an underlying type to be defined for an enum. All values are coerced to Int32.\r\n\r\nThe statement below will raise an exception:\r\n```powershell\r\nenum Fruit { Apple = 0x0FFFFFFFFFFFFFFF }\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nAn enumeration wiith underlying type set to [Int64] to be created.\r\n\r\n```powershell\r\nenum Fruit { Apple = 0x0FFFFFFFFFFFFFFF }\r\n[Fruit].GetEnumUnderlyingType() -eq [Int64]\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\nAn exception is throw when the attempt to cast fails.\r\n\r\n```none\r\nEnumerator value is too large for a System.Int.\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\n> $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 6.1.0\r\nPSEdition Core\r\nGitCommitId 6.1.0\r\nOS Microsoft Windows 10.0.17134\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/indented-automation","@type":"Person","name":"indented-automation"},"datePublished":"2018-10-15T13:18:09Z","url":"https://github.com/PowerShell/PowerShell/issues/8028"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3faa50d7-7eb9-7a29-90d1-d4ed10bbe029 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBCC:1316A0:6CAF71:98D9C6:6AFDC0B8 |
| html-safe-nonce | bcb17982edfb435e6fcda7ac9f4936ded3040a208f257faa61c871682f274290 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkNDOjEzMTZBMDo2Q0FGNzE6OThEOUM2OjZBRkRDMEI4IiwidmlzaXRvcl9pZCI6IjM1NjYxNjEzMjgxOTgyMzgzOTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 75193593c1f54a40004454fb255416692b6af9c959fe9735d8d4ab0d33f3c605 |
| hovercard-subject-tag | issue:370159170 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/8028/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f01abe87ac4eae6a44530edb9f415d986f7a9db22486be1bdc400e04995a06d/PowerShell/PowerShell/issues/8028 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f01abe87ac4eae6a44530edb9f415d986f7a9db22486be1bdc400e04995a06d/PowerShell/PowerShell/issues/8028 |
| og:image:alt | 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 unde... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | indented-automation |
| hostname | github.com |
| expected-hostname | github.com |
| None | 35c6bf57da1370dc64866160540c0ee9f825f291935b3bf6ec5492b00e35f3a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab48c73a2978548773f5f24717ed9e58508befdb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width