-
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
Add extract method support for ref struct interfaces #73619
Conversation
The method extraction code uses ITypeParameterSymbol's constraints to generate the new method's text. This codepath had not yet been modified to support ITypeParameterSymbol.AllowsRefLikeType This is in support of the "allows ref struct" on interfaces feature outlined here: #72124 This ref structs for interfaces feature was merged via this PR: #73567
@@ -18,6 +18,7 @@ | |||
bool hasConstructorConstraint, | |||
bool hasReferenceConstraint, | |||
bool hasValueConstraint, | |||
bool allowsRefLikeType, |
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.
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.
re-ordered for the new parameter to be the last bool param
@@ -337,10 +338,11 @@ | |||
bool hasReferenceConstraint = false, | |||
bool hasUnmanagedConstraint = false, | |||
bool hasValueConstraint = false, | |||
bool allowsRefLikeType = false, |
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.
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.
Especially that in CodeGenerationTypeParameterSymbol
it comes before hasUnmanagedConstraint
parameter.
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.
LGTM (commit 1)
@@ -322,7 +322,8 @@ public static ITypeParameterSymbol CreateTypeParameterSymbol(string name, int or | |||
attributes: default, varianceKind: VarianceKind.None, | |||
name: name, constraintTypes: [], | |||
hasConstructorConstraint: false, hasReferenceConstraint: false, hasValueConstraint: false, | |||
hasUnmanagedConstraint: false, hasNotNullConstraint: false, ordinal: ordinal); | |||
allowsRefLikeType: false, hasUnmanagedConstraint: false, hasNotNullConstraint: false, |
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.
…ontext, but good to be consistent)
The method extraction code uses ITypeParameterSymbol's constraints to generate the new method's text. This codepath had not yet been modified to support ITypeParameterSymbol.AllowsRefLikeType
This is in support of the "allows ref struct" on interfaces feature outlined here: #72124
This ref structs for interfaces feature was merged via this PR: #73567