diff options
author | Jackson Schuster <36744439+jtschuster@users.noreply.github.com> | 2022-04-29 22:28:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 22:28:35 +0300 |
commit | 44610681fb096cc2b38a18689e954af24049d390 (patch) | |
tree | 5ccc2024967584f3954e7e540ceb93ada1728f5d /test/Mono.Linker.Tests.Cases | |
parent | 98ba0ce1b4bc5c3e094a912d3221fe96938d6d8d (diff) |
Don't remove MethodImpl if overridden method is not in a link assembly (#2771)
Before removing overrides, we should check if the overridden method is
in an ignore scope.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases')
3 files changed, 22 insertions, 1 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/CopyLibrary.cs b/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/CopyLibrary.cs index 0f31e8277..792f869fb 100644 --- a/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/CopyLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/CopyLibrary.cs @@ -13,5 +13,6 @@ namespace Mono.Linker.Tests.Cases.Libraries.Dependencies { static abstract void CopyLibraryStaticInterfaceMethod (); static abstract void CopyLibraryExplicitImplementationStaticInterfaceMethod (); + public static abstract void PublicStaticInterfaceMethod (); } } diff --git a/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/SkipLibrary.cs b/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/SkipLibrary.cs new file mode 100644 index 000000000..20f59e090 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/SkipLibrary.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Mono.Linker.Tests.Cases.Libraries.Dependencies +{ + public interface ISkipLibraryStaticInterface + { + static abstract void StaticInterfaceMethod (); + } +} diff --git a/test/Mono.Linker.Tests.Cases/Libraries/RootLibrary.cs b/test/Mono.Linker.Tests.Cases/Libraries/RootLibrary.cs index eebdbf67c..03cf665de 100644 --- a/test/Mono.Linker.Tests.Cases/Libraries/RootLibrary.cs +++ b/test/Mono.Linker.Tests.Cases/Libraries/RootLibrary.cs @@ -12,7 +12,9 @@ using Mono.Linker.Tests.Cases.Libraries.Dependencies; namespace Mono.Linker.Tests.Cases.Libraries { [SetupCompileBefore ("copylibrary.dll", new[] { "Dependencies/CopyLibrary.cs" })] + [SetupCompileBefore ("skiplibrary.dll", new[] { "Dependencies/SkipLibrary.cs" })] [SetupLinkerAction ("copy", "copylibrary")] + [SetupLinkerAction ("skip", "skiplibrary")] [SetupLinkerArgument ("-a", "test.exe", "library")] [SetupLinkerArgument ("--enable-opt", "ipconstprop")] [VerifyMetadataNames] @@ -188,6 +190,7 @@ namespace Mono.Linker.Tests.Cases.Libraries [KeptInterface (typeof (IInternalStaticInterface))] [KeptInterface (typeof (ICopyLibraryInterface))] [KeptInterface (typeof (ICopyLibraryStaticInterface))] + [KeptInterface (typeof (ISkipLibraryStaticInterface))] public class UninstantiatedPublicClassWithInterface : IPublicInterface, IPublicStaticInterface, @@ -195,7 +198,8 @@ namespace Mono.Linker.Tests.Cases.Libraries IInternalStaticInterface, IEnumerator, ICopyLibraryInterface, - ICopyLibraryStaticInterface + ICopyLibraryStaticInterface, + ISkipLibraryStaticInterface { internal UninstantiatedPublicClassWithInterface () { } @@ -241,7 +245,12 @@ namespace Mono.Linker.Tests.Cases.Libraries public static void CopyLibraryStaticInterfaceMethod () { } [Kept] + [KeptOverride (typeof (ICopyLibraryStaticInterface))] static void ICopyLibraryStaticInterface.CopyLibraryExplicitImplementationStaticInterfaceMethod () { } + + [Kept] + [KeptOverride (typeof (ISkipLibraryStaticInterface))] + static void ISkipLibraryStaticInterface.StaticInterfaceMethod () { } } [Kept] @@ -325,6 +334,7 @@ namespace Mono.Linker.Tests.Cases.Libraries public static void CopyLibraryStaticInterfaceMethod () { } [Kept] + [KeptOverride (typeof (ICopyLibraryStaticInterface))] static void ICopyLibraryStaticInterface.CopyLibraryExplicitImplementationStaticInterfaceMethod () { } } |