-
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
Do syntactic cleanup during the initial pass of producing fixed documents in fix-all. #73383
Changes from all commits
e335215
6c4bdf0
ed3233d
e54a2a6
81ec64d
ff73955
40bc0bc
882f389
3253698
20ed180
3eee53e
10a82a1
3a8fc26
69ad1e2
e8a21ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,6 @@ class C | |
void Goo() | ||
{ | ||
a?.Invoke(); | ||
|
||
a?.Invoke(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these changed because the code that was generated was |
||
} | ||
} | ||
|
@@ -86,7 +85,6 @@ class C | |
void Goo() | ||
{ | ||
a?.Invoke(); | ||
|
||
a?.Invoke(); | ||
} | ||
} | ||
|
@@ -126,7 +124,6 @@ class C | |
void Goo() | ||
{ | ||
a?.Invoke(); | ||
|
||
a?.Invoke(); | ||
} | ||
} | ||
|
@@ -166,7 +163,6 @@ class C | |
void Goo() | ||
{ | ||
a?.Invoke(); | ||
|
||
a?.Invoke(); | ||
} | ||
} | ||
|
@@ -206,7 +202,6 @@ class C | |
void Goo() | ||
{ | ||
a?.Invoke(); | ||
|
||
a?.Invoke(); | ||
} | ||
} | ||
|
@@ -246,7 +241,6 @@ class C | |
void Goo() | ||
{ | ||
a?.Invoke(); | ||
|
||
a?.Invoke(); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -902,7 +902,8 @@ class C | |
{ | ||
public void M1() | ||
{ | ||
Func<int, Task> foo = x => { | ||
Func<int, Task> foo = x => | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the correct formatting ew want. the previous results were undesirable. |
||
if (System.DateTime.Now.Ticks > 0) | ||
{ | ||
return Task.CompletedTask; | ||
|
@@ -1040,7 +1041,8 @@ class C | |
{ | ||
public void M1() | ||
{ | ||
Func<Task> foo = () => { | ||
Func<Task> foo = () => | ||
{ | ||
if (System.DateTime.Now.Ticks > 0) | ||
{ | ||
return Task.CompletedTask; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ class C | |
{ | ||
void M(int? x, int? y) | ||
{ | ||
var z = x ?? y ; | ||
var z = x ?? y; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same. the old results were undesirable. |
||
} | ||
} | ||
"""); | ||
|
@@ -105,7 +105,7 @@ class C | |
{ | ||
void M(int? x, int? y) | ||
{ | ||
var z = (x + y) ?? y ; | ||
var z = (x + y) ?? y; | ||
} | ||
} | ||
"""); | ||
|
@@ -163,7 +163,7 @@ class C | |
void M(int? x, int? y) | ||
{ | ||
var z1 = x ?? y; | ||
var z2 = x ?? y ; | ||
var z2 = x ?? y; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixed an issue here where we had errant whitespace. |
||
} | ||
} | ||
"""); | ||
|
@@ -249,7 +249,7 @@ class C | |
{ | ||
void M(int? x, int? y) | ||
{ | ||
Expression<Func<int>> e = () => {|Warning:x ?? y|} ; | ||
Expression<Func<int>> e = () => {|Warning:x ?? y|}; | ||
} | ||
} | ||
"""); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4156,10 +4156,10 @@ List<int> M(IEnumerable<int> nums) | |
return /*30*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5 | ||
/*31*//* 6 */ | ||
(from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13 | ||
/* 14 */// 15 | ||
/* 16 *//* 17 */ | ||
let y /* 18 */ = /* 19 */ x + 1/* 20 *///21 | ||
select y)/* 24 *//*27*///28 | ||
/* 14 */// 15 | ||
/* 16 *//* 17 */ | ||
let y /* 18 */ = /* 19 */ x + 1/* 20 *///21 | ||
select y)/* 24 *//*27*///28 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these results are expected. the other clauses align with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aside; these tests are insane. they don't reflect any sort of real code, and it's nigh impossible to reason about them. |
||
.ToList()/* 22 *//* 23 *//* 25 *///26 | ||
; //32 | ||
} | ||
|
@@ -4205,7 +4205,7 @@ List<int> M(IEnumerable<int> nums) | |
/*25*//* 14 */// 15 | ||
/* 6 */ | ||
(from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13 | ||
select x + 1)/* 18 *//*21*///22 | ||
select x + 1)/* 18 *//*21*///22 | ||
.ToList()/* 16 *//* 17 *//* 19 *///20 | ||
; //26 | ||
} | ||
|
@@ -4223,7 +4223,8 @@ List<int> M(IEnumerable<int> nums) | |
{ | ||
/*23*/ | ||
return /*24*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5 | ||
/*25*/nums /* 12 */.Select( | ||
/*25*/ | ||
nums /* 12 */.Select( | ||
/* 6 *//* 7 *//* 14 */// 15 | ||
/* 9 */x /* 10 */ => x + 1/* 18 *//*21*///22 | ||
/* 8 *//* 11 */// 13 | ||
|
@@ -4268,7 +4269,7 @@ int M(IEnumerable<int> nums) | |
/*23*//* 14 */// 15 | ||
/* 6 */ | ||
(from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13 | ||
select x)/* 10 *//*19*///20 | ||
select x)/* 10 *//*19*///20 | ||
.Count()/* 16 *//* 17 *///18 | ||
; //24 | ||
} | ||
|
@@ -4286,7 +4287,8 @@ int M(IEnumerable<int> nums) | |
{ | ||
/*21*/ | ||
return /*22*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5 | ||
/*23*/nums /* 12 *//* 6 *//* 7 *//* 14 */// 15 | ||
/*23*/ | ||
nums /* 12 *//* 6 *//* 7 *//* 14 */// 15 | ||
/* 9 *//* 10 *//* 10 *//*19*///20 | ||
/* 8 *//* 11 */// 13 | ||
.Count()/* 16 *//* 17 *///18 | ||
|
@@ -4328,11 +4330,11 @@ void M(IEnumerable<int> nums) | |
{ | ||
foreach (var (a /* 12 */ , b /*16*/ ) in | ||
/* 1 */from/* 2 */int /* 3 */ n1 /* 4 */in/* 5 */nums/* 6 */// 7 | ||
/* 8*/// 9 | ||
/* 10 *//* 11 */ | ||
let a /* 12 */ = /* 13 */ n1 + n1/* 14*//* 15 */ | ||
let b /*16*/ = /*17*/ n1 * n1/*18*///19 | ||
select (a /* 12 */ , b /*16*/ )/*22*//*23*/) | ||
/* 8*/// 9 | ||
/* 10 *//* 11 */ | ||
let a /* 12 */ = /* 13 */ n1 + n1/* 14*//* 15 */ | ||
let b /*16*/ = /*17*/ n1 * n1/*18*///19 | ||
select (a /* 12 */ , b /*16*/ )/*22*//*23*/) | ||
{ | ||
/*20*/ | ||
Console.WriteLine(a + b);//21 | ||
|
@@ -4384,7 +4386,7 @@ void M(IEnumerable<int> nums) | |
/* 10 */ | ||
where/* 11 *//* 12 */n1 /* 13 */ > /* 14 */ 0/* 15 */// 16 | ||
select n1/* 4 *//* 21 */// 22 | ||
/*23*//*24*/ | ||
/*23*//*24*/ | ||
) | ||
{ | ||
/*19*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
using Microsoft.CodeAnalysis.CodeRefactorings; | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary; | ||
using Microsoft.CodeAnalysis.CSharp.Shared.Extensions; | ||
using Microsoft.CodeAnalysis.CSharp.Test.Utilities; | ||
using Microsoft.CodeAnalysis.Test.Utilities; | ||
using Microsoft.CodeAnalysis.UnitTests; | ||
|
@@ -16,7 +15,7 @@ | |
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings.InlineTemporary | ||
{ | ||
[Trait(Traits.Feature, Traits.Features.CodeActionsInlineTemporary)] | ||
public class InlineTemporaryTests : AbstractCSharpCodeActionTest_NoEditor | ||
public sealed class InlineTemporaryTests : AbstractCSharpCodeActionTest_NoEditor | ||
{ | ||
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(TestWorkspace workspace, TestParameters parameters) | ||
=> new CSharpInlineTemporaryCodeRefactoringProvider(); | ||
|
@@ -253,16 +252,23 @@ public void M() | |
[Fact] | ||
public async Task Conversion_NoConversion() | ||
{ | ||
await TestFixOneAsync( | ||
await TestAsync( | ||
""" | ||
{ int [||]x = 3; | ||
class C | ||
{ | ||
void F(){ int [||]x = 3; | ||
|
||
x.ToString(); } | ||
} | ||
""", | ||
""" | ||
class C | ||
{ | ||
void F(){ | ||
3.ToString(); } | ||
} | ||
""", | ||
""" | ||
{ | ||
3.ToString(); } | ||
"""); | ||
CSharpParseOptions.Default); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test was impossible to understand in its original form (due to how it concats strings). The updated test shows the full code sample, and shows the desired behavior (we don't touch the |
||
} | ||
|
||
[Fact] | ||
|
@@ -690,7 +696,7 @@ class Program | |
static void Main() | ||
{ | ||
int x = 2; | ||
Bar(x < x, x > 1+2); | ||
Bar(x < x, x > 1 + 2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. formatting this now because it's parsed as an arithmetic + binexpr. |
||
} | ||
|
||
static void Bar(object a, object b) | ||
|
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.
fixing up the feature so it consistently emits
async
without messing with other trivia.