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
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).ToStringlists 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):Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response