Reporter | Lilia Shamsutdinova (Lilia.Shamsutdinova) |
---|---|
Created | Apr 23, 2018 11:49:24 AM |
Updated | Apr 23, 2018 11:49:24 AM |
Subsystem | Quick Fixes |
Assignee | Andrew Karpov (andrew.karpov) |
Priority | Major |
State | Submitted |
Type | Bug |
Fix version | 2018.2 |
Affected versions | 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | VS 2017 RTM, VS 2015 RTM |
JetBrains ReSharper Ultimate 2018.1.1 12.0.20180422.220528-eap01d.
Class2.cs
public partial class Class2
{
private string nammm;
public string Name { get; }
public string CoolName { get; set; }
public string LastName { get; set; }
public string LastName2 { get; set; }
public string LastName3 { get; set; }
public string LastName4 { get; set; }
public string LastName5 { get; set; }
public string LastName6 { get; set; }
public Class2(string name, string last_name6) : this(name, "", last_name6)
{
}
public Class2(string cool_name, string last_name, string last_name6) : this(cool_name, last_name, "",
last_name6)
{
}
public Class2(string cool_name, string last_name, string last_name2, string last_name6) : this(cool_name,
last_name, last_name2, "", "", last_name6)
{
}
public Class2(string cool_name, string last_name, string last_name2, string last_name3, string last_name4,
string last_name6) : this(cool_name, last_name, last_name2, last_name3, last_name4, "", last_name6)
{
}
}
Class2.Partial.cs
public partial class Class2
{
public Class2(string cool_name, string last_name, string last_name2, string last_name3, string last_name4,
string last_name5, string last_name6)
{
Name = cool_name;
CoolName = cool_name;
LastName = last_name;
LastName2 = last_name2;
LastName3 = last_name3;
LastName4 = last_name4;
LastName5 = last_name5;
LastName6 = last_name6;
Gif with steps is attached. Test solution is attached.
- Invoke "Initialize field from constructor" QF on
private string nammm
.
Actual result:
- If solution is just created then the following uncompilable code is generated:
Class2.cs
public partial class Class2
{
private string nammm;
public string Name { get; }
public string CoolName { get; set; }
public string LastName { get; set; }
public string LastName2 { get; set; }
public string LastName3 { get; set; }
public string LastName4 { get; set; }
public string LastName5 { get; set; }
public string LastName6 { get; set; }
public Class2(string name, string last_name6) : this(name, "", last_name6, nammm)
{
}
public Class2(string cool_name, string last_name, string last_name6) : this(cool_name, last_name, "",
last_name6, nammm)
{
}
public Class2(string cool_name, string last_name, string last_name2, string last_name6) : this(cool_name,
last_name, last_name2, "", "", last_name6, nammm)
{
}
public Class2(string cool_name, string last_name, string last_name2, string last_name3, string last_name4,
string last_name6) : this(cool_name, last_name, last_name2, last_name3, last_name4, "", last_name6, nammm)
{
}
}
Class2.Partial.cs
public partial class Class2
{
public Class2(string cool_name, string last_name, string last_name2, string last_name3, string last_name4,
string last_name5, string last_name6, string nammm)
{
this.nammm = nammm;
Name = cool_name;
CoolName = cool_name;
LastName = last_name;
LastName2 = last_name2;
LastName3 = last_name3;
LastName4 = last_name4;
LastName5 = last_name5;
LastName6 = last_name6;
}
}
The same occurred sometimes when solution is just opened.
- After build/save the following uncompilable code is generated:
Class2.cs
public partial class Class2
{
private string nammm;
public string Name { get; }
public string CoolName { get; set; }
public string LastName { get; set; }
public string LastName2 { get; set; }
public string LastName3 { get; set; }
public string LastName4 { get; set; }
public string LastName5 { get; set; }
public string LastName6 { get; set; }
public Class2(string name, string last_name6, string nammm) : this(name, "", last_name6, nammm)
{
}
public Class2(string cool_name, string last_name, string last_name6, string nammm) : this(cool_name, last_name, "",
last_name6, nammm)
{
}
public Class2(string cool_name, string last_name, string last_name2, string last_name6, string nammm) : this(cool_name,
last_name, last_name2, "", "", last_name6, nammm)
{
}
public Class2(string cool_name, string last_name, string last_name2, string last_name3, string last_name4,
string last_name6, string nammm) : this(cool_name, last_name, last_name2, last_name3, last_name4, "", last_name6, nammm)
{
}
}
Class2.Partial.cs
public partial class Class2
{
public Class2(string cool_name, string last_name, string last_name2, string last_name3, string last_name4,
string last_name5, string last_name6)
{
Name = cool_name;
CoolName = cool_name;
LastName = last_name;
LastName2 = last_name2;
LastName3 = last_name3;
LastName4 = last_name4;
LastName5 = last_name5;
LastName6 = last_name6;
}
}
Expected result:
Compilable code: