Skip to content

Commit b4a2b53

Browse files
committed
[FixCode] When picking-up fixits for migration ignore argument label fixits.
These interact badly with the swift migrator, they are undoing migration of arguments to preserve the no-label for first argument.
1 parent 54966d5 commit b4a2b53

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ class JSONFixitWriter : public DiagnosticConsumer {
557557
// Do not add a semi as it is wrong in most cases during migration
558558
if (Info.ID == diag::statement_same_line_without_semi.ID)
559559
return false;
560+
// The following interact badly with the swift migrator, they are undoing
561+
// migration of arguments to preserve the no-label for first argument.
562+
if (Info.ID == diag::witness_argument_name_mismatch.ID ||
563+
Info.ID == diag::missing_argument_labels.ID)
564+
return false;
560565

561566
if (Kind == DiagnosticKind::Error)
562567
return true;

test/FixCode/fixits-apply.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,15 @@ func ftest1() {
6464
}
6565

6666
func ftest2(x x: Int -> Int) {}
67+
68+
protocol SomeProt {
69+
func protMeth(p: Int)
70+
}
71+
class Test2 : SomeProt {
72+
func protMeth(_ p: Int)
73+
74+
func instMeth(p: Int)
75+
func instMeth2(p: Int, p2: Int)
76+
}
77+
Test2().instMeth(0)
78+
Test2().instMeth2(0, p2:1)

test/FixCode/fixits-apply.swift.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,15 @@ func ftest1() {
6767
}
6868

6969
func ftest2(x: (Int) -> Int) {}
70+
71+
protocol SomeProt {
72+
func protMeth(p: Int)
73+
}
74+
class Test2 : SomeProt {
75+
func protMeth(_ p: Int)
76+
77+
func instMeth(p: Int)
78+
func instMeth2(p: Int, p2: Int)
79+
}
80+
Test2().instMeth(0)
81+
Test2().instMeth2(0, p2:1)

0 commit comments

Comments
 (0)