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

Simplify namespaces #123

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ Example:

#if !NET5_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Used to indicate to the compiler that a method should be called
/// in its containing module's initializer.
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/CallerArgumentExpressionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP2X

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Indicates that a parameter captures the expression passed for another parameter as a string.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/CompilerFeatureRequiredAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if !NET7_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/DisableRuntimeMarshallingAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if !NET7_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Disables the built-in runtime managed/unmanaged marshalling subsystem for
/// P/Invokes, Delegate types, and unmanaged function pointer invocations.
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/ExperimentalAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#if !NET8_0_OR_GREATER

namespace System.Diagnostics.CodeAnalysis;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Indicates that a parameter captures the expression passed for another parameter as a string.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/IndexRange/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if (NET46X && VALUETUPLEREFERENCED) || NET47X || NET48X || NETSTANDARD2_0 || NETCOREAPP2X

namespace System;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace System;

/// <summary>Represent a type can be used to index a collection either from the start or the end.</summary>
/// <remarks>
/// Index is used by the C# compiler to support the new index syntax
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/IndexRange/Range.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if (NET46X && VALUETUPLEREFERENCED) || NET47X || NET48X || NETSTANDARD2_0 || NETCOREAPP2X

namespace System;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace System;

/// <summary>Represent a range has start and end indexes.</summary>
/// <remarks>
/// Range is used by the C# compiler to support the range syntax.
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/IsExternalInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#if !NET5_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/ModuleInitializerAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if !NET5_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Used to indicate to the compiler that a method should be called
/// in its containing module's initializer.
Expand Down
6 changes: 6 additions & 0 deletions src/Polyfill/Nullability/NullabilityInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

namespace System.Reflection
{
using System.Linq;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;

/// <summary>
/// A class that represents nullability info
/// </summary>
Expand Down
8 changes: 5 additions & 3 deletions src/Polyfill/Nullability/NullabilityInfoContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

namespace System.Reflection
{
// Some codebases define their own Debug class, which can cause clashes and compile errors if we aren't explicit here.
// See comments in Debug.cs in Consume project for more details.
using Debug = System.Diagnostics.Debug;
using System.Linq;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;

/// <summary>
/// Provides APIs for populating nullability information/context from reflection members:
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/PlatformCompatibility/OSPlatformAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma warning disable

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.Versioning;

/// <summary>
/// Base type for all platform-specific API attributes.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

#pragma warning disable

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

#nullable enable

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

using Targets = AttributeTargets;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma warning disable

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.Versioning;

using Targets = AttributeTargets;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma warning disable

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.Versioning;

using Targets = AttributeTargets;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/PlatformCompatibility/TargetPlatformAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#if !NET5_0_OR_GREATER

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.Versioning;

/// <summary>
/// Records the platform that the project targeted.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#nullable enable

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.Versioning;

using Targets = AttributeTargets;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#pragma warning disable

namespace System.Runtime.Versioning;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.Versioning;

using Targets = AttributeTargets;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/RequiredMemberAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#if !NET7_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.CompilerServices;

using Targets = AttributeTargets;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/SkipLocalsInitAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#if !NET5_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.CompilerServices;

using Targets = AttributeTargets;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/StackTraceHiddenAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#if !NET6_0_OR_GREATER

using System.Diagnostics.CodeAnalysis;

namespace System.Diagnostics;

using System.Diagnostics.CodeAnalysis;

using Targets = AttributeTargets;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

#if HAS_SPAN && !NET6_0_OR_GREATER

using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;

#nullable enable

namespace System.Text;

// Some codebases define their own Debug class, which can cause clashes and compile errors if we aren't explicit here.
// See comments in Debug.cs in Consume project for more details.
using Debug = System.Diagnostics.Debug;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;

/// <summary>Provides a handler used by the language compiler to append interpolated strings into <see cref="StringBuilder"/> instances.</summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#if HAS_SPAN && !NET6_0_OR_GREATER

#nullable enable

namespace System.Runtime.CompilerServices;

using System;
using System.Buffers;
using System.Diagnostics;
Expand All @@ -10,14 +14,6 @@
using System.Runtime.CompilerServices;
using Link = System.ComponentModel.DescriptionAttribute;

#nullable enable

namespace System.Runtime.CompilerServices;

// Some codebases define their own Debug class, which can cause clashes and compile errors if we aren't explicit here.
// See comments in Debug.cs in Consume project for more details.
using Debug = System.Diagnostics.Debug;

/// <summary>Provides a handler used by the language compiler to process interpolated strings into <see cref="string"/> instances.</summary>
[InterpolatedStringHandler]
[ExcludeFromCodeCoverage]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if !NET6_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

/// <summary>
/// Indicates which arguments to a method involving an interpolated string handler should be passed to that handler.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#if !NET6_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

namespace System.Runtime.CompilerServices;

using Targets = AttributeTargets;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Polyfill/StringSyntaxAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#nullable enable

namespace System.Diagnostics.CodeAnalysis;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Diagnostics.CodeAnalysis;

using Targets = AttributeTargets;

/// <summary>
Expand Down
Loading
Loading