-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for RequiresAttributeMismatch testing (#72496)
The RequiresAttributeMismatch warnings were not being generated since one of the answers from the MultiFileSharedCompilatioModuleGroup was to generate Vtables from everything. The logic for checking for warning mismatch is gated by not having a vtable being generated so needed to create a copy of the MultiFileSharedCompilationModuleGroup for testing purposes. Adding testing also unveils some issues with the current way of producing warnings in NativeAOT that are addressed in this PR. - Create a copy of the MultiFileSharedCompilationModuleGroup into the test infrastructure - Default answer of ShouldProduceFullVTable to false in the TestInfraMultiFileSharedCompilationModuleGroup, otherwise, the logic for checking for mismatch in NativeAOT will not work as currently implemented. - Property names don't need parenthesis, escape before they are added. - Small fix when ExplicitInterface names are used, cannot rely on name starting with get_/set_ in all cases. - Additional RUC warning check when a method is marked via DAM and is not TypeHierarchy marking - Adds RequiresAttributeMismatch test file from linker (includes adding NativeAOT specific ProducedBy attributes)
- Loading branch information
Showing
9 changed files
with
822 additions
and
215 deletions.
There are no files selected for viewing
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
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
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
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
46 changes: 46 additions & 0 deletions
46
.../tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/Dependencies/ReferenceInterfaces.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,46 @@ | ||
// 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; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Mono.Linker.Tests.Cases.RequiresCapability.Dependencies | ||
{ | ||
public class ReferenceInterfaces | ||
{ | ||
public interface IBaseWithRequiresInReference | ||
{ | ||
[RequiresUnreferencedCode ("Message")] | ||
[RequiresAssemblyFiles ("Message")] | ||
[RequiresDynamicCode ("Message")] | ||
public void Method (); | ||
|
||
public string PropertyAnnotationInAccesor { | ||
[RequiresUnreferencedCode ("Message")] | ||
[RequiresAssemblyFiles ("Message")] | ||
[RequiresDynamicCode ("Message")] | ||
get; | ||
set; | ||
} | ||
|
||
[RequiresAssemblyFiles ("Message")] | ||
public string PropertyAnnotationInProperty { get; set; } | ||
} | ||
|
||
public interface IBaseWithoutRequiresInReference | ||
{ | ||
public void Method (); | ||
|
||
public string PropertyAnnotationInAccesor { | ||
get; | ||
set; | ||
} | ||
|
||
public string PropertyAnnotationInProperty { get; set; } | ||
} | ||
} | ||
} |
Oops, something went wrong.