Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Collections.Immutable.Tests", "tests\System.Collections.Immutable.Tests.csproj", "{95DFC527-4DC1-495E-97D7-E94EE1F7140D}"
ProjectSection(ProjectDependencies) = postProject
{1DD0FF15-6234-4BD6-850A-317F05479554} = {1DD0FF15-6234-4BD6-850A-317F05479554}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Collections.Immutable", "src\System.Collections.Immutable.csproj", "{1DD0FF15-6234-4BD6-850A-317F05479554}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1CA59CB2-FE88-4510-92AC-3561026C3B13}"
ProjectSection(SolutionItems) = preProject
..\.nuget\packages.Windows_NT.config = ..\.nuget\packages.Windows_NT.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D7979177-679D-4E56-919B-479871FA1BDF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E181070D-D93C-4B03-B1EB-133CEA43503E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugNETCoreAppnetstandard1.0netstandard1.3|AnyCPU = DebugNETCoreAppnetstandard1.0netstandard1.3|AnyCPU
ReleaseNETCoreAppnetstandard1.0netstandard1.3|AnyCPU = ReleaseNETCoreAppnetstandard1.0netstandard1.3|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95DFC527-4DC1-495E-97D7-E94EE1F7140D}.DebugNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.ActiveCfg = netstandard1.3-Debug|Any CPU
{95DFC527-4DC1-495E-97D7-E94EE1F7140D}.DebugNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.Build.0 = netstandard1.3-Debug|Any CPU
{95DFC527-4DC1-495E-97D7-E94EE1F7140D}.ReleaseNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.ActiveCfg = netstandard1.3-Release|Any CPU
{95DFC527-4DC1-495E-97D7-E94EE1F7140D}.ReleaseNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.Build.0 = netstandard1.3-Release|Any CPU
{1DD0FF15-6234-4BD6-850A-317F05479554}.DebugNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.ActiveCfg = netstandard1.0-Debug|Any CPU
{1DD0FF15-6234-4BD6-850A-317F05479554}.DebugNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.Build.0 = netstandard1.0-Debug|Any CPU
{1DD0FF15-6234-4BD6-850A-317F05479554}.ReleaseNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.ActiveCfg = netstandard1.0-Release|Any CPU
{1DD0FF15-6234-4BD6-850A-317F05479554}.ReleaseNETCoreAppnetstandard1.0netstandard1.3|AnyCPU.Build.0 = netstandard1.0-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{95DFC527-4DC1-495E-97D7-E94EE1F7140D} = {95DFC527-4DC1-495E-97D7-E94EE1F7140D}
{1DD0FF15-6234-4BD6-850A-317F05479554} = {1DD0FF15-6234-4BD6-850A-317F05479554}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<PackageVersion>1.4.0</PackageVersion>
<AssemblyVersion>1.2.2</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.Collections.Immutable.pkgproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<!-- we need to be supported on pre-nuget-3 platforms (Dev12, Dev11, etc) -->
<MinClientVersion>2.8.6</MinClientVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\System.Collections.Immutable.builds">
<SupportedFramework>net45;netcore45;netcoreapp1.0;wp8;wpa81;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard1.0;
netcoreapp;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Collections.Generic")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion", Justification = "The official build system adds this attribute.")]

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Interface Name="System.Collections.Generic.IHashKeyCollection&lt;TKey&gt;">
<Position X="12.75" Y="0.5" Width="1.75" />
<TypeIdentifier>
<HashCode>AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>IHashKeyCollection.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="System.Collections.Immutable.IImmutableDictionary&lt;TKey, TValue&gt;">
<Position X="8" Y="0.5" Width="2" />
<TypeIdentifier>
<HashCode>AAIAAAAAAAAABAEAAAAABAAAAAAAACAAAAAAAIBUAAA=</HashCode>
<FileName>IImmutableDictionary.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="System.Collections.Immutable.IImmutableList&lt;T&gt;">
<Position X="4.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AGIAAEAAAAAABAEAAAAABAAAAAAAAAAAKAAAAIBUACA=</HashCode>
<FileName>IImmutableList.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="System.Collections.Immutable.IImmutableQueue&lt;T&gt;">
<Position X="2.5" Y="0.5" Width="1.75" />
<TypeIdentifier>
<HashCode>AABAAAAAAAAEAAAAAAAAAAAAAAAABAAAAAAAAABAAAA=</HashCode>
<FileName>IImmutableQueue.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="System.Collections.Immutable.IImmutableSet&lt;T&gt;">
<Position X="6.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAoAgBAAACBAAABAAAAEBAAAAABAAAAAAgAAAQBQAAA=</HashCode>
<FileName>IImmutableSet.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="System.Collections.Immutable.IImmutableStack&lt;T&gt;">
<Position X="0.5" Y="0.5" Width="1.75" />
<TypeIdentifier>
<HashCode>AABAAAAAAAAEAAAAAAAAAAAAAACAAAAAAAAAAABACAA=</HashCode>
<FileName>IImmutableStack.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="System.Collections.Generic.ISortKeyCollection&lt;TKey&gt;">
<Position X="10.75" Y="0.5" Width="1.75" />
<TypeIdentifier>
<HashCode>AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>ISortKeyCollection.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>

View File

@@ -0,0 +1 @@
internal static System.Collections.Generic.Dictionary<System.Type, object> System.Collections.Immutable.AllocFreeConcurrentStack.t_stacks

View File

@@ -0,0 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("System.Collections.Immutable.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]

View File

@@ -0,0 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Security;
[assembly: SecurityTransparent]

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ArrayInitializedStateNotEqual" xml:space="preserve">
<value>Object is not a array with the same initialization state as the array to compare it to.</value>
</data>
<data name="ArrayLengthsNotEqual" xml:space="preserve">
<value>Object is not a array with the same number of elements as the array to compare it to.</value>
</data>
<data name="CannotFindOldValue" xml:space="preserve">
<value>Cannot find the old value</value>
</data>
<data name="CapacityMustBeGreaterThanOrEqualToCount" xml:space="preserve">
<value>Capacity was less than the current Count of elements.</value>
</data>
<data name="CapacityMustEqualCountOnMove" xml:space="preserve">
<value>MoveToImmutable can only be performed when Count equals Capacity.</value>
</data>
<data name="CollectionModifiedDuringEnumeration" xml:space="preserve">
<value>Collection was modified; enumeration operation may not execute.</value>
</data>
<data name="DuplicateKey" xml:space="preserve">
<value>An element with the same key but a different value already exists. Key: {0}</value>
</data>
<data name="InvalidEmptyOperation" xml:space="preserve">
<value>This operation does not apply to an empty instance.</value>
</data>
<data name="InvalidOperationOnDefaultArray" xml:space="preserve">
<value>This operation cannot be performed on a default instance of ImmutableArray&lt;T&gt;. Consider initializing the array, or checking the ImmutableArray&lt;T&gt;.IsDefault property.</value>
</data>
</root>

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<ProjectGuid>{1DD0FF15-6234-4BD6-850A-317F05479554}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>System.Collections.Immutable</RootNamespace>
<AssemblyName>System.Collections.Immutable</AssemblyName>
<FileAlignment>512</FileAlignment>
<DocumentationFile>$(OutputPath)System.Collections.Immutable.xml</DocumentationFile>
<GenerateAppxPackageOnBuild>False</GenerateAppxPackageOnBuild>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.0'">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.0-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="Properties\InternalsVisibleTo.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\SecurityTransparent.cs" />
<Compile Include="System\Collections\Generic\IHashKeyCollection.cs" />
<Compile Include="System\Collections\Generic\ISortKeyCollection.cs" />
<Compile Include="System\Collections\Immutable\AllocFreeConcurrentStack.cs" />
<Compile Include="System\Collections\Immutable\DictionaryEnumerator.cs" />
<Compile Include="System\Collections\Immutable\DisposableEnumeratorAdapter_2.cs" />
<Compile Include="System\Collections\Immutable\IBinaryTree.cs" />
<Compile Include="System\Collections\Immutable\IImmutableArray.cs" />
<Compile Include="System\Collections\Immutable\IImmutableDictionary.cs" />
<Compile Include="System\Collections\Immutable\IImmutableDictionaryInternal.cs" />
<Compile Include="System\Collections\Immutable\IImmutableList.cs" />
<Compile Include="System\Collections\Immutable\IImmutableListQueries.cs" />
<Compile Include="System\Collections\Immutable\IImmutableQueue.cs" />
<Compile Include="System\Collections\Immutable\IImmutableSet.cs" />
<Compile Include="System\Collections\Immutable\IImmutableStack.cs" />
<Compile Include="System\Collections\Immutable\IStrongEnumerable_2.cs" />
<Compile Include="System\Collections\Immutable\IStrongEnumerator_1.cs" />
<Compile Include="System\Collections\Immutable\SortedInt32KeyNode.cs" />
<Compile Include="System\Collections\Immutable\IOrderedCollection.cs" />
<Compile Include="System\Collections\Immutable\ImmutableArray.cs" />
<Compile Include="System\Collections\Immutable\ImmutableArray_1.Builder.cs" />
<Compile Include="System\Collections\Immutable\ImmutableArray_1.Enumerator.cs" />
<Compile Include="System\Collections\Immutable\ImmutableArray_1.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.Builder.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.Comparers.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.DebuggerProxy.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.Enumerator.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.HashBucket.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.MutationInput.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.MutationResult.cs" />
<Compile Include="System\Collections\Immutable\ImmutableDictionary_2.cs" />
<Compile Include="System\Collections\Immutable\ImmutableExtensions.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.Builder.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.DebuggerProxy.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.Enumerator.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.HashBucket.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.MutationInput.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.MutationResult.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.NodeEnumerable.cs" />
<Compile Include="System\Collections\Immutable\ImmutableHashSet_1.cs" />
<Compile Include="System\Collections\Immutable\ImmutableInterlocked.cs" />
<Compile Include="System\Collections\Immutable\ImmutableList.cs" />
<Compile Include="System\Collections\Immutable\ImmutableList_1.Builder.cs" />
<Compile Include="System\Collections\Immutable\ImmutableList_1.cs" />
<Compile Include="System\Collections\Immutable\ImmutableQueue.cs" />
<Compile Include="System\Collections\Immutable\ImmutableQueue_1.cs" />
<Compile Include="System\Collections\Immutable\ImmutableSortedDictionary.cs" />
<Compile Include="System\Collections\Immutable\ImmutableSortedDictionary_2.Builder.cs" />
<Compile Include="System\Collections\Immutable\ImmutableSortedDictionary_2.cs" />
<Compile Include="System\Collections\Immutable\ImmutableSortedSet.cs" />
<Compile Include="System\Collections\Immutable\ImmutableSortedSet_1.Builder.cs" />
<Compile Include="System\Collections\Immutable\ImmutableSortedSet_1.cs" />
<Compile Include="System\Collections\Immutable\ImmutableStack.cs" />
<Compile Include="System\Collections\Immutable\ImmutableStack_1.cs" />
<Compile Include="System\Collections\Immutable\KeysOrValuesCollectionAccessor.cs" />
<Compile Include="System\Collections\Immutable\RefAsValueType.cs" />
<Compile Include="System\Collections\Immutable\SecureObjectPool.cs" />
<Compile Include="System\Linq\ImmutableArrayExtensions.cs" />
<Compile Include="Validation\Requires.cs" />
<Compile Include="Validation\ValidatedNotNullAttribute.cs" />
<Compile Include="$(CommonPath)\System\Runtime\Versioning\NonVersionableAttribute.cs">
<Link>Common\System\Runtime\Versioning\NonVersionableAttribute.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Interfaces.cd" />
<Reference Include="System.Collections" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Globalization" />
<Reference Include="System.Linq" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Threading" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Generic
{
/// <summary>
/// Defined on a generic collection that hashes its contents using an <see cref="IEqualityComparer{TKey}"/>.
/// </summary>
/// <typeparam name="TKey">The type of element hashed in the collection.</typeparam>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
internal interface IHashKeyCollection<in TKey>
{
/// <summary>
/// Gets the comparer used to obtain hash codes for the keys and check equality.
/// </summary>
IEqualityComparer<TKey> KeyComparer { get; }
}
}

View File

@@ -0,0 +1,21 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
namespace System.Collections.Generic
{
/// <summary>
/// Defined on a generic collection that sorts its contents using an <see cref="IComparer{TKey}"/>.
/// </summary>
/// <typeparam name="TKey">The type of element sorted in the collection.</typeparam>
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
internal interface ISortKeyCollection<in TKey>
{
/// <summary>
/// Gets the comparer used to sort keys.
/// </summary>
IComparer<TKey> KeyComparer { get; }
}
}

View File

@@ -0,0 +1,76 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
namespace System.Collections.Immutable
{
internal static class AllocFreeConcurrentStack<T>
{
private const int MaxSize = 35;
private static readonly Type s_typeOfT = typeof(T);
public static void TryAdd(T item)
{
// Just in case we're in a scenario where an object is continually requested on one thread
// and returned on another, avoid unbounded growth of the stack.
Stack<RefAsValueType<T>> localStack = ThreadLocalStack;
if (localStack.Count < MaxSize)
{
localStack.Push(new RefAsValueType<T>(item));
}
}
public static bool TryTake(out T item)
{
Stack<RefAsValueType<T>> localStack = ThreadLocalStack;
if (localStack != null && localStack.Count > 0)
{
item = localStack.Pop().Value;
return true;
}
item = default(T);
return false;
}
private static Stack<RefAsValueType<T>> ThreadLocalStack
{
get
{
// Ensure the [ThreadStatic] is initialized to a dictionary
Dictionary<Type, object> typesToStacks = AllocFreeConcurrentStack.t_stacks;
if (typesToStacks == null)
{
AllocFreeConcurrentStack.t_stacks = typesToStacks = new Dictionary<Type, object>();
}
// Get the stack that corresponds to the T
object stackObj;
if (!typesToStacks.TryGetValue(s_typeOfT, out stackObj))
{
stackObj = new Stack<RefAsValueType<T>>(MaxSize);
typesToStacks.Add(s_typeOfT, stackObj);
}
// Return it as the correct type.
return (Stack<RefAsValueType<T>>)stackObj;
}
}
}
internal static class AllocFreeConcurrentStack
{
// WARNING: We allow diagnostic tools to directly inspect this member (t_stacks).
// See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details.
// Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools.
// Get in touch with the diagnostics team if you have questions.
// Workaround for https://github.com/dotnet/coreclr/issues/2191.
// When that's fixed, a [ThreadStatic] Stack should be added back to AllocFreeConcurrentStack<T>.
[ThreadStatic]
internal static Dictionary<Type, object> t_stacks;
}
}

View File

@@ -0,0 +1,50 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
namespace System.Collections.Immutable
{
internal class DictionaryEnumerator<TKey, TValue> : IDictionaryEnumerator
{
private readonly IEnumerator<KeyValuePair<TKey, TValue>> _inner;
internal DictionaryEnumerator(IEnumerator<KeyValuePair<TKey, TValue>> inner)
{
Requires.NotNull(inner, nameof(inner));
_inner = inner;
}
public DictionaryEntry Entry
{
get { return new DictionaryEntry(_inner.Current.Key, _inner.Current.Value); }
}
public object Key
{
get { return _inner.Current.Key; }
}
public object Value
{
get { return _inner.Current.Value; }
}
public object Current
{
get { return this.Entry; }
}
public bool MoveNext()
{
return _inner.MoveNext();
}
public void Reset()
{
_inner.Reset();
}
}
}

View File

@@ -0,0 +1,96 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
namespace System.Collections.Immutable
{
/// <summary>
/// An adapter that allows a single foreach loop in C# to avoid
/// boxing an enumerator when possible, but fall back to boxing when necessary.
/// </summary>
/// <typeparam name="T">The type of value to be enumerated.</typeparam>
/// <typeparam name="TEnumerator">The type of the enumerator struct.</typeparam>
internal struct DisposableEnumeratorAdapter<T, TEnumerator> : IDisposable
where TEnumerator : struct, IEnumerator<T>
{
/// <summary>
/// The enumerator object to use if not null.
/// </summary>
private readonly IEnumerator<T> _enumeratorObject;
/// <summary>
/// The enumerator struct to use if <see cref="_enumeratorObject"/> is <c>null</c>.
/// </summary>
/// <remarks>
/// This field must NOT be readonly because the field's value is a struct and must be able to mutate
/// in-place. A readonly keyword would cause any mutation to take place in a copy rather than the field.
/// </remarks>
private TEnumerator _enumeratorStruct;
/// <summary>
/// Initializes a new instance of the <see cref="DisposableEnumeratorAdapter{T, TEnumerator}"/> struct
/// for enumerating over a strongly typed struct enumerator.
/// </summary>
/// <param name="enumerator">The initialized enumerator struct.</param>
internal DisposableEnumeratorAdapter(TEnumerator enumerator)
{
_enumeratorStruct = enumerator;
_enumeratorObject = null;
}
/// <summary>
/// Initializes a new instance of the <see cref="DisposableEnumeratorAdapter{T, TEnumerator}"/> struct
/// for enumerating over a (boxed) <see cref="IEnumerable{T}"/> enumerator.
/// </summary>
/// <param name="enumerator">The initialized enumerator object.</param>
internal DisposableEnumeratorAdapter(IEnumerator<T> enumerator)
{
_enumeratorStruct = default(TEnumerator);
_enumeratorObject = enumerator;
}
/// <summary>
/// Gets the current enumerated value.
/// </summary>
public T Current
{
get { return _enumeratorObject != null ? _enumeratorObject.Current : _enumeratorStruct.Current; }
}
/// <summary>
/// Moves to the next value.
/// </summary>
public bool MoveNext()
{
return _enumeratorObject != null ? _enumeratorObject.MoveNext() : _enumeratorStruct.MoveNext();
}
/// <summary>
/// Disposes the underlying enumerator.
/// </summary>
public void Dispose()
{
if (_enumeratorObject != null)
{
_enumeratorObject.Dispose();
}
else
{
_enumeratorStruct.Dispose();
}
}
/// <summary>
/// Returns a copy of this struct.
/// </summary>
/// <remarks>
/// This member is here so that it can be used in C# foreach loops.
/// </remarks>
public DisposableEnumeratorAdapter<T, TEnumerator> GetEnumerator()
{
return this;
}
}
}

View File

@@ -0,0 +1,59 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Immutable
{
/// <summary>
/// An interface for binary tree nodes that allow our common enumerator to walk the graph.
/// </summary>
internal interface IBinaryTree
{
/// <summary>
/// Gets the depth of the tree below this node.
/// </summary>
int Height { get; }
/// <summary>
/// Gets a value indicating whether this node is empty.
/// </summary>
bool IsEmpty { get; }
/// <summary>
/// Gets the number of non-empty nodes at this node and below.
/// </summary>
/// <exception cref="NotSupportedException">Thrown if the implementation does not store this value at the node.</exception>
int Count { get; }
/// <summary>
/// Gets the left branch of this node.
/// </summary>
IBinaryTree Left { get; }
/// <summary>
/// Gets the right branch of this node.
/// </summary>
IBinaryTree Right { get; }
}
/// <summary>
/// An interface for binary tree nodes that allow our common enumerator to walk the graph.
/// </summary>
/// <typeparam name="T">The type of value for each node.</typeparam>
internal interface IBinaryTree<out T> : IBinaryTree
{
/// <summary>
/// Gets the value represented by the current node.
/// </summary>
T Value { get; }
/// <summary>
/// Gets the left branch of this node.
/// </summary>
new IBinaryTree<T> Left { get; }
/// <summary>
/// Gets the right branch of this node.
/// </summary>
new IBinaryTree<T> Right { get; }
}
}

View File

@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Immutable
{
/// <summary>
/// An internal non-generic interface implemented by <see cref="ImmutableArray{T}"/>
/// that allows for recognition of an <see cref="ImmutableArray{T}"/> instance and access
/// to its underlying array, without actually knowing the type of value
/// stored in it.
/// </summary>
/// <remarks>
/// Casting to this interface requires a boxed instance of the <see cref="ImmutableArray{T}"/> struct,
/// and as such should be avoided. This interface is useful, however, where the value
/// is already boxed and we want to try to reuse immutable arrays instead of copying them.
/// ** This interface is INTENTIONALLY INTERNAL, as it gives access to the inner array. **
/// </remarks>
internal interface IImmutableArray
{
/// <summary>
/// Gets an untyped reference to the array.
/// </summary>
Array Array { get; }
}
}

View File

@@ -0,0 +1,112 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
namespace System.Collections.Immutable
{
/// <summary>
/// An immutable key-value dictionary.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "Ignored")]
public interface IImmutableDictionary<TKey, TValue> : IReadOnlyDictionary<TKey, TValue>
{
/// <summary>
/// Gets an empty dictionary with equivalent ordering and key/value comparison rules.
/// </summary>
[Pure]
IImmutableDictionary<TKey, TValue> Clear();
/// <summary>
/// Adds the specified key and value to the dictionary.
/// </summary>
/// <param name="key">The key of the entry to add.</param>
/// <param name="value">The value of the entry to add.</param>
/// <returns>The new dictionary containing the additional key-value pair.</returns>
/// <exception cref="ArgumentException">Thrown when the given key already exists in the dictionary but has a different value.</exception>
/// <remarks>
/// If the given key-value pair are already in the dictionary, the existing instance is returned.
/// </remarks>
[Pure]
IImmutableDictionary<TKey, TValue> Add(TKey key, TValue value);
/// <summary>
/// Adds the specified key-value pairs to the dictionary.
/// </summary>
/// <param name="pairs">The pairs.</param>
/// <returns>The new dictionary containing the additional key-value pairs.</returns>
/// <exception cref="ArgumentException">Thrown when one of the given keys already exists in the dictionary but has a different value.</exception>
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[Pure]
IImmutableDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> pairs);
/// <summary>
/// Sets the specified key and value to the dictionary, possibly overwriting an existing value for the given key.
/// </summary>
/// <param name="key">The key of the entry to add.</param>
/// <param name="value">The value of the entry to add.</param>
/// <returns>The new dictionary containing the additional key-value pair.</returns>
/// <remarks>
/// If the given key-value pair are already in the dictionary, the existing instance is returned.
/// If the key already exists but with a different value, a new instance with the overwritten value will be returned.
/// </remarks>
[Pure]
IImmutableDictionary<TKey, TValue> SetItem(TKey key, TValue value);
/// <summary>
/// Applies a given set of key=value pairs to an immutable dictionary, replacing any conflicting keys in the resulting dictionary.
/// </summary>
/// <param name="items">The key=value pairs to set on the dictionary. Any keys that conflict with existing keys will overwrite the previous values.</param>
/// <returns>An immutable dictionary.</returns>
[Pure]
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
IImmutableDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items);
/// <summary>
/// Removes the specified keys from the dictionary with their associated values.
/// </summary>
/// <param name="keys">The keys to remove.</param>
/// <returns>A new dictionary with those keys removed; or this instance if those keys are not in the dictionary.</returns>
[Pure]
IImmutableDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys);
/// <summary>
/// Removes the specified key from the dictionary with its associated value.
/// </summary>
/// <param name="key">The key to remove.</param>
/// <returns>A new dictionary with the matching entry removed; or this instance if the key is not in the dictionary.</returns>
[Pure]
IImmutableDictionary<TKey, TValue> Remove(TKey key);
/// <summary>
/// Determines whether this dictionary contains the specified key-value pair.
/// </summary>
/// <param name="pair">The key value pair.</param>
/// <returns>
/// <c>true</c> if this dictionary contains the key-value pair; otherwise, <c>false</c>.
/// </returns>
[Pure]
bool Contains(KeyValuePair<TKey, TValue> pair);
/// <summary>
/// Searches the dictionary for a given key and returns the equal key it finds, if any.
/// </summary>
/// <param name="equalKey">The key to search for.</param>
/// <param name="actualKey">The key from the dictionary that the search found, or <paramref name="equalKey"/> if the search yielded no match.</param>
/// <returns>A value indicating whether the search was successful.</returns>
/// <remarks>
/// This can be useful when you want to reuse a previously stored reference instead of
/// a newly constructed one (so that more sharing of references can occur) or to look up
/// the canonical value, or a value that has more complete data than the value you currently have,
/// although their comparer functions indicate they are equal.
/// </remarks>
[Pure]
bool TryGetKey(TKey equalKey, out TKey actualKey);
}
}

Some files were not shown because too many files have changed in this diff Show More