-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-IDEBughelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Milestone
Description
Version Used:
17.2.0 Preview 2.0
Steps to Reproduce:
public class C
{
private struct S
{
}
public string M()
{
S s;
var a = "" + s; // "Inline temporary variable" for a
return a;
}
}Run "Inline temporary variable" for a.
Expected Behavior:
public class C
{
private struct S
{
}
public string M()
{
S s;
// "Inline temporary variable" for a
return "" + s;
}
}Actual Behavior:
public class C
{
private struct S
{
}
public string M()
{
S s;
// "Inline temporary variable" for a
return (string?)("" + s);
}
}The refactoring introduces a cast to (string?) even though neither a nor the return type were ever nullable.
On a related note: Is the comment trivia expected to stay where it is and not move to the return line?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-IDEBughelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Type
Projects
Status
Completed