Skip to content

Commit 1cd32d6

Browse files
committed
Replace Nullable and polyfills with Meziantou.Polyfill
1 parent 6540ca7 commit 1cd32d6

6 files changed

Lines changed: 34 additions & 76 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ dotnet_diagnostic.CA1837.severity = suggestion # CA1837: Use 'Environment.Proce
8585
dotnet_diagnostic.CA1838.severity = suggestion # CA1838: Avoid 'StringBuilder' parameters for P/Invokes
8686
dotnet_diagnostic.CA1845.severity = none # CA1845: Use span-based 'string.Concat'
8787
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer 'AsSpan' over 'Substring'
88-
dotnet_diagnostic.CA1847.severity = none # CA1847: Use char literal for a single character lookup
88+
dotnet_diagnostic.CA1847.severity = suggestion # CA1847: Use char literal for a single character lookup
8989
dotnet_diagnostic.CA1852.severity = suggestion # CA1852: Seal internal types
9090
dotnet_diagnostic.CA1854.severity = suggestion # CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
9191
dotnet_diagnostic.CA1859.severity = suggestion # CA1859: Use concrete types when possible for improved performance

src/core/IronPython.Modules/IronPython.Modules.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
<BaseAddress>885063680</BaseAddress>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
<EmitCompilerGeneratedFiles>True</EmitCompilerGeneratedFiles>
9+
<MeziantouPolyfill_IncludedPolyfills>
10+
T:System.Diagnostics.CodeAnalysis.AllowNullAttribute;
11+
T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute;
12+
T:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute;
13+
T:System.Diagnostics.CodeAnalysis.NotNullAttribute;
14+
T:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute;
15+
T:System.Runtime.Versioning.SupportedOSPlatformAttribute;
16+
M:System.String.EndsWith(System.Char);
17+
</MeziantouPolyfill_IncludedPolyfills>
818
</PropertyGroup>
919

1020
<ItemGroup Condition=" '$(IsFullFramework)' == 'true' ">
@@ -32,6 +42,13 @@
3242
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
3343
</ItemGroup>
3444

45+
<ItemGroup>
46+
<PackageReference Include="Meziantou.Polyfill" Version="1.0.116">
47+
<PrivateAssets>all</PrivateAssets>
48+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
49+
</PackageReference>
50+
</ItemGroup>
51+
3552
<Import Project="$(AfterTargetFiles)" />
3653
<Target Name="AfterBuildEnds" AfterTargets="AfterBuild" DependsOnTargets="$(AfterTargets)" />
3754

src/core/IronPython/IronPython.csproj

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
<BaseAddress>879755264</BaseAddress>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
<EmitCompilerGeneratedFiles>True</EmitCompilerGeneratedFiles>
9+
<MeziantouPolyfill_IncludedPolyfills>
10+
T:System.Diagnostics.CodeAnalysis.AllowNullAttribute;
11+
T:System.Diagnostics.CodeAnalysis.DisallowNullAttribute;
12+
T:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute;
13+
T:System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute;
14+
T:System.Diagnostics.CodeAnalysis.NotNullAttribute;
15+
T:System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute;
16+
T:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute;
17+
T:System.Runtime.Versioning.SupportedOSPlatformAttribute;
18+
T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute;
19+
M:System.String.StartsWith(System.Char);
20+
M:System.String.EndsWith(System.Char);
21+
M:System.String.Contains(System.Char);
22+
</MeziantouPolyfill_IncludedPolyfills>
823
</PropertyGroup>
924

1025
<ItemGroup>
@@ -50,7 +65,7 @@
5065
</ItemGroup>
5166

5267
<ItemGroup>
53-
<PackageReference Include="Nullable" Version="1.3.1">
68+
<PackageReference Include="Meziantou.Polyfill" Version="1.0.116">
5469
<PrivateAssets>all</PrivateAssets>
5570
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5671
</PackageReference>

src/core/IronPython/Modules/_fileio.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,5 @@ private void EnsureWritable() {
611611

612612
#endregion
613613
}
614-
615-
#if !NETCOREAPP
616-
private static bool Contains(this string str, char value)
617-
=> str.IndexOf(value) != -1;
618-
#endif
619614
}
620615
}

src/core/IronPython/StringExtensions.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/core/IronPython/SystemRuntimeVersioning.cs

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)