Skip to content
Draft
18 changes: 18 additions & 0 deletions src/tests/Loader/classloader/InlineArray/InlineArrayValid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,21 @@ public static void InlineArrayEqualsGetHashCode_Fails()
});
}
}

[InlineArray(LengthConst)]
public ref struct SpanArr
{
private const int LengthConst = 100;
public Span<object> element;

public int Length => LengthConst;

[UnscopedRef]
public unsafe Span<object>* At(int index)
{
fixed (Span<object>* ptr = &element)
{
return ptr + index;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,50 +85,3 @@
.field private int32 a
.field private int32 b
}

.class public sequential ansi sealed beforefieldinit SpanArr
extends [System.Runtime]System.ValueType
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = (
01 00 00 00
)
.custom instance void [System.Runtime]System.Runtime.CompilerServices.InlineArrayAttribute::.ctor(int32) = (
01 00 64 00 00 00 00 00
)

.field private static literal int32 LengthConst = int32(100)
.field public valuetype [System.Runtime]System.Span`1<object> element

.method public hidebysig
instance valuetype [System.Runtime]System.Span`1<object>* At (
int32
) cil managed
{
.locals init (
[0] valuetype [System.Runtime]System.Span`1<object>& pinned
)
ldarg.0
ldflda valuetype [System.Runtime]System.Span`1<object> SpanArr::element
stloc.0
ldloc.0
conv.u
ldarg.1
conv.i
sizeof valuetype [System.Runtime]System.Span`1<object>
mul
add
ret
}

.method public hidebysig specialname
instance int32 get_Length () cil managed
{
ldc.i4.s 100
ret
}

.property instance int32 Length()
{
.get instance int32 SpanArr::get_Length()
}
}
Loading