-
-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Description
For the following code:
internal struct S;
internal static S? M()
{
S? i = new S();
return i;
}RCS1124 is emitted, to inline the i variable. However, the fixer results in this:
internal struct S;
internal static S? M()
{
return (S?)new S();
}This unnecessary cast does not need to be emitted.
It's worth noting that a non-nullable local doesn't have this problem:
internal struct S;
internal static S? M()
{
S i = new S();
return i;
}->
internal struct S;
internal static S? M()
{
return new S();
}(there's also no analyzer to remove this unnecessary cast, even Roslyn's IDE0004 doesn't trigger, but that may be another issue)
Metadata
Metadata
Assignees
Labels
No labels