Skip to content

Ignore fixits for adding objc(selector) when doing migration, and fixits for mismatch label in overridden method #2734

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,13 @@ class JSONFixitWriter : public DiagnosticConsumer {
// The following interact badly with the swift migrator, they are undoing
// migration of arguments to preserve the no-label for first argument.
if (Info.ID == diag::witness_argument_name_mismatch.ID ||
Info.ID == diag::missing_argument_labels.ID)
Info.ID == diag::missing_argument_labels.ID ||
Info.ID == diag::override_argument_name_mismatch.ID)
return false;
// This also interacts badly with the swift migrator, it unnecessary adds
// @objc(selector) attributes triggered by the mismatched label changes.
if (Info.ID == diag::objc_witness_selector_mismatch.ID ||
Info.ID == diag::witness_non_objc.ID)
return false;

if (Kind == DiagnosticKind::Error)
Expand Down
12 changes: 11 additions & 1 deletion test/FixCode/fixits-apply.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,21 @@ func ftest2(x x: Int -> Int) {}
protocol SomeProt {
func protMeth(p: Int)
}
class Test2 : SomeProt {
@objc protocol SomeObjCProt {
func objcprotMeth(p: Int)
}
class Test2 : SomeProt, SomeObjCProt {
func protMeth(_ p: Int) {}

func instMeth(p: Int) {}
func instMeth2(p: Int, p2: Int) {}
func objcprotMeth(_ p: Int) {}
}
@objc class Test3 : SomeObjCProt {
func objcprotMeth(_ p: Int) {}
}
class SubTest2 : Test2 {
override func instMeth(_ p: Int) {}
}
Test2().instMeth(0)
Test2().instMeth2(0, p2:1)
12 changes: 11 additions & 1 deletion test/FixCode/fixits-apply.swift.result
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,21 @@ func ftest2(x: (Int) -> Int) {}
protocol SomeProt {
func protMeth(p: Int)
}
class Test2 : SomeProt {
@objc protocol SomeObjCProt {
func objcprotMeth(p: Int)
}
class Test2 : SomeProt, SomeObjCProt {
func protMeth(_ p: Int) {}

func instMeth(p: Int) {}
func instMeth2(p: Int, p2: Int) {}
func objcprotMeth(_ p: Int) {}
}
@objc class Test3 : SomeObjCProt {
func objcprotMeth(_ p: Int) {}
}
class SubTest2 : Test2 {
override func instMeth(_ p: Int) {}
}
Test2().instMeth(0)
Test2().instMeth2(0, p2:1)