Skip to content

Commit

Permalink
Apply OverloadResolutionPriority to Span-based delegating to ROS coun…
Browse files Browse the repository at this point in the history
…terparts
  • Loading branch information
stephentoub committed Nov 7, 2024
1 parent 8975db4 commit 7e9a33c
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,12 @@ public static System.Collections.Immutable.ImmutableArray<TResult> CreateRange<T
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(params T[]? items) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(T[] items, int start, int length) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(params System.ReadOnlySpan<T> items) { throw null; }
[System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(-1)]
public static System.Collections.Immutable.ImmutableArray<T> Create<T>(System.Span<T> items) { throw null; }
public static System.Collections.Immutable.ImmutableArray<TSource> ToImmutableArray<TSource>(this System.Collections.Generic.IEnumerable<TSource> items) { throw null; }
public static System.Collections.Immutable.ImmutableArray<TSource> ToImmutableArray<TSource>(this System.Collections.Immutable.ImmutableArray<TSource>.Builder builder) { throw null; }
public static System.Collections.Immutable.ImmutableArray<T> ToImmutableArray<T>(this System.ReadOnlySpan<T> items) { throw null; }
[System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(-1)]
public static System.Collections.Immutable.ImmutableArray<T> ToImmutableArray<T>(this System.Span<T> items) { throw null; }
}
[System.Runtime.CompilerServices.CollectionBuilderAttribute(typeof(System.Collections.Immutable.ImmutableArray), "Create")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<Compile Include="System.Collections.Immutable.net9.cs" />
</ItemGroup>

<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\CallerArgumentExpressionAttribute.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections\ref\System.Collections.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\ref\System.Runtime.csproj" />
Expand All @@ -28,4 +32,4 @@
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ The System.Collections.Immutable library is built-in as part of the shared frame
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet.AlternateLookup.cs" />
</ItemGroup>

<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\CallerArgumentExpressionAttribute.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\CollectionBuilderAttribute.cs" Link="System\Runtime\CompilerServices\CollectionBuilderAttribute.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public static ImmutableArray<T> Create<T>(params ReadOnlySpan<T> items)
/// <typeparam name="T">The type of element stored in the array.</typeparam>
/// <param name="items">The elements to store in the array.</param>
/// <returns>An immutable array containing the specified items.</returns>
[OverloadResolutionPriority(-1)]

Check failure on line 107 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_AllConfigurations)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L107

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(107,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriorityAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 107 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_AllConfigurations)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L107

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(107,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriority' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 107 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime (Build coreclr Common Pri0 Test Build AnyOS AnyCPU checked)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L107

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(107,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriorityAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 107 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime (Build coreclr Common Pri0 Test Build AnyOS AnyCPU checked)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L107

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(107,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriority' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 107 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L107

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(107,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriorityAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 107 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L107

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(107,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriority' could not be found (are you missing a using directive or an assembly reference?)
public static ImmutableArray<T> Create<T>(Span<T> items)
{
return Create((ReadOnlySpan<T>)items);
Expand All @@ -126,6 +127,7 @@ public static ImmutableArray<T> ToImmutableArray<T>(this ReadOnlySpan<T> items)
/// <typeparam name="T">The type of element in the list.</typeparam>
/// <param name="items">The elements to store in the array.</param>
/// <returns>An immutable array containing the specified items.</returns>
[OverloadResolutionPriority(-1)]

Check failure on line 130 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_AllConfigurations)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L130

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(130,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriorityAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 130 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_AllConfigurations)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L130

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(130,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriority' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 130 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime (Build coreclr Common Pri0 Test Build AnyOS AnyCPU checked)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L130

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(130,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriorityAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 130 in src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs

View check run for this annotation

Azure Pipelines / runtime (Build coreclr Common Pri0 Test Build AnyOS AnyCPU checked)

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs#L130

src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray.cs(130,10): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'OverloadResolutionPriority' could not be found (are you missing a using directive or an assembly reference?)
public static ImmutableArray<T> ToImmutableArray<T>(this Span<T> items)
{
return Create((ReadOnlySpan<T>)items);
Expand Down
56 changes: 56 additions & 0 deletions src/libraries/System.Memory/ref/System.Memory.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ public readonly void CopyTo(System.Span<float> destination) { }
private readonly int _dummyPrimitive;
public Vector(System.ReadOnlySpan<byte> values) { throw null; }
public Vector(System.ReadOnlySpan<T> values) { throw null; }
[System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(-1)]
public Vector(System.Span<T> values) { throw null; }
public Vector(T value) { throw null; }
public Vector(T[] values) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ public static SpanRuneEnumerator EnumerateRunes(this ReadOnlySpan<char> span)
/// <remarks>
/// Invalid sequences will be represented in the enumeration by <see cref="Rune.ReplacementChar"/>.
/// </remarks>
[OverloadResolutionPriority(-1)]
public static SpanRuneEnumerator EnumerateRunes(this Span<char> span)
{
return new SpanRuneEnumerator(span);
Expand All @@ -404,6 +405,7 @@ public static SpanLineEnumerator EnumerateLines(this ReadOnlySpan<char> span)
/// for <see cref="string.ReplaceLineEndings"/> for more information on how newline
/// sequences are detected.
/// </remarks>
[OverloadResolutionPriority(-1)]
public static SpanLineEnumerator EnumerateLines(this Span<char> span)
{
return new SpanLineEnumerator(span);
Expand Down
Loading

0 comments on commit 7e9a33c

Please sign in to comment.