Skip to content

Commit dde6d62

Browse files
authored
Add a test which uncovered stack overflow in 7.0 (#3156)
Recurisve generics with interface marking annotation used to cause stackoverflow in the linker. The test now passes since the problem was fixed in #3073
1 parent 27ce032 commit dde6d62

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ static void TestInterfaceTypeGenericRequirements ()
321321
new InterfaceImplementationTypeWithInstantiationOverSelfOnBase ();
322322
new InterfaceImplementationTypeWithOpenGenericOnBase<TestType> ();
323323
new InterfaceImplementationTypeWithOpenGenericOnBaseWithRequirements<TestType> ();
324+
325+
RecursiveGenericWithInterfacesRequirement.Test ();
324326
}
325327

326328
interface IGenericInterfaceTypeWithRequirements<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T>
@@ -348,6 +350,23 @@ class InterfaceImplementationTypeWithOpenGenericOnBaseWithRequirements<[Dynamica
348350
{
349351
}
350352

353+
class RecursiveGenericWithInterfacesRequirement
354+
{
355+
interface IFace<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.Interfaces)] T>
356+
{
357+
}
358+
359+
class TestType : IFace<TestType>
360+
{
361+
}
362+
363+
public static void Test ()
364+
{
365+
var a = typeof (IFace<string>);
366+
var t = new TestType ();
367+
}
368+
}
369+
351370
static void TestTypeGenericRequirementsOnMembers ()
352371
{
353372
// Basically just root everything we need to test

0 commit comments

Comments
 (0)