Skip to content
Merged
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;
}
Comment thread
jkoritzinsky marked this conversation as resolved.
}
}
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()
}
}
100 changes: 46 additions & 54 deletions src/tests/Loader/classloader/generics/ByRefLike/InvalidCSharp.il
Comment thread
jkoritzinsky marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -395,42 +395,20 @@
}
}

.class public sequential ansi sealed beforefieldinit InvalidCSharp.GenericClass_WithStaticField`1<byreflike T>
extends [System.Runtime]System.Object
.class interface public auto ansi abstract InvalidCSharp.SimpleInterface
{
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
.method public hidebysig newslot abstract virtual
instance int32 Method() cil managed
{
.locals init (
[0] !T,
[1] !T
)

ldarg.0
call instance void [System.Runtime]System.Object::.ctor()

ldloca.s 0
initobj !T

ldloc.0
stsfld !0 class InvalidCSharp.GenericClass_WithStaticField`1<!T>::StaticField
ldsfld !0 class InvalidCSharp.GenericClass_WithStaticField`1<!T>::StaticField
stloc.1
ret
}

.field public static class InvalidCSharp.GenericClass_Over`1<!T> StaticField1
.field public static !T StaticField
}

.class public sequential ansi sealed beforefieldinit InvalidCSharp.GenericClass_IndependentConstraints`2<byreflike T, (!T) U>
extends [System.Runtime]System.Object
.class interface public auto ansi abstract InvalidCSharp.DefaultInterface
{
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
.method public hidebysig newslot virtual
instance int32 Method() cil managed
{
ldarg.0
call instance void [System.Runtime]System.Object::.ctor()
ldc.i4.0
ret
}
}
Expand All @@ -451,22 +429,6 @@
)
}

.class public sequential ansi sealed beforefieldinit ByRefLikeType`1<T>
extends [System.Runtime]System.ValueType
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = (
01 00 00 00
)
}

.class interface public auto ansi abstract InvalidCSharp.SimpleInterface
{
.method public hidebysig newslot abstract virtual
instance int32 Method() cil managed
{
}
}

.class public sequential ansi sealed beforefieldinit ByRefLikeTypeWithInterface
extends [System.Runtime]System.ValueType
implements InvalidCSharp.SimpleInterface
Expand All @@ -483,14 +445,9 @@
}
}

.class interface public auto ansi abstract InvalidCSharp.DefaultInterface
.class public sequential ansi sealed beforefieldinit RegularValueType
extends [System.Runtime]System.ValueType
{
.method public hidebysig newslot virtual
instance int32 Method() cil managed
{
ldc.i4.0
ret
}
}

.class public sequential ansi sealed beforefieldinit RS_DI1
Expand Down Expand Up @@ -518,9 +475,44 @@
}
}

.class public sequential ansi sealed beforefieldinit RegularValueType
extends [System.Runtime]System.ValueType
.class public sequential ansi sealed beforefieldinit InvalidCSharp.GenericClass_WithStaticField`1<byreflike T>
extends [System.Runtime]System.Object
{
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
.locals init (
[0] !T,
[1] !T
)

ldarg.0
call instance void [System.Runtime]System.Object::.ctor()

ldloca.s 0
initobj !T

ldloc.0
stsfld !0 class InvalidCSharp.GenericClass_WithStaticField`1<!T>::StaticField
ldsfld !0 class InvalidCSharp.GenericClass_WithStaticField`1<!T>::StaticField
stloc.1
ret
}

.field public static class InvalidCSharp.GenericClass_Over`1<!T> StaticField1
.field public static !T StaticField
}

.class public sequential ansi sealed beforefieldinit InvalidCSharp.GenericClass_IndependentConstraints`2<byreflike T, (!T) U>
extends [System.Runtime]System.Object
{
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
ldarg.0
call instance void [System.Runtime]System.Object::.ctor()
ret
}
}

.class public auto ansi beforefieldinit ClassWithInterface
Expand Down
Loading