Skip to content

Commit

Permalink
Enable more ILLinker skipped tests on native AOT (dotnet#110353)
Browse files Browse the repository at this point in the history
Progress towards dotnet#82447.
  • Loading branch information
MichalStrehovsky authored and hez2010 committed Dec 14, 2024
1 parent e0f70cc commit bbe9a9d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ public void Reflection (string t)
{
switch (t)
{
case "ObjectGetType":
// Skip for now
break;
case "ObjectGetTypeLibraryMode":
case "TypeHierarchyLibraryModeSuppressions":
// No Library mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ class InterfaceSeenFirst
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
interface IAnnotatedInterface
{
[Kept]
[Kept (By = Tool.Trimmer /* The method is not a target of reflection */)]
void InterfaceMethod ();
}

Expand Down Expand Up @@ -744,7 +744,7 @@ class AnnotationsRequestedOnImplementation
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
interface IAnnotatedInterface
{
[Kept] // Kept because it's implemented on the class
[Kept (By = Tool.Trimmer /* The method is not a target of reflection */)] // Kept because it's implemented on the class
void InterfaceMethod ();

// Annotation will not be applied to the interface, since nothing
Expand Down Expand Up @@ -797,14 +797,14 @@ class AnnotationsRequestedOnInterface
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
interface IAnnotatedInterface
{
[Kept] // Kept because it's implemented on the class
[Kept (By = Tool.Trimmer /* The method is not a target of reflection */)] // Kept because it's implemented on the class
void InterfaceMethod ();

// Annotation applied to the interface since that's what reflection asked about
[Kept]
[Kept (By = Tool.Trimmer /* The method is not a target of reflection */)]
static void DoSomething () { }

[Kept]
[Kept (By = Tool.Trimmer /* The method is not a target of reflection */)]
void DefaultInterfaceMethod () { }
}

Expand Down Expand Up @@ -843,12 +843,12 @@ public static void Test ()
[Kept]
class AllAnnotationsAreApplied
{
[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* The interface is not actually used */)]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute), By = Tool.Trimmer)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
interface IMethodsAnnotatedInterface
{
[Kept]
[Kept (By = Tool.Trimmer)]
void InterfaceMethod ();
}

Expand All @@ -858,14 +858,14 @@ interface IPropertiesAnnotatedInterface
bool Property { get; }
}

[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* The interface is not actually used */)]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute), By = Tool.Trimmer)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicEvents)]
interface IEventsAnnotatedInterface
{
[Kept]
[KeptEventAddMethod]
[KeptEventRemoveMethod]
[Kept(By = Tool.Trimmer)]
[KeptEventAddMethod(By = Tool.Trimmer)]
[KeptEventRemoveMethod(By = Tool.Trimmer)]
event EventHandler MyEvent;
}

Expand Down Expand Up @@ -1037,12 +1037,12 @@ public static void Test ()
[Kept]
class DiamondShapeWithAnnotatedInterface
{
[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* The interface is not actually used */)]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute), By = Tool.Trimmer)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
interface IAnnotatedCommon
{
[Kept] // Due to the annotation
[Kept (By = Tool.Trimmer)] // Due to the annotation
void InterfaceMethod ();
}

Expand Down Expand Up @@ -1158,8 +1158,8 @@ public static void Test ()
[Kept]
class ApplyingAnnotationIntroducesTypesToApplyAnnotationToViaInterfaces
{
[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* The interface is not actually used */)]
[KeptAttributeAttribute (typeof(DynamicallyAccessedMembersAttribute), By = Tool.Trimmer)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)]
interface IAnnotatedInterface
{
Expand Down Expand Up @@ -1188,7 +1188,7 @@ class FieldTypeAlsoImplementsInterface : IAnnotatedInterface
public NestedFieldType _nestedField;

[Kept]
public class NestedFieldType
public struct NestedFieldType
{
}
}
Expand Down Expand Up @@ -1230,11 +1230,11 @@ class DerivedFromMethodsBase : MethodAnnotatedBase
void PrivateMethod () { }
}

[Kept]
[KeptBaseType (typeof (MethodAnnotatedBase))]
[Kept(By = Tool.Trimmer /* only used in a method signature, not legitimate to keep beyond IL-level trimming */)]
[KeptBaseType (typeof (MethodAnnotatedBase), By = Tool.Trimmer)]
class AnotherMethodsDerived : MethodAnnotatedBase
{
[Kept]
[Kept(By = Tool.Trimmer)]
public static void PublicStaticMethod (DerivedFromPropertiesBase p) { }

static void PrivateStaticMethod () { }
Expand All @@ -1248,27 +1248,27 @@ class PropertiesAnnotatedBase
{
}

[Kept]
[KeptBaseType (typeof (PropertiesAnnotatedBase))]
[Kept (By = Tool.Trimmer /* only used in a method signature, not legitimate to keep beyond IL-level trimming */)]
[KeptBaseType (typeof (PropertiesAnnotatedBase), By = Tool.Trimmer)]
class DerivedFromPropertiesBase : PropertiesAnnotatedBase
{
[Kept]
public static AnotherPropertiesDerived PublicProperty { [Kept] get => null; }
[Kept (By = Tool.Trimmer)]
public static AnotherPropertiesDerived PublicProperty { [Kept (By = Tool.Trimmer)] get => null; }

private static UnusedType PrivateProperty { get => null; }
}

[Kept]
[KeptBaseType (typeof (PropertiesAnnotatedBase))]
[Kept (By = Tool.Trimmer /* only used in a method signature, not legitimate to keep beyond IL-level trimming */)]
[KeptBaseType (typeof (PropertiesAnnotatedBase), By = Tool.Trimmer)]
class AnotherPropertiesDerived : PropertiesAnnotatedBase
{
[Kept]
public static UsedType PublicProperty { [Kept] get => null; }
[Kept(By = Tool.Trimmer)]
public static UsedType PublicProperty { [Kept(By = Tool.Trimmer)] get => null; }

private static UnusedType PrivateProperty { get => null; }
}

[Kept]
[Kept (By = Tool.Trimmer /* only used in a method signature, not legitimate to keep beyond IL-level trimming */)]
class UsedType { }

class UnusedType { }
Expand Down Expand Up @@ -1343,12 +1343,12 @@ interface INestedInterface
void InterfaceMethod ();
}

[Kept]
[KeptMember (".ctor()")]
[KeptBaseType (typeof (AnnotatedBase))]
[Kept (By = Tool.Trimmer /* only used in a method signature, not legitimate to keep beyond IL-level trimming */)]
[KeptMember (".ctor()", By = Tool.Trimmer)]
[KeptBaseType (typeof (AnnotatedBase), By = Tool.Trimmer)]
class AnotherAnnotatedType : AnnotatedBase
{
[Kept]
[Kept (By = Tool.Trimmer)]
int _field;
}

Expand Down Expand Up @@ -1557,17 +1557,17 @@ class UsedByDerived
{
class AnnotatedBase
{
[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* https://github.com/dotnet/runtime/issues/110563 */)]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute), By = Tool.Trimmer)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
class Base
{
[Kept]
[Kept (By = Tool.Trimmer)]
public void Method () { }
}

[Kept]
[KeptBaseType (typeof (Base))]
[Kept (By = Tool.Trimmer /* https://github.com/dotnet/runtime/issues/110563 */)]
[KeptBaseType (typeof (Base), By = Tool.Trimmer)]
class Derived : Base
{
}
Expand All @@ -1591,9 +1591,9 @@ class Base
public void Method () { }
}

[Kept]
[KeptBaseType (typeof (Base))]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* The object.GetType() call is statically unreachable, this could be trimmed */)]
[KeptBaseType (typeof (Base), By = Tool.Trimmer)]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute), By = Tool.Trimmer)]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
class Derived : Base
{
Expand All @@ -1616,7 +1616,7 @@ class AnnotatedInterface
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)]
interface IBase
{
[Kept]
[Kept (By = Tool.Trimmer /* https://github.com/dotnet/runtime/issues/104740 */)]
public void Method () { }
}

Expand Down

0 comments on commit bbe9a9d

Please sign in to comment.