Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitek Karas <vitek.karas@microsoft.com>2020-12-09 01:40:36 +0300
committerGitHub <noreply@github.com>2020-12-09 01:40:36 +0300
commitd0602c4767acf5dcd46700381ce39bd2775de6d7 (patch)
tree00834edf0d3422eb085560e674550ce473326a5c /test/Mono.Linker.Tests.Cases/TypeForwarding
parent7b82b569a7d82149c590777781891dd900c85f19 (diff)
Fix pointer type forwarding (#1679)
Sweep step resolves type forwarders and replaces them with direct type refs. There were already special cases for generic instantiations and array, but other type specifications were missing, most notably pointer types. Added handling of all type specifications and added some tests.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/TypeForwarding')
-rw-r--r--test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs43
-rw-r--r--test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs1
-rw-r--r--test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs5
-rw-r--r--test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs5
4 files changed, 41 insertions, 13 deletions
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs
index 72c261520..171aad0b8 100644
--- a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs
+++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwarded.cs
@@ -22,50 +22,52 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding
[RemovedAssembly ("Forwarder.dll")]
[KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary))]
+ [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationStruct))]
class AttributeArgumentForwarded
{
static void Main ()
{
- Test_1 ();
- Test_1b ();
- Test_1c ();
- Test_2 ();
- Test_3 ();
- Test_3a ();
+ Test_Parameter_TypeRef ();
+ Test_Parameter_TypeRefMDArray ();
+ Test_Parameter_PointerTypeRef ();
+ Test_Property_ArrayOfTypeRefs ();
+ Test_Field_GenericOfTypeRefArray ();
+ Test_Field_OpenGeneric ();
+ Test_Field_ArrayOfPointerTypeRef ();
}
[Kept]
[KeptAttributeAttribute (typeof (TestTypeAttribute))]
[TestType (typeof (ImplementationLibrary))]
- public static void Test_1 ()
+ public static void Test_Parameter_TypeRef ()
{
}
[Kept]
[KeptAttributeAttribute (typeof (TestTypeAttribute))]
[TestType (typeof (ImplementationLibrary[,][]))]
- public static void Test_1b ()
+ public static void Test_Parameter_TypeRefMDArray ()
{
}
[Kept]
[KeptAttributeAttribute (typeof (TestTypeAttribute))]
- [TestType (typeof (ImplementationLibrary[,][]))]
- public static void Test_1c ()
+ [TestType (typeof (ImplementationStruct*))]
+ public static void Test_Parameter_PointerTypeRef ()
{
}
[Kept]
[KeptAttributeAttribute (typeof (TestTypeAttribute))]
[TestType (TestProperty = new object[] { typeof (ImplementationLibrary) })]
- public static void Test_2 ()
+ public static void Test_Property_ArrayOfTypeRefs ()
{
}
[Kept]
[KeptAttributeAttribute (typeof (TestTypeAttribute))]
[TestType (TestField = typeof (SomeGenericType<ImplementationLibrary[]>))]
- public static void Test_3 ()
+ public static void Test_Field_GenericOfTypeRefArray ()
{
}
@@ -73,9 +75,24 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding
[Kept]
[KeptAttributeAttribute (typeof (TestTypeAttribute))]
[TestType (TestField = typeof (SomeGenericType<>))]
- public static void Test_3a ()
+ public static void Test_Field_OpenGeneric ()
{
}
+
+ [Kept]
+ [KeptAttributeAttribute (typeof (TestTypeAttribute))]
+ [TestType (TestField = new object[] { typeof (ImplementationStruct*) })]
+ public static void Test_Field_ArrayOfPointerTypeRef ()
+ {
+ }
+
+ // This hits Roslyn bug https://github.com/dotnet/roslyn/issues/48765
+ //[Kept]
+ //[KeptAttributeAttribute (typeof (TestTypeAttribute))]
+ //[TestType (TestField = new object[] { typeof (delegate*<int, void>) })]
+ //public static void Test_Field_ArrayOfFunctionPointer ()
+ //{
+ //}
}
[KeptBaseType (typeof (Attribute))]
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs
index bb1521525..441a971eb 100644
--- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs
+++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs
@@ -1,3 +1,4 @@
using System;
[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (Mono.Linker.Tests.Cases.TypeForwarding.Dependencies.ImplementationLibrary))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (Mono.Linker.Tests.Cases.TypeForwarding.Dependencies.ImplementationStruct))]
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs
index 98fab0dba..86a37fdfc 100644
--- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs
+++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs
@@ -13,4 +13,9 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies
return "Hello";
}
}
+
+ public struct ImplementationStruct
+ {
+ public int Field;
+ }
}
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs
index ff4def7c9..8796effb1 100644
--- a/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs
+++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs
@@ -15,5 +15,10 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies
return null;
}
}
+
+ public struct ImplementationStruct
+ {
+ public int Field;
+ }
#endif
}