Skip to content

Commit

Permalink
Add a test which uncovered stack overflow in 7.0 (dotnet/linker#3156)
Browse files Browse the repository at this point in the history
Recurisve generics with interface marking annotation used to cause stackoverflow in the linker.
The test now passes since the problem was fixed in dotnet/linker#3073

Commit migrated from dotnet/linker@dde6d62
  • Loading branch information
vitek-karas authored Dec 12, 2022
1 parent 44b1785 commit 640d818
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ static void TestInterfaceTypeGenericRequirements ()
new InterfaceImplementationTypeWithInstantiationOverSelfOnBase ();
new InterfaceImplementationTypeWithOpenGenericOnBase<TestType> ();
new InterfaceImplementationTypeWithOpenGenericOnBaseWithRequirements<TestType> ();

RecursiveGenericWithInterfacesRequirement.Test ();
}

interface IGenericInterfaceTypeWithRequirements<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T>
Expand Down Expand Up @@ -348,6 +350,23 @@ class InterfaceImplementationTypeWithOpenGenericOnBaseWithRequirements<[Dynamica
{
}

class RecursiveGenericWithInterfacesRequirement
{
interface IFace<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.Interfaces)] T>
{
}

class TestType : IFace<TestType>
{
}

public static void Test ()
{
var a = typeof (IFace<string>);
var t = new TestType ();
}
}

static void TestTypeGenericRequirementsOnMembers ()
{
// Basically just root everything we need to test
Expand Down

0 comments on commit 640d818

Please sign in to comment.