-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Update TypeMap attribute handling #120477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
530179d
Update TypeMap attribute handling
jtschuster 620e1f7
Fix compiler error for last minute change
jtschuster 781c154
Update src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/TypeM…
jtschuster af79f1f
PR Feedback
jtschuster 6812736
Merge branch 'ILLinkTypeMapTests' of https://github.com/jtschuster/ru…
jtschuster 551d975
Check return value of Add rather than use Contains()
jtschuster edaa689
Leave marking unchanged for follow-up
jtschuster fd8be10
Revert marking change to match old behavior.
jtschuster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
51 changes: 51 additions & 0 deletions
51
.../illink/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/TypeMapReferencedAssembly.cs
This file contains hidden or 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,51 @@ | ||
| // 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.Runtime.InteropServices; | ||
| using Mono.Linker.Tests.Cases.Reflection.Dependencies; | ||
| using Mono.Linker.Tests.Cases.Reflection.Dependencies.Library; | ||
|
|
||
| [assembly: TypeMap<UsedTypeMapUniverse>("UnimportantString", typeof(TargetTypeUnconditional1))] | ||
| [assembly: TypeMap<UsedTypeMapUniverse>("UnimportantString", typeof(TargetTypeConditional1), typeof(TrimTarget1))] | ||
| [assembly: TypeMapAssociation<UsedTypeMapUniverse>(typeof(ProxySource1), typeof(ProxyTarget1))] | ||
|
|
||
| [assembly: TypeMap<UnusedTypeMapUniverse>("UnimportantString", typeof(TargetTypeUnconditional2))] | ||
| [assembly: TypeMap<UnusedTypeMapUniverse>("UnimportantString", typeof(TargetTypeConditional2), typeof(TrimTarget2))] | ||
| [assembly: TypeMapAssociation<UnusedTypeMapUniverse>(typeof(ProxySource2), typeof(ProxyTarget2))] | ||
| [assembly: TypeMapAssemblyTarget<UsedTypeMapUniverse>("library2")] | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Reflection.Dependencies | ||
| { | ||
| public class TypeMapReferencedAssembly | ||
| { | ||
| public static void Main() | ||
| { | ||
| // Mark expected trim targets | ||
| _ = new TrimTarget1(); | ||
| _ = new ProxySource1(); | ||
| _ = new TrimTarget2(); | ||
| _ = new ProxySource2(); | ||
|
|
||
| // Mark expected type map universe | ||
| _ = TypeMapping.GetOrCreateExternalTypeMapping<UsedTypeMapUniverse>(); | ||
| _ = TypeMapping.GetOrCreateProxyTypeMapping<UsedTypeMapUniverse>(); | ||
| } | ||
| } | ||
|
|
||
| public class UsedTypeMapUniverse; | ||
| public class UnusedTypeMapUniverse; | ||
| } | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Reflection.Dependencies.Library | ||
| { | ||
| public class TargetTypeUnconditional1; | ||
| public class TargetTypeConditional1; | ||
| public class ProxySource1; | ||
| public class ProxyTarget1; | ||
| public class TargetTypeUnconditional2; | ||
| public class TargetTypeConditional2; | ||
| public class ProxySource2; | ||
| public class ProxyTarget2; | ||
| public class TrimTarget1; | ||
| public class TrimTarget2; | ||
| } |
43 changes: 43 additions & 0 deletions
43
...llink/test/Mono.Linker.Tests.Cases/Reflection/Dependencies/TypeMapSecondOrderReference.cs
This file contains hidden or 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,43 @@ | ||
|
|
||
| // 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.Runtime.InteropServices; | ||
| using Mono.Linker.Tests.Cases.Reflection.Dependencies; | ||
| using Mono.Linker.Tests.Cases.Reflection.Dependencies.Library2; | ||
|
|
||
| // Nothing in this assembly should be referenced or rooted directly | ||
| // This should validate the if only the type map attributes are kept, the assembly is still preserved | ||
| [assembly: TypeMap<string>("UnimportantString", typeof(long))] | ||
| [assembly: TypeMap<string>("UnimportantString", typeof(uint), typeof(string))] | ||
| [assembly: TypeMapAssociation<string>(typeof(int), typeof(uint))] | ||
|
|
||
| [assembly: TypeMap<UnusedTypeMapUniverse2>("UnimportantString", typeof(TargetTypeUnconditional2))] | ||
| [assembly: TypeMap<UnusedTypeMapUniverse2>("UnimportantString", typeof(TargetTypeConditional2), typeof(TrimTarget2))] | ||
| [assembly: TypeMapAssociation<UnusedTypeMapUniverse2>(typeof(ProxySource2), typeof(ProxyTarget2))] | ||
|
|
||
| [assembly: TypeMapAssemblyTarget<string>("library")] // Circular reference | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Reflection.Dependencies | ||
| { | ||
| public class TypeMapReferencedAssembly2 | ||
| { | ||
| } | ||
|
|
||
| public class UsedTypeMapUniverse2; | ||
| public class UnusedTypeMapUniverse2; | ||
| } | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.Reflection.Dependencies.Library2 | ||
| { | ||
| public class TargetTypeUnconditional1; | ||
| public class TargetTypeConditional1; | ||
| public class ProxySource1; | ||
| public class ProxyTarget1; | ||
| public class TargetTypeUnconditional2; | ||
| public class TargetTypeConditional2; | ||
| public class ProxySource2; | ||
| public class ProxyTarget2; | ||
| public class TrimTarget1; | ||
| public class TrimTarget2; | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.