Skip to content
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 support for custom attributes on generic constraints #594

Merged
merged 4 commits into from
Jul 1, 2019

Conversation

jbevain
Copy link
Owner

@jbevain jbevain commented Jun 20, 2019

⚠️ This is a breaking API change.

@jbevain jbevain force-pushed the gparam-constraint-cattr branch from 81085a9 to febbd65 Compare June 20, 2019 21:13
@jbevain
Copy link
Owner Author

jbevain commented Jun 21, 2019

This is required to support dotnet/roslyn#29997

@jcouv
Copy link

jcouv commented Jun 28, 2019

Tagging @sbomer @marek-safar @agocke.
We've just realized that supporting this scenario (attributes on type constraints) is impacting building corefx with nullability annotations because ILLinker currently doesn't understand such attributes and so drops them.
This is not blocking Core preview 7 (corefx can just remove the one instance of such an attribute so far).

We're trying to understand what it would take to get this change flowing into ILLinker for the next preview.
For instance, does this require a code change from ILLinker, or would it just be a matter of referencing a new version of Cecil?

@jbevain
Copy link
Owner Author

jbevain commented Jun 28, 2019

To reach the linker, this would need to flow to mono/cecil and mono/linker will need to react to the API breaking change, which should be minimal.

{
var constraints = parameter.Constraints;

for (int i = 0; i < constraints.Count; i++)
Copy link
Contributor

Choose a reason for hiding this comment

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

@jbevain out of curiosity, why do u prefer for over foreach?

Copy link
Owner Author

Choose a reason for hiding this comment

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

This codebase was started at a moment where mcs didn't generate great code for foreach on generic collections, and so used for instead of foreach. It's now used only for consistency with the rest of the code.

@jbevain jbevain merged commit f9751de into master Jul 1, 2019
@jbevain jbevain deleted the gparam-constraint-cattr branch August 30, 2019 00:26
amanda-tarafa added a commit to amanda-tarafa/google-cloud-dotnet that referenced this pull request Aug 3, 2021
For nullability support.

Mono.Cecil introduced a breaking change in jbevain/cecil#594 because of dotnet/roslyn#29997
jskeet pushed a commit to googleapis/google-cloud-dotnet that referenced this pull request Aug 4, 2021
For nullability support.

Mono.Cecil introduced a breaking change in jbevain/cecil#594 because of dotnet/roslyn#29997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants