Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a polyfill to enable newer compiler features #10315

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Exclude generated types from unit test
  • Loading branch information
jimmylewis committed Jan 7, 2025
commit d6b5c7e3690af8f26445a13a39a63855ca9c5858
40 changes: 39 additions & 1 deletion tests/NuGet.Services.Contracts.Tests/ContractsFacts.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Linq;
Expand All @@ -19,6 +19,44 @@ public void ShouldOnlyHaveInterfacesAndEnums()
// included in the assembly by newer language versions
"Microsoft.CodeAnalysis.EmbeddedAttribute",
"System.Runtime.CompilerServices.RefSafetyRulesAttribute",
// generated polyfills from PolySharp
"System.Runtime.CompilerServices.NullableAttribute",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I wonder if we can filter out internal types for this test. This test appears to be a "public contract changes should be acknowledged by this test".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could easily check only types where type.IsVisible is true

true if the current Type is a public type or a public nested type such that all the enclosing types are public; otherwise, false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

"System.Runtime.CompilerServices.NullableContextAttribute",
"System.Index",
"System.Range",
"System.Runtime.Versioning.RequiresPreviewFeaturesAttribute",
"System.Runtime.CompilerServices.AsyncMethodBuilderAttribute",
"System.Runtime.CompilerServices.CallerArgumentExpressionAttribute",
"System.Runtime.CompilerServices.CollectionBuilderAttribute",
"System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute",
"System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute",
"System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute",
"System.Runtime.CompilerServices.IsExternalInit",
"System.Runtime.CompilerServices.ModuleInitializerAttribute",
"System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute",
"System.Runtime.CompilerServices.ParamCollectionAttribute",
"System.Runtime.CompilerServices.RequiredMemberAttribute",
"System.Runtime.CompilerServices.RequiresLocationAttribute",
"System.Runtime.CompilerServices.SkipLocalsInitAttribute",
"System.Diagnostics.CodeAnalysis.AllowNullAttribute",
"System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute",
"System.Diagnostics.CodeAnalysis.DisallowNullAttribute",
"System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute",
"System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute",
"System.Diagnostics.CodeAnalysis.ExperimentalAttribute",
"System.Diagnostics.CodeAnalysis.MaybeNullAttribute",
"System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute",
"System.Diagnostics.CodeAnalysis.MemberNotNullAttribute",
"System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute",
"System.Diagnostics.CodeAnalysis.NotNullAttribute",
"System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute",
"System.Diagnostics.CodeAnalysis.NotNullWhenAttribute",
"System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute",
"System.Diagnostics.CodeAnalysis.StringSyntaxAttribute",
"System.Diagnostics.CodeAnalysis.UnscopedRefAttribute",
"System.Index+ThrowHelper",
"System.Range+HashHelpers",
"System.Range+ThrowHelper",
};

// Act
Expand Down