Skip to content

Commit

Permalink
Fix issues with missing generic constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
ericstj committed Apr 17, 2024
1 parent 8262020 commit b2220ea
Show file tree
Hide file tree
Showing 7 changed files with 588 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public abstract class Instrument<T> : Instrument where T : struct
public ReadOnlySpan<System.Collections.Generic.KeyValuePair<string, object?>> Tags { get { throw null; } }
public T Value { get { throw null; } }
}
public delegate void MeasurementCallback<T>(Instrument instrument, T measurement, ReadOnlySpan<System.Collections.Generic.KeyValuePair<string, object?>> tags, object? state);
public delegate void MeasurementCallback<T>(Instrument instrument, T measurement, ReadOnlySpan<System.Collections.Generic.KeyValuePair<string, object?>> tags, object? state) where T : struct;
public class Meter : IDisposable
{
public Counter<T> CreateCounter<T>(string name, string? unit = null, string? description = null) where T : struct { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ByteEqualityComparer() { }
public override int GetHashCode() { throw null; }
public override int GetHashCode(byte b) { throw null; }
}
public sealed partial class EnumEqualityComparer<T> : System.Collections.Generic.EqualityComparer<T>, System.Runtime.Serialization.ISerializable where T : struct
public sealed partial class EnumEqualityComparer<T> : System.Collections.Generic.EqualityComparer<T>, System.Runtime.Serialization.ISerializable where T : struct, System.Enum
{
public EnumEqualityComparer() { }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,17 +362,17 @@ public void FinalRelease() { }
System.Runtime.InteropServices.Marshalling.VirtualMethodTableInfo System.Runtime.InteropServices.Marshalling.IUnmanagedVirtualMethodTableProvider.GetVirtualMethodTableInfoForKey(System.Type type) { throw null; }
}
[System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute(typeof(System.Exception), System.Runtime.InteropServices.Marshalling.MarshalMode.UnmanagedToManagedOut, typeof(System.Runtime.InteropServices.Marshalling.ExceptionAsDefaultMarshaller<>))]
public static partial class ExceptionAsDefaultMarshaller<T> where T : struct
public static partial class ExceptionAsDefaultMarshaller<T> where T : unmanaged
{
public static T ConvertToUnmanaged(System.Exception e) { throw null; }
}
[System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute(typeof(System.Exception), System.Runtime.InteropServices.Marshalling.MarshalMode.UnmanagedToManagedOut, typeof(System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller<>))]
public static partial class ExceptionAsHResultMarshaller<T> where T : struct
public static partial class ExceptionAsHResultMarshaller<T> where T : unmanaged, System.Numerics.INumber<T>
{
public static T ConvertToUnmanaged(System.Exception e) { throw null; }
}
[System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute(typeof(System.Exception), System.Runtime.InteropServices.Marshalling.MarshalMode.UnmanagedToManagedOut, typeof(System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller<>))]
public static partial class ExceptionAsNaNMarshaller<T> where T : struct
public static partial class ExceptionAsNaNMarshaller<T> where T : unmanaged, System.Numerics.IFloatingPointIeee754<T>
{
public static T ConvertToUnmanaged(System.Exception e) { throw null; }
}
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,7 @@ protected Enum() { }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("EnumFormat")] string? format) { throw null; }
[System.ObsoleteAttribute("The provider argument is not used. Use ToString(String) instead.")]
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("EnumFormat")] string? format, System.IFormatProvider? provider) { throw null; }
public static bool TryFormat<TEnum>(TEnum value, System.Span<char> destination, out int charsWritten, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("EnumFormat")] System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>)) where TEnum : struct { throw null; }
public static bool TryFormat<TEnum>(TEnum value, System.Span<char> destination, out int charsWritten, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("EnumFormat")] System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>)) where TEnum : struct, System.Enum { throw null; }
public static bool TryParse(System.Type enumType, System.ReadOnlySpan<char> value, bool ignoreCase, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, System.ReadOnlySpan<char> value, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, string? value, bool ignoreCase, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,82 @@
<Left>net8.0/System.dll</Left>
<Right>net9.0/System.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>M:System.Enum.TryFormat``1(``0,System.Span{System.Char},System.Int32@,System.ReadOnlySpan{System.Char})``0:System.Enum</Target>
<Left>net8.0/mscorlib.dll</Left>
<Right>net9.0/mscorlib.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>M:System.Enum.TryFormat``1(``0,System.Span{System.Char},System.Int32@,System.ReadOnlySpan{System.Char})``0:System.Enum</Target>
<Left>net8.0/netstandard.dll</Left>
<Right>net9.0/netstandard.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Diagnostics.Metrics.MeasurementCallback`1``0:struct</Target>
<Left>net8.0/System.Diagnostics.DiagnosticSource.dll</Left>
<Right>net9.0/System.Diagnostics.DiagnosticSource.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>M:System.Enum.TryFormat``1(``0,System.Span{System.Char},System.Int32@,System.ReadOnlySpan{System.Char})``0:System.Enum</Target>
<Left>net8.0/System.Runtime.dll</Left>
<Right>net9.0/System.Runtime.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsDefaultMarshaller`1``0:struct</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsDefaultMarshaller`1``0:unmanaged</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller`1``0:struct</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller`1``0:System.Numerics.INumber&lt;T&gt;</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller`1``0:unmanaged</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller`1``0:struct</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller`1``0:System.Numerics.IFloatingPointIeee754&lt;T&gt;</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller`1``0:unmanaged</Target>
<Left>net8.0/System.Runtime.InteropServices.dll</Left>
<Right>net9.0/System.Runtime.InteropServices.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>T:System.Text.Json.Serialization.JsonNumberEnumConverter`1``0:System.Enum</Target>
<Left>net8.0/System.Text.Json.dll</Left>
<Right>net9.0/System.Text.Json.dll</Right>
</Suppression>
</Suppressions>
Loading

0 comments on commit b2220ea

Please sign in to comment.