-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Propagate marked attributes from method type parameters to type parameters of synthesized types. #76492
Propagate marked attributes from method type parameters to type parameters of synthesized types. #76492
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,19 @@ public override bool IsImplicitlyDeclared | |
|
||
internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder<CSharpAttributeData> attributes) | ||
{ | ||
if (ContainingSymbol.Kind == SymbolKind.NamedType && | ||
_underlyingTypeParameter.OriginalDefinition is SourceMethodTypeParameterSymbol && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'll make this adjustment in the next PR |
||
ContainingSymbol.ContainingModule == _underlyingTypeParameter.OriginalDefinition.ContainingModule) | ||
{ | ||
foreach (CSharpAttributeData attr in _underlyingTypeParameter.OriginalDefinition.GetAttributes()) | ||
{ | ||
if (attr.AttributeClass is { HasCompilerLoweringPreserveAttribute: true }) | ||
{ | ||
AddSynthesizedAttribute(ref attributes, attr); | ||
} | ||
} | ||
} | ||
|
||
base.AddSynthesizedAttributes(moduleBuilder, ref attributes); | ||
|
||
if (this.HasUnmanagedTypeConstraint) | ||
|
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.
What does this refactoring enable?
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.
All implementations of method type parameters in source have a common base distinct from the base of type type parameters