diff options
author | Marek Safar <marek.safar@gmail.com> | 2021-02-08 17:41:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 17:41:41 +0300 |
commit | 15ab7839edf80d48b64b719e874d5bcf154d1f53 (patch) | |
tree | f2197e7b6019185b56de3beb0aa9d8cf053eb4bf /test/Mono.Linker.Tests.Cases/DataFlow | |
parent | 52bb1720b5b5d56bdf73f56dc2ca81aab978ad97 (diff) |
Reenable default UnreachableBodies optimization (#1799)
Whole runtime repo now passes with it and I could not repro xamarin issue
locally. If this will turn out problem again it can now temporary disabled
on per assembly basis.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs | 143 | ||||
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs | 2 |
2 files changed, 61 insertions, 84 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs index 25ca9f03a..d0b51abf5 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs @@ -8,9 +8,11 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Text; using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.DataFlow { + [SetupCompileArgument ("/optimize+")] public class MemberTypes { public static void Main () @@ -288,25 +290,23 @@ namespace Mono.Linker.Tests.Cases.DataFlow public void HideMethod () { } [Kept] - [KeptBackingField] - public bool PublicPropertyOnBase { [Kept] get; [Kept] set; } + public bool PublicPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } protected bool ProtectedPropertyOnBase { get; set; } private bool PrivatePropertyOnBase { get; set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEventOnBase; protected event EventHandler<EventArgs> ProtectedEventOnBase; private event EventHandler<EventArgs> PrivateEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -357,25 +357,23 @@ namespace Mono.Linker.Tests.Cases.DataFlow public void HideMethod () { } [Kept] - [KeptBackingField] - public bool PublicProperty { [Kept] get; [Kept] set; } + public bool PublicProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } protected bool ProtectedProperty { get; set; } private bool PrivateProperty { get; set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEvent; protected event EventHandler<EventArgs> ProtectedEvent; private event EventHandler<EventArgs> PrivateEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -428,16 +426,15 @@ namespace Mono.Linker.Tests.Cases.DataFlow public bool PublicPropertyOnBase { get; set; } [Kept] - [KeptBackingField] - protected bool ProtectedPropertyOnBase { [Kept] get; [Kept] set; } + protected bool ProtectedPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } private bool PrivatePropertyOnBase { get; set; } public bool HideProperty { get; set; } public event EventHandler<EventArgs> PublicEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEventOnBase; private event EventHandler<EventArgs> PrivateEventOnBase; public event EventHandler<EventArgs> HideEvent; @@ -484,23 +481,21 @@ namespace Mono.Linker.Tests.Cases.DataFlow public bool PublicProperty { get; set; } [Kept] - [KeptBackingField] - protected bool ProtectedProperty { [Kept] get; [Kept] set; } + protected bool ProtectedProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - private bool PrivateProperty { [Kept] get; [Kept] set; } + private bool PrivateProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } public bool HideProperty { get; set; } public event EventHandler<EventArgs> PublicEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] private event EventHandler<EventArgs> PrivateEvent; public event EventHandler<EventArgs> HideEvent; @@ -557,31 +552,28 @@ namespace Mono.Linker.Tests.Cases.DataFlow public void HideMethod () { } [Kept] - [KeptBackingField] - public bool PublicPropertyOnBase { [Kept] get; [Kept] set; } + public bool PublicPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - protected bool ProtectedPropertyOnBase { [Kept] get; [Kept] set; } + protected bool ProtectedPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } private bool PrivatePropertyOnBase { get; set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEventOnBase; private event EventHandler<EventArgs> PrivateEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -642,37 +634,33 @@ namespace Mono.Linker.Tests.Cases.DataFlow public void HideMethod () { } [Kept] - [KeptBackingField] - public bool PublicProperty { [Kept] get; [Kept] set; } + public bool PublicProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - protected bool ProtectedProperty { [Kept] get; [Kept] set; } + protected bool ProtectedProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - private bool PrivateProperty { [Kept] get; [Kept] set; } + private bool PrivateProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] private event EventHandler<EventArgs> PrivateEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -1170,8 +1158,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow class PublicPropertiesBaseType { [Kept] - [KeptBackingField] - public bool PublicPropertyOnBase { [Kept] get; [Kept] set; } + public bool PublicPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] public bool PublicPropertyGetterOnBase { [Kept] get { return false; } [Kept] private set { } } [Kept] @@ -1183,8 +1170,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow protected bool ProtectedPropertyOnBase { get; set; } private bool PrivatePropertyOnBase { get; set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] [KeptBackingField] @@ -1201,8 +1187,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow class PublicPropertiesType : PublicPropertiesBaseType { [Kept] - [KeptBackingField] - public bool PublicProperty { [Kept] get; [Kept] set; } + public bool PublicProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] public bool PublicPropertyGetter { [Kept] get { return false; } [Kept] private set { } } [Kept] @@ -1214,8 +1199,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow protected bool ProtectedProperty { get; set; } private bool PrivateProperty { get; set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] [KeptBackingField] @@ -1245,8 +1229,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow public bool PublicPropertyOnlyGetterOnBase { get { return false; } } public bool PublicPropertyOnlySetterOnBase { set { } } [Kept] - [KeptBackingField] - protected bool ProtectedPropertyOnBase { [Kept] get; [Kept] set; } + protected bool ProtectedPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } private bool PrivatePropertyOnBase { get; set; } public bool HideProperty { get; set; } @@ -1268,11 +1251,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow public bool PublicPropertyOnlyGetter { get { return false; } } public bool PublicPropertyOnlySetter { set { } } [Kept] - [KeptBackingField] - protected bool ProtectedProperty { [Kept] get; [Kept] set; } + protected bool ProtectedProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - private bool PrivateProperty { [Kept] get; [Kept] set; } + private bool PrivateProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } public bool HideProperty { get; set; } static public bool PublicStaticProperty { get; set; } @@ -1297,8 +1278,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow class AllPropertiesBaseType { [Kept] - [KeptBackingField] - public bool PublicPropertyOnBase { [Kept] get; [Kept] set; } + public bool PublicPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] public bool PublicPropertyGetterOnBase { [Kept] get { return false; } [Kept] private set { } } [Kept] @@ -1308,12 +1288,10 @@ namespace Mono.Linker.Tests.Cases.DataFlow [Kept] public bool PublicPropertyOnlySetterOnBase { [Kept] set { } } [Kept] - [KeptBackingField] - protected bool ProtectedPropertyOnBase { [Kept] get; [Kept] set; } + protected bool ProtectedPropertyOnBase { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } private bool PrivatePropertyOnBase { get; set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] [KeptBackingField] @@ -1332,8 +1310,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow class AllPropertiesType : AllPropertiesBaseType { [Kept] - [KeptBackingField] - public bool PublicProperty { [Kept] get; [Kept] set; } + public bool PublicProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] public bool PublicPropertyGetter { [Kept] get { return false; } [Kept] private set { } } [Kept] @@ -1343,14 +1320,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow [Kept] public bool PublicPropertyOnlySetter { [Kept] set { } } [Kept] - [KeptBackingField] - protected bool ProtectedProperty { [Kept] get; [Kept] set; } + protected bool ProtectedProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - private bool PrivateProperty { [Kept] get; [Kept] set; } + private bool PrivateProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] - [KeptBackingField] - public bool HideProperty { [Kept] get; [Kept] set; } + public bool HideProperty { [Kept][ExpectBodyModified] get; [Kept][ExpectBodyModified] set; } [Kept] [KeptBackingField] @@ -1379,16 +1353,16 @@ namespace Mono.Linker.Tests.Cases.DataFlow class PublicEventsBaseType { [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEventOnBase; protected event EventHandler<EventArgs> ProtectedEventOnBase; private event EventHandler<EventArgs> PrivateEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -1410,16 +1384,16 @@ namespace Mono.Linker.Tests.Cases.DataFlow class PublicEventsType : PublicEventsBaseType { [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEvent; protected event EventHandler<EventArgs> ProtectedEvent; private event EventHandler<EventArgs> PrivateEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -1450,9 +1424,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow { public event EventHandler<EventArgs> PublicEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEventOnBase; private event EventHandler<EventArgs> PrivateEventOnBase; public event EventHandler<EventArgs> HideEvent; @@ -1473,14 +1447,14 @@ namespace Mono.Linker.Tests.Cases.DataFlow { public event EventHandler<EventArgs> PublicEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] private event EventHandler<EventArgs> PrivateEvent; public event EventHandler<EventArgs> HideEvent; @@ -1510,20 +1484,20 @@ namespace Mono.Linker.Tests.Cases.DataFlow class AllEventsBaseType { [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEventOnBase; private event EventHandler<EventArgs> PrivateEventOnBase; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -1549,24 +1523,24 @@ namespace Mono.Linker.Tests.Cases.DataFlow class AllEventsType : AllEventsBaseType { [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> PublicEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] protected event EventHandler<EventArgs> ProtectedEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] private event EventHandler<EventArgs> PrivateEvent; [Kept] - [KeptBackingField] [KeptEventAddMethod] [KeptEventRemoveMethod] + [method: ExpectBodyModified, ExpectLocalsModified] public event EventHandler<EventArgs> HideEvent; [Kept] @@ -1748,6 +1722,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow [Kept] [KeptBaseType (typeof (AllBaseType))] + [AddedPseudoAttributeAttribute ((uint) TypeAttributes.BeforeFieldInit)] class AllType : AllBaseType { [Kept] diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs index 213c374fb..9dc4813b8 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodThisDataFlow.cs @@ -19,6 +19,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow { public static void Main () { + new MethodThisDataFlowTypeTest (); + PropagateToThis (); PropagateToThisWithGetters (); PropagateToThisWithSetters (); |