-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add top level statement trimming tests #89606
Conversation
The object model wouldn't preserve declaring typesin these cases because the warnings are produced for members that are removed. Fixing the testcases to preserve these members lets us remove this workaround.
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue Detailsnull
|
@@ -103,57 +105,6 @@ public class TestCaseGenerator : IIncrementalGenerator | |||
{ | |||
public const string TestCaseAssembly = "Mono.Linker.Tests.Cases"; | |||
|
|||
public void Execute (GeneratorExecutionContext context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was dead code, left over from #86260.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :-)
src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs
Outdated
Show resolved
Hide resolved
if (member is MethodDefinition method && method.Name.Contains("<Main>$")) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this a bit confusing. The IsCompilerGeneratedMember
effectively dictates if we should perform "Kept" validation on the member.
I think we should instead change ShouldMethodBeKept
which basically says that entry point is always kept (regardless of attributes). I wonder why the entrypoint is not set to the compiler generated main though... insteresting...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a bit to remember why I did this - it's needed for Kept validation of top-level methods. I added a clarifying comment. (I checked and the generated Main method does get treated as the entry point.)
- Remove left-over debugging output - Add comment about checking of compiler-generated top-level methods
Failure is #88586 |
This adds support for top-level statements to the illink/nativeaot/trim-analyzer test infrastructure. Each file with top-level statements gets compiled into its own testcase assembly, which is placed into a subdirectory of the Mono.Linker.Tests.Cases build output.