Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

A "hybrid" bareword command argument that is parsed as a number unexpectedly behaves like a string with -f (format operator) #17199

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Prerequisites

Steps to reproduce

Passing a bareword argument to a parameter that isn't type-constrained is parsed as a number if it looks like one.

The resulting value self-identifies as a number and mostly acts as such, but it is wrapped in an invisible [psobject] instance in which the original string representation is cached.

In the context of -f, this string representation surfaces unexpectedly, meaning that the value is unexpectedly not treated as a number:

& { param($p) $p.GetType().FullName; '{0:N2}' -f $p } 0x1a

Expected behavior

System.Int32
26.00

Actual behavior

System.Int32
0x1a

Error details

No response

Environment data

PowerShell Core 7.3.0-preview.3

Visuals

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.