8000 Inconsistent support for converting number strings with binary-multiplier / number-type suffixes to numbers · Issue #7710 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Inconsistent support for converting number strings with binary-multiplier / number-type suffixes to numbers #7710
@mklement0

Description

@mklement0

Note:

  • Changing this would technically be a breaking change and/or may be undesirable for performance reasons, in which case the issue should be documented.

When converting from strings,

  • PowerShell currently DOES recognize binary-multiplier suffixes such as kb, mb, ...:

    • in expressions (e.g., '1gb' / 1)
  • but DOES NOT recognize them:

    • during implicit type conversion in then context of parameter binding (e.g.,
      & { param([int] $foo) } '1gb')

    • (perhaps less surprisingly) in explicit type conversions with casts (e.g., [int] '1gb')

Update: The same applies to PowerShell's number-data-type suffixes such as d for [decimal] and l for [long].

Environment data

Written as of:

PowerShell Core 6.1.0-preview.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking-Changebreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionIssue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Languageparser, language semantics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0