diff options
Diffstat (limited to 'linker')
4 files changed, 82 insertions, 0 deletions
diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index ba81df75d..0055c2991 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -57,6 +57,9 @@ <Compile Include="Basic\UnusedPropertySetterRemoved.cs" /> <Compile Include="Basic\UsedPropertyIsKept.cs" /> <Compile Include="Basic\UsedStructIsKept.cs" /> + <Compile Include="VirtualMethods\ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs" /> + <Compile Include="VirtualMethods\ClassUsedFromInterfaceHasInterfaceMethodKept.cs" /> + <Compile Include="VirtualMethods\StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs" /> <Compile Include="VirtualMethods\StructUsedFromInterfaceHasInterfaceMethodKept.cs" /> <Compile Include="CoreLink\CopyOfCoreLibrariesKeepsUnusedTypes.cs" /> <Compile Include="CoreLink\LinkingOfCoreLibrariesRemovesUnusedMethods.cs" /> diff --git a/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs new file mode 100644 index 000000000..51ea017d7 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs @@ -0,0 +1,26 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.VirtualMethods +{ + class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved { + public static void Main () + { + A a = new A (); + a.Foo (); + } + + [Kept] + [KeptInterface (typeof (IFoo))] + struct A : IFoo { + [Kept] + public void Foo () + { + } + } + + [Kept] + public interface IFoo { + void Foo (); + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs new file mode 100644 index 000000000..0f32024a3 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs @@ -0,0 +1,27 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.VirtualMethods +{ + class ClassUsedFromInterfaceHasInterfaceMethodKept { + public static void Main () + { + IFoo a = new A (); + a.Foo (); + } + + [Kept] + [KeptInterface (typeof (IFoo))] + struct A : IFoo { + [Kept] + public void Foo () + { + } + } + + [Kept] + public interface IFoo { + [Kept] + void Foo (); + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs new file mode 100644 index 000000000..bb795599d --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs @@ -0,0 +1,26 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.VirtualMethods +{ + class StructUsedFromConcreteTypeHasInterfaceMethodRemoved { + public static void Main () + { + A a = new A (); + a.Foo (); + } + + [Kept] + [KeptInterface (typeof (IFoo))] + struct A : IFoo { + [Kept] + public void Foo () + { + } + } + + [Kept] + public interface IFoo { + void Foo (); + } + } +} |