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

New syntax for invoking generic methods doesn't support overload reporting when invoked without parentheses #17668

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Prerequisites

Steps to reproduce

Invoking a method name without parentheses (without actually calling the method) is a convenient reflection feature in PowerShell; e.g. (42).ToString lists all overloads of the [int] type's .ToString() method.

However, this doesn't work with the new-in-7.3 syntax (see about_Calling_Generic_Methods) for calling generic methods with explicit type arguments (e.g., [Array]::Empty[int]() to create an empty [int[]] array):

[Array]::Empty         # OK without type argument
[Array]::Empty[int]    # !! BROKEN: treats [int] as an *index* expression

Expected behavior

OverloadDefinitions
-------------------
static T[] Empty[T]()

static int[] Empty[int]()

Actual behavior

ParserError: ...
Line |
  51 |  [Array]::Empty[int]
     |                 ~
     | Array index expression is missing or not valid.

Error details

No response

Environment data

PowerShell Core 7.3.0-preview.5

Visuals

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or more

    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.