-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for dotnet/linker#2260 (dotnet/linker#2263)
This uncovers a null ref in sweepstep. The test is order dependent: - Assembly (librarywithnonemtpy) has a virtual method which referes to type from second library (library). This processes the type reference. - The type is removed from library - The virtual method is re-processed again -> hits a type def which does not belong to any assembly/scope For this to happen the virtual method must be processed after the type has been removed. This also requires the method to be meant for removal later on (the body will be rewritten to throw), since otherwise the type would have been marked. This also requires the library with the removed type to be kept (so something else in it must be kept). Commit migrated from dotnet/linker@43fb979
- Loading branch information
1 parent
2ac715b
commit 6d67275
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...lasses/NoKeptCtor/OverrideRemoval/Dependencies/OverrideOfAbstractIsKeptNonEmptyLibrary.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,21 @@ | ||
// 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.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval.Dependencies | ||
{ | ||
public class OverrideOfAbstractIsKeptNonEmpty_UnusedType | ||
{ | ||
} | ||
|
||
public abstract class OverrideOfAbstractIsKeptNonEmpty_BaseType | ||
{ | ||
public abstract void Method (); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...tCtor/OverrideRemoval/Dependencies/OverrideOfAbstractIsKeptNonEmptyLibraryWithNonEmpty.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,23 @@ | ||
// 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.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval.Dependencies | ||
{ | ||
public class OverrideOfAbstractIsKeptNonEmptyLibraryWithNonEmpty : | ||
OverrideOfAbstractIsKeptNonEmpty_BaseType | ||
{ | ||
Dependencies.OverrideOfAbstractIsKeptNonEmpty_UnusedType _field; | ||
|
||
public override void Method () | ||
{ | ||
_field = null; | ||
} | ||
} | ||
} |
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