Add ImplementationAttributes to IMethodSymbol#50560
Add ImplementationAttributes to IMethodSymbol#50560AlekseyTs merged 24 commits intodotnet:masterfrom
Conversation
src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs
Outdated
Show resolved
Hide resolved
|
Tagging @dotnet/roslyn-compiler: I think it's sensible to make the @Youssef1313 Assuming we can get agreement on design change, a PR that exposes new public APIs needs direct test coverage for those APIs. |
My main question is: why does this need special handling? It's an attribute, right? You should be able get it through the regular API? |
|
(Didn't mean to close, sorry) |
|
@333fred Those are for metadata flags. You can put set them via attributes in source, but they are not emitted as attributes. |
|
Thanks for the clarification Julien. So, the main concern here is symbols from metadata, since symbols from source could retrieve the info via the existing attributes APIs? |
|
There seems to be some additional value, even aside from metadata symbols. |
|
Done review pass (commit 2) |
src/Compilers/CSharp/Test/Symbol/Symbols/SymbolEqualityTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/SymbolEqualityTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/SymbolEqualityTests.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs
Outdated
Show resolved
Hide resolved
|
@jcouv Thanks for the ping. I addressed @AlekseyTs's feedback. But not sure why some tests are failing. Failures happens for AggressiveInlining only. |
| /// Misc implementation metadata flags (ImplFlags in metadata). | ||
| /// </summary> | ||
| internal abstract System.Reflection.MethodImplAttributes ImplementationAttributes { get; } | ||
| internal abstract System.Reflection.MethodImplAttributes MethodImplementationFlags { get; } |
There was a problem hiding this comment.
MethodImplementationFlags [](start = 65, length = 25)
In my opinion this rename is unnecessary. #Closed
| [InlineData("[EnumeratorCancellation] ", "")] | ||
| [InlineData("", "[EnumeratorCancellation] ")] | ||
| public void AsyncIteratorWithAwaitCompletedAndYield_WithEnumeratorCancellation_ExtendedPartialMethod(string definitionAttributes, string implementationAttributes) | ||
| public void AsyncIteratorWithAwaitCompletedAndYield_WithEnumeratorCancellation_ExtendedPartialMethod(string definitionAttributes, string MethodImplementationFlags) |
There was a problem hiding this comment.
MethodImplementationFlags [](start = 145, length = 25)
The rename looks suspicious. #Closed
| End Property | ||
|
|
||
| Friend Overrides ReadOnly Property ImplementationAttributes As MethodImplAttributes | ||
| Friend Overrides ReadOnly Property MethodImplementationFlags As MethodImplAttributes |
There was a problem hiding this comment.
MethodImplementationFlags [](start = 39, length = 25)
Similar to C# I think this rename is unnecessary. #Closed
| Microsoft.CodeAnalysis.GeneratorPostInitializationContext.AddSource(string hintName, string source) -> void | ||
| Microsoft.CodeAnalysis.GeneratorPostInitializationContext.CancellationToken.get -> System.Threading.CancellationToken | ||
| Microsoft.CodeAnalysis.GeneratorPostInitializationContext.GeneratorPostInitializationContext() -> void | ||
| Microsoft.CodeAnalysis.IMethodSymbol.ImplementationAttributes.get -> System.Reflection.MethodImplAttributes |
There was a problem hiding this comment.
ImplementationAttributes [](start = 37, length = 24)
Is there an API like that. #Closed
| { | ||
| var c = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C"); | ||
| var aggressiveInliningMethod = c.GetMember<MethodSymbol>("M_Aggressive"); | ||
| Assert.Equal(MethodImplAttributes.AggressiveInlining, aggressiveInliningMethod.MethodImplementationFlags); |
There was a problem hiding this comment.
aggressiveInliningMethod.MethodImplementationFlags [](start = 70, length = 50)
It looks like this test doesn't actually test the added public API. Rename of the internal API made it hard to spot. I assume the other tests in this file have the same issue. #Closed
| Dim validator As Action(Of ModuleSymbol) = Sub([module]) | ||
| Dim c = [module].GlobalNamespace.GetMember(Of NamedTypeSymbol)("C") | ||
| Dim aggressiveInliningMethod = c.GetMember(Of MethodSymbol)("M_Aggressive") | ||
| Assert.Equal(MethodImplAttributes.AggressiveInlining, aggressiveInliningMethod.MethodImplementationFlags) |
There was a problem hiding this comment.
aggressiveInliningMethod.MethodImplementationFlags [](start = 113, length = 50)
Same comment as for C# tests. #Closed
|
Done with review pass (commit 17) #Closed |
src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs
Outdated
Show resolved
Hide resolved
...atures/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.WrappedMethodSymbol.cs
Outdated
Show resolved
Hide resolved
…SourceService.WrappedMethodSymbol.cs
333fred
left a comment
There was a problem hiding this comment.
LGTM (commit 23), assuming tests pass.
333fred
left a comment
There was a problem hiding this comment.
These should fix the tests. The issue is that the default VB test framework is too old and doesn't have AggressiveInlining, so it doesn't compile.
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/MethodImplementationFlagsTests.vb
Outdated
Show resolved
Hide resolved
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/MethodImplementationFlagsTests.vb
Outdated
Show resolved
Hide resolved
|
Done with review pass (commit 23), the CI is failing. #Closed |
Co-authored-by: Fred Silberberg <fred@silberberg.xyz>
|
@Youssef1313 Thanks for the contribution. |
|
What version is this shipped in? Currently getting: When referencing it was a transient property in a source generator. |
|
Should be 3.10. |
Fixes #7282