Skip to content

Commit 0d52375

Browse files
authored
Add type accelerator ordered for OrderedDictionary (PowerShell#17804)
1 parent 7f69d74 commit 0d52375

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/System.Management.Automation/engine/parser/TypeResolver.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections;
55
using System.Collections.Concurrent;
66
using System.Collections.Generic;
7+
using System.Collections.Specialized;
78
#if !UNIX
89
using System.DirectoryServices;
910
#endif
@@ -753,6 +754,7 @@ internal static class CoreTypes
753754
{ typeof(OutputTypeAttribute), new[] { "OutputType" } },
754755
{ typeof(object[]), null },
755756
{ typeof(ObjectSecurity), new[] { "ObjectSecurity" } },
757+
{ typeof(OrderedDictionary), new[] { "ordered" } },
756758
{ typeof(ParameterAttribute), new[] { "Parameter" } },
757759
{ typeof(PhysicalAddress), new[] { "PhysicalAddress" } },
758760
{ typeof(PSCredential), new[] { "pscredential" } },

test/powershell/Language/Parser/TypeAccelerator.Tests.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,21 @@ Describe "Type accelerators" -Tags "CI" {
400400
}
401401
@{
402402
Accelerator = 'pspropertyexpression'
403-
Type = [Microsoft.PowerShell.Commands.PSPropertyExpression]
403+
Type = [Microsoft.PowerShell.Commands.PSPropertyExpression]
404+
}
405+
@{
406+
Accelerator = 'ordered'
407+
Type = [System.Collections.Specialized.OrderedDictionary]
404408
}
405409
)
406410

407411
if ( !$IsWindows )
408412
{
409-
$totalAccelerators = 99
413+
$totalAccelerators = 100
410414
}
411415
else
412416
{
413-
$totalAccelerators = 104
417+
$totalAccelerators = 105
414418

415419
$extraFullPSAcceleratorTestCases = @(
416420
@{

0 commit comments

Comments
 (0)