Skip to content

Commit

Permalink
Add TypeForwardedTo pointing to BCL (#291)
Browse files Browse the repository at this point in the history
* Add TypeForwardedTo pointing to BCL

* Fix missing typeof
  • Loading branch information
Youssef1313 authored Jan 25, 2025
1 parent 3972819 commit 2ffa228
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Polyfill/CallerArgumentExpressionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ public CallerArgumentExpressionAttribute(string parameterName) =>
public string ParameterName { get; }
}

#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(CallerArgumentExpressionAttribute))]
#endif
4 changes: 4 additions & 0 deletions src/Polyfill/CompilerFeatureRequiredAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ public CompilerFeatureRequiredAttribute(string featureName) =>
public const string RequiredMembers = nameof(RequiredMembers);
}

#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(CompilerFeatureRequiredAttribute))]
#endif
5 changes: 5 additions & 0 deletions src/Polyfill/ExperimentalAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@ public ExperimentalAttribute(string diagnosticId) =>
public string? UrlFormat { get; set; }
}

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

[assembly: TypeForwardedTo(typeof(ExperimentalAttribute))]
#endif
4 changes: 4 additions & 0 deletions src/Polyfill/IsExternalInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ namespace System.Runtime.CompilerServices;
#endif
static class IsExternalInit;

#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(IsExternalInit))]
#endif
5 changes: 5 additions & 0 deletions src/Polyfill/Lock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,9 @@ public readonly ref struct Scope(Lock owner)
}
}

#else
using System.Threading;
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Lock))]
#endif
5 changes: 5 additions & 0 deletions src/Polyfill/RequiredMemberAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ namespace System.Runtime.CompilerServices;
#endif
sealed class RequiredMemberAttribute :
Attribute;

#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(RequiredMemberAttribute))]
#endif
6 changes: 6 additions & 0 deletions src/Polyfill/SetsRequiredMembersAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ namespace System.Diagnostics.CodeAnalysis;
#endif
sealed class SetsRequiredMembersAttribute :
Attribute;

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

[assembly: TypeForwardedTo(typeof(SetsRequiredMembersAttribute))]
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ sealed class InterpolatedStringHandlerArgumentAttribute :
/// <summary>Gets the names of the arguments that should be passed to the handler.</summary>
public string[] Arguments { get; }
}

#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(InterpolatedStringHandlerArgumentAttribute))]
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ namespace System.Runtime.CompilerServices;
#endif
sealed class InterpolatedStringHandlerAttribute :
Attribute;

#else
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(InterpolatedStringHandlerAttribute))]
#endif

0 comments on commit 2ffa228

Please sign in to comment.