-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Specially handle more scenarios for type parameters with 'allows ref struct' constraint #73305
Specially handle more scenarios for type parameters with 'allows ref struct' constraint #73305
Conversation
…struct' constraint
@@ -754,6 +773,11 @@ static bool isUtf8ByteRepresentation(BoundExpression value) | |||
{ | |||
return value is BoundUtf8String or BoundBinaryOperator { OperatorKind: BinaryOperatorKind.Utf8Addition }; | |||
} | |||
|
|||
Conversion getOperandConversionForAllowByRefLikeNullCheck(bool isChecked, BoundExpression operand, TypeSymbol objectType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) |
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.
Static? #Resolved
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.
Static?
Conversion
is an instance member.
EmitExpression(comparand, true); | ||
|
||
object falseLabel = new object(); | ||
var endLabel = new object(); |
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.
Nit: consider making both variables consistently either var
or object
. #Resolved
.maxstack 1 | ||
IL_0000: ldarg.0 | ||
IL_0001: box ""T"" | ||
IL_0006: brtrue.s IL_000a |
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.
Why don't we emit branchless code like box; ldnull; ceq
instead? #Resolved
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.
Why don't we emit branchless code like box; ldnull; ceq
instead?
Because that IL sequence is illegal for type parameters that allow ref struct. Boxing is not supported for them in general, but an exception is made for box, brtue/brfalse
sequence.
@cston, @dotnet/roslyn-compiler For the second review |
449738c
into
dotnet:features/RefStructInterfaces
No description provided.