Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test handling of arrays in data flow (dotnet/linker#1564)
The test is currently failing due to dotnet/linker#1559 Commit migrated from dotnet/linker@2bcc466
- Loading branch information
1 parent
3dd2215
commit e574052
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ComplexTypeHandling.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
|
||
namespace Mono.Linker.Tests.Cases.DataFlow | ||
{ | ||
[IgnoreTestCase ("Active issue https://github.com/mono/linker/issues/1559")] | ||
public class ComplexTypeHandling | ||
{ | ||
public static void Main () | ||
{ | ||
TestArray (); | ||
TestArrayOnGeneric (); | ||
TestGenericArray (); | ||
TestGenericArrayOnGeneric (); | ||
} | ||
|
||
[Kept] | ||
class ArrayElementType | ||
{ | ||
public ArrayElementType () { } | ||
|
||
[Kept] | ||
public void PublicMethod () { } | ||
|
||
private int _privateField; | ||
} | ||
|
||
[Kept] | ||
static void TestArray () | ||
{ | ||
RequirePublicMethods (typeof (ArrayElementType[])); | ||
} | ||
|
||
[Kept] | ||
static void TestGenericArray () | ||
{ | ||
RequirePublicMethodsOnArrayOfGeneric<ArrayElementType> (); | ||
} | ||
|
||
[Kept] | ||
static void RequirePublicMethodsOnArrayOfGeneric<T> () | ||
{ | ||
RequirePublicMethods (typeof (T[])); | ||
} | ||
|
||
[Kept] | ||
private static void RequirePublicMethods ( | ||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] | ||
[KeptAttributeAttribute(typeof(DynamicallyAccessedMembersAttribute))] | ||
Type type) | ||
{ | ||
} | ||
|
||
[Kept] | ||
class ArrayElementInGenericType | ||
{ | ||
public ArrayElementInGenericType () { } | ||
|
||
[Kept] | ||
public void PublicMethod () { } | ||
|
||
private int _privateField; | ||
} | ||
|
||
[Kept] | ||
[KeptMember (".ctor()")] | ||
class RequirePublicMethodsGeneric< | ||
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] | ||
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] | ||
T> | ||
{ | ||
} | ||
|
||
[Kept] | ||
static void TestArrayOnGeneric () | ||
{ | ||
_ = new RequirePublicMethodsGeneric<ArrayElementInGenericType[]> (); | ||
} | ||
|
||
[Kept] | ||
static void TestGenericArrayOnGeneric () | ||
{ | ||
RequirePublicMethodsOnArrayOfGenericParameter<ArrayElementInGenericType> (); | ||
} | ||
|
||
static void RequirePublicMethodsOnArrayOfGenericParameter<T> () | ||
{ | ||
_ = new RequirePublicMethodsGeneric<T[]> (); | ||
} | ||
} | ||
} |