Skip to content

Commit 6268c4b

Browse files
authored
Move Range and Index to Contracts source package (#78371)
1 parent 0211c26 commit 6268c4b

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

src/Compilers/Core/Portable/InternalUtilities/Index.cs renamed to src/Dependencies/Contracts/Index.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#if !NETCOREAPP
5+
#if NET
6+
7+
#pragma warning disable RS0016 // Add public types and members to the declared API (this is a supporting forwarder for an internal polyfill API)
8+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Index))]
9+
#pragma warning restore RS0016 // Add public types and members to the declared API
10+
11+
#else
12+
613
using System.Runtime.CompilerServices;
14+
715
namespace System
816
{
917
/// <summary>Represent a type can be used to index a collection either from the start or the end.</summary>

src/Dependencies/Contracts/Microsoft.CodeAnalysis.Contracts.projitems

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<Compile Include="$(MSBuildThisFileDirectory)RequiredMemberAttribute.cs" />
2626
<Compile Include="$(MSBuildThisFileDirectory)SetsRequiredMembersAttribute.cs" />
2727
<Compile Include="$(MSBuildThisFileDirectory)ExceptionUtilities.cs" />
28+
<Compile Include="$(MSBuildThisFileDirectory)Index.cs" />
29+
<Compile Include="$(MSBuildThisFileDirectory)Range.cs" />
2830
</ItemGroup>
2931
<ItemGroup Condition="'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'">
3032
<ExpectedCompile Include="$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)" />

src/Compilers/Core/Portable/InternalUtilities/Range.cs renamed to src/Dependencies/Contracts/Range.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#if !NETCOREAPP
5+
#if NET
6+
7+
#pragma warning disable RS0016 // Add public types and members to the declared API (this is a supporting forwarder for an internal polyfill API)
8+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Range))]
9+
#pragma warning restore RS0016 // Add public types and members to the declared API
10+
11+
#else
612
using System.Runtime.CompilerServices;
7-
using Roslyn.Utilities;
13+
814
namespace System
915
{
1016
/// <summary>Represent a range has start and end indexes.</summary>
@@ -46,9 +52,7 @@ value is Range r &&
4652

4753
/// <summary>Returns the hash code for this instance.</summary>
4854
public override int GetHashCode()
49-
{
50-
return Hash.Combine(Start.GetHashCode(), End.GetHashCode());
51-
}
55+
=> unchecked(Start.GetHashCode() * (int)0xA5555529 + End.GetHashCode());
5256

5357
/// <summary>Converts the value of the current Range object to its equivalent string representation.</summary>
5458
public override string ToString()

src/Tools/SemanticSearch/BuildTask/SemanticSearch.BuildTask.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,5 @@
1616
<ItemGroup>
1717
<InternalsVisibleTo Include="SemanticSearch.BuildTask.UnitTests" />
1818
</ItemGroup>
19-
<ItemGroup>
20-
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\Range.cs" Link="Utilities\Range.cs" />
21-
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\Index.cs" Link="Utilities\Index.cs" />
22-
<Compile Include="..\..\..\Compilers\Core\Portable\InternalUtilities\Hash.cs" Link="Utilities\Hash.cs" />
23-
</ItemGroup>
2419
<Import Project="..\..\..\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems" Label="Shared" />
2520
</Project>

src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@
113113
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\Compilers\Core\Portable\InternalUtilities\ImmutableListExtensions.cs">
114114
<Link>InternalUtilities\ImmutableListExtensions.cs</Link>
115115
</Compile>
116-
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\Compilers\Core\Portable\InternalUtilities\Index.cs">
117-
<Link>InternalUtilities\Index.cs</Link>
118-
</Compile>
119116
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\Compilers\Core\Portable\InternalUtilities\ISetExtensions.cs">
120117
<Link>InternalUtilities\ISetExtensions.cs</Link>
121118
</Compile>
@@ -140,9 +137,6 @@
140137
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\Compilers\Core\Portable\InternalUtilities\PlatformInformation.cs">
141138
<Link>InternalUtilities\PlatformInformation.cs</Link>
142139
</Compile>
143-
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\Compilers\Core\Portable\InternalUtilities\Range.cs">
144-
<Link>InternalUtilities\Range.cs</Link>
145-
</Compile>
146140
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\Compilers\Core\Portable\InternalUtilities\ReaderWriterLockSlimExtensions.cs">
147141
<Link>InternalUtilities\ReaderWriterLockSlimExtensions.cs</Link>
148142
</Compile>

0 commit comments

Comments
 (0)