mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix parsing for array literals in index expressions in method calls (#19224)
This commit is contained in:
@@ -665,6 +665,15 @@ Describe "Parsing using statement with alias and linebreak and comma" -Tag CI {
|
||||
}
|
||||
}
|
||||
|
||||
It "Should correctly parse array literals for index expressions in method calls" {
|
||||
$tks = $null
|
||||
$ers = $null
|
||||
$Script = '[string]::join(" ", (0, 1, 2)[0, 1])'
|
||||
$result = [System.Management.Automation.Language.Parser]::ParseInput($Script, [ref]$tks, [ref]$ers)
|
||||
$result.EndBlock.Statements[0].PipelineElements[0].Expression.Arguments[1].Index.Elements.Count | Should -Be 2
|
||||
$ers.Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "Should correctly parse array types that are used as arguments without brackets in generic type" {
|
||||
$tks = $null
|
||||
$ers = $null
|
||||
|
||||
Reference in New Issue
Block a user