Skip to content

Commit 895dc90

Browse files
committed
[FixCode] Disable a migrating fixit that interacts badly with the migrator.
For such code: func test(p: Int, _: String) {} test(0, "") the compiler bizarrely suggests to change order of arguments in the call site.
1 parent bb5f1e8 commit 895dc90

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,13 @@ class JSONFixitWriter : public DiagnosticConsumer {
598598
if (Info.ID == diag::objc_witness_selector_mismatch.ID ||
599599
Info.ID == diag::witness_non_objc.ID)
600600
return false;
601+
// This interacts badly with the migrator. For such code:
602+
// func test(p: Int, _: String) {}
603+
// test(0, "")
604+
// the compiler bizarrely suggests to change order of arguments in the call
605+
// site.
606+
if (Info.ID == diag::argument_out_of_order_unnamed_unnamed.ID)
607+
return false;
601608
// The following interact badly with the swift migrator by removing @IB*
602609
// attributes when there is some unrelated type issue.
603610
if (Info.ID == diag::invalid_iboutlet.ID ||

test/FixCode/fixits-apply.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,6 @@ func testProtocolCompositionSyntax() {
256256
var _: protocol<Prot1>
257257
var _: protocol<Prot1, Prot2>
258258
}
259+
260+
func disable_unnamed_param_reorder(p: Int, _: String) {}
261+
disable_unnamed_param_reorder(0, "") // no change.

test/FixCode/fixits-apply.swift.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,6 @@ func testProtocolCompositionSyntax() {
259259
var _: Prot1
260260
var _: Prot1 & Prot2
261261
}
262+
263+
func disable_unnamed_param_reorder(p: Int, _: String) {}
264+
disable_unnamed_param_reorder(0, "") // no change.

0 commit comments

Comments
 (0)