Skip to content

Commit

Permalink
Convert back to abstract class
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jan 2, 2025
1 parent ce85a0b commit 5c02e0a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/DotNext/Runtime/BoxedValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ namespace DotNext.Runtime;
/// not for <see cref="BoxedValue{T}"/>.
/// </remarks>
/// <typeparam name="T">The value type.</typeparam>
public class BoxedValue<T> // do not add any interfaces or base types
public abstract class BoxedValue<T> // do not add any interfaces or base types
where T : struct
{
internal T value;

[ExcludeFromCodeCoverage]
private BoxedValue() => throw new NotImplementedException();

/// <summary>
/// Gets a reference to the boxed value.
/// </summary>
Expand Down Expand Up @@ -110,6 +107,15 @@ namespace DotNext.Runtime;
/// <returns>Mutable reference to the boxed value.</returns>
public static implicit operator ValueReference<T>(BoxedValue<T> boxedValue)
=> new(boxedValue, ref boxedValue.value);

/// <inheritdoc />
public abstract override bool Equals([NotNullWhen(true)] object? obj); // abstract to avoid inlining by AOT/JIT

/// <inheritdoc />
public abstract override int GetHashCode(); // abstract to avoid inlining by AOT/JIT

/// <inheritdoc />
public abstract override string ToString(); // abstract to avoid inlining by AOT/JIT
}

public static class BoxedValue
Expand Down

0 comments on commit 5c02e0a

Please sign in to comment.