Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f704291
Re-add static interface trimming with more testing
jtschuster May 9, 2022
68c530d
Add static interface tests for library mode
jtschuster May 12, 2022
97cd617
Add sanity check for overrides
jtschuster May 12, 2022
8190bf7
Add sanity check for overrides
jtschuster May 12, 2022
9a5fe0f
Merge branch 'main' into overrideSanityCheck
jtschuster May 12, 2022
3a560d4
Merge branch 'overrideSanityCheck' into staticInterfacesBack
jtschuster May 12, 2022
733bf90
Update comment on override removal in sweep step
jtschuster May 12, 2022
47104d9
Add attributes
jtschuster May 12, 2022
c2f4fd1
formatting
jtschuster May 12, 2022
3d577ce
formatting
jtschuster May 12, 2022
8ac16bb
Merge branch 'overrideSanityCheck' into staticInterfacesBack
jtschuster May 13, 2022
cccca4c
Modify override removal logic and update comment
jtschuster May 13, 2022
c380027
Mark override on explicit implementation
jtschuster May 13, 2022
4813047
Tweak override removal comment
jtschuster May 13, 2022
332e79f
wip
jtschuster May 13, 2022
9f64a32
Merge branch 'main' into staticInterfacesBack
jtschuster May 25, 2022
9d27c3b
Merge remote-tracking branch 'upstream/main' into staticInterfacesBack
jtschuster May 25, 2022
7f1064d
Choose correct merge conflict
jtschuster May 25, 2022
15db395
use FullName in comparison
jtschuster May 26, 2022
1751697
wip
jtschuster Jun 1, 2022
b10cd5f
Update docs/removal-behavior.md
jtschuster Jun 1, 2022
e3fbf12
Add explanation for workaround to remove interface implementation
jtschuster Jun 1, 2022
098cb24
Merge branch 'staticInterfacesBack' of https://github.com/jtschuster/…
jtschuster Jun 1, 2022
7467d82
wip
jtschuster Jun 2, 2022
4efa5f2
Mark static interface implmentations in ProcessOverride
jtschuster Jun 2, 2022
c3a26ca
Format and update comment
jtschuster Jun 2, 2022
62e3cc8
Use separate list for static interface methods
jtschuster Jun 3, 2022
4359792
Add clarifying comments
jtschuster Jun 3, 2022
060345e
Roll early exit case into function
jtschuster Jun 3, 2022
a050fdf
Move check back outside of interface override method
jtschuster Jun 7, 2022
95df541
formatting
jtschuster Jun 7, 2022
2b7a7cc
Use Override pair to store logic for IsStaticInterfaceMethodPair
jtschuster Jun 7, 2022
c00e1d1
Formatting
jtschuster Jun 8, 2022
358b010
Move interfaceImpl marking out of ProcessOverride
jtschuster Jun 13, 2022
5672f0f
Merge remote-tracking branch 'upstream/main' into staticInterfacesBack
jtschuster Jun 14, 2022
432375d
PR Feedback
jtschuster Jun 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add attributes
  • Loading branch information
jtschuster committed May 12, 2022
commit 47104d9a3b0a5739ea35a330e6e9739b5c6693fe
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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.

using System;

namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
/// <summary>
/// Used to ensure that a method should keep an 'override' annotation for a method in the supplied base type.
/// The absence of this attribute does not enforce that the override is removed -- this is different from other Kept attributes
/// To enforce the removal of an override, use <see cref="RemovedOverrideAttribute"/>.
/// Fails in tests if the method doesn't have the override method in the original or linked assembly.
/// </summary>
/// <seealso cref="RemovedOverrideAttribute" />
[AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class KeptOverrideAttribute : KeptAttribute
{
public Type TypeWithOverriddenMethodDeclaration;

public KeptOverrideAttribute (Type typeWithOverriddenMethod)
{
if (typeWithOverriddenMethod == null)
throw new ArgumentNullException (nameof (typeWithOverriddenMethod));
TypeWithOverriddenMethodDeclaration = typeWithOverriddenMethod;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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.

using System;

namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
/// <Summary>
/// Used to ensure that a method should remove an 'override' annotation for a method in the supplied base type.
/// Fails in tests if the method has the override method in the linked assembly,
/// or if the override is not found in the original assembly
/// </Summary>
/// <seealso cref="KeptOverrideAttribute" />
[AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class RemovedOverrideAttribute : BaseInAssemblyAttribute
{
public Type TypeWithOverriddenMethodDeclaration;
public RemovedOverrideAttribute (Type typeWithOverriddenMethod)
{
if (typeWithOverriddenMethod == null)
throw new ArgumentException ("Value cannot be null or empty.", nameof (typeWithOverriddenMethod));
TypeWithOverriddenMethodDeclaration = typeWithOverriddenMethod;
}
}
}
2 changes: 1 addition & 1 deletion test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void VerifyOverrides (MethodDefinition original, MethodDefinition linked)
Assert.True (linked.DeclaringType.Interfaces.Select(i => i.InterfaceType).Contains (overriddenMethod.DeclaringType),
$"Method {linked} overrides method {overriddenMethod}, but {linked.DeclaringType} does not implement interface {overriddenMethod.DeclaringType}");
} else {
TypeReference? baseType = linked.DeclaringType!;
TypeReference baseType = linked.DeclaringType;
TypeReference overriddenType = overriddenMethod.DeclaringType;
while (baseType is not null) {
if (baseType.Equals (overriddenType))
Expand Down