Skip to content

Commit

Permalink
Fix testcase for ILC behavior with preserved generated code (dotnet#1…
Browse files Browse the repository at this point in the history
…05042)

The feature setting ensures that ILC sees a constant and has the
same warning behavior as ILLink. We decided this is the desired
behavior in dotnet#85161.

Fixes dotnet#85161
  • Loading branch information
sbomer committed Jul 17, 2024
1 parent bc45b3e commit 8c95a64
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow
[ExpectedNoWarnings]
[SetupLinkerArgument ("--enable-opt", "ipconstprop")]
[SetupLinkerDescriptorFile ("CompilerGeneratedCodeInPreservedAssembly.xml")]
[SetupLinkerArgument ("--feature", "AlwaysFalse", "false")]
class CompilerGeneratedCodeInPreservedAssembly
{
public static void Main ()
Expand All @@ -40,9 +41,7 @@ public static void WithLocalFunctionInner ()
}

// Analyzer doesn't implement constant propagation and branch removal, so it reaches this code
// NativeAOT behavioral difference:
// https://github.com/dotnet/runtime/issues/85161
[ExpectedWarning ("IL2026", Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", Tool.Analyzer, "")]
void LocalWithWarning ()
{
// No warning
Expand All @@ -62,15 +61,14 @@ public static void WithLocalFunction ()
}

// Analyzer doesn't implement constant propagation and branch removal, so it reaches this code
// NativeAOT behavioral difference:
// https://github.com/dotnet/runtime/issues/85161
[ExpectedWarning ("IL2026", Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", Tool.Analyzer, "")]
void LocalWithWarning ()
{
Requires ();
}
}

[FeatureSwitchDefinition ("AlwaysFalse")]
public static bool AlwaysFalse => false;

[RequiresUnreferencedCode ("RUC")]
Expand Down

0 comments on commit 8c95a64

Please sign in to comment.