Skip to content

Add support for custom attributes on generic constraints - #594

Merged
jbevain merged 4 commits into
masterfrom
gparam-constraint-cattr
Jul 1, 2019
Merged

jbevain merged 4 commits into
masterfrom
gparam-constraint-cattr

Conversation

@jbevain

@jbevain jbevain commented Jun 20, 2019 •

Copy link
Copy Markdown
Owner

⚠️ 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

jbevain commented Jun 21, 2019

Copy link
Copy Markdown
Owner Author

This is required to support dotnet/roslyn#29997

@jcouv

jcouv commented Jun 28, 2019

Copy link
Copy Markdown

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

jbevain commented Jun 28, 2019

Copy link
Copy Markdown
Owner Author

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
Copy Markdown
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
Copy Markdown
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