Skip to content

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented Aug 25, 2025

Addresses part of #78963 ("Metadata: copying attributes (synthesized attributes like nullability? we copy some attributes from enclosing method to closure type, [...])")
Relates to test plan #76130

Relates to #73920

@jcouv jcouv self-assigned this Aug 25, 2025
@jcouv jcouv added Area-Compilers Feature - Extension Everything The extension everything feature labels Aug 25, 2025
@jcouv jcouv mentioned this pull request Aug 25, 2025
28 tasks
@jcouv jcouv force-pushed the extensions-typeparams branch from 368c5b3 to 376f445 Compare August 26, 2025 03:58
@jcouv jcouv marked this pull request as ready for review August 26, 2025 07:14
@jcouv jcouv requested a review from a team as a code owner August 26, 2025 07:14
@jcouv jcouv changed the title Extensions: round-trip attributes on type parameters Extensions: propagate attributes on type parameters Aug 26, 2025
@jcouv jcouv requested a review from jjonescz August 26, 2025 16:00
}

[Theory, CombinatorialData]
public void PropagateAttributes_13(bool useCompilationReference)
Copy link
Member

@333fred 333fred Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding indexer tests now, marked skipped until we implement? #Resolved

@jcouv jcouv requested a review from 333fred August 26, 2025 22:03
int ordinal = 0;
foreach (var tp in oldTypeParameters)
{
var newTp = synthesized ?
Copy link
Member

@jjonescz jjonescz Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment above for when synthesized is true still accurate? It doesn't seem to include extension type parameters. #Resolved

}
}

public class AAttribute : System.Attribute { }
Copy link
Member

@jjonescz jjonescz Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks unused #Resolved

01 00 00 00
)
.param type T
.custom instance void AAttribute::.ctor() = (
Copy link
Member

@jjonescz jjonescz Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for preserving all attributes? Why wouldn't we preserve just the ones marked with CompilerLoweringPreserve? #Resolved

Copy link
Member Author

@jcouv jcouv Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for including the attribute here is portability from classic extension methods. We want to produce exactly the same metadata that we did in classic form
I think this extends to adjacent scenarios, such as a static extension method, even though we're not bound by precedent

@jcouv jcouv force-pushed the extensions-typeparams branch from 8013b59 to 1cd0f0d Compare August 27, 2025 20:16
@jcouv jcouv requested a review from jjonescz August 28, 2025 04:30
@jcouv jcouv enabled auto-merge (squash) August 28, 2025 17:34
@jcouv jcouv disabled auto-merge August 28, 2025 19:25
@jcouv jcouv merged commit 502420d into dotnet:main Aug 28, 2025
28 checks passed
@jcouv jcouv deleted the extensions-typeparams branch August 28, 2025 19:25
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 28, 2025
@akhera99 akhera99 modified the milestones: Next, 18.0 P1, 18.0 P2 Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Feature - Extension Everything The extension everything feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants