Skip to content

Commit 9865ceb

Browse files
authored
Merge pull request #4197 from nkcsgexi/migrator-fixit
[FixCode] Blacklist the fixit for enum case renames for migrator
2 parents 2fd6233 + 1f0fb06 commit 9865ceb

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,10 @@ class JSONFixitWriter : public DiagnosticConsumer {
613613
// invalidating some inits with type errors.
614614
if (Info.ID == diag::init_not_instance_member.ID)
615615
return false;
616+
// Renaming enum cases interacts poorly with the swift migrator by
617+
// reverting changes made by the mgirator.
618+
if (Info.ID == diag::could_not_find_enum_case.ID)
619+
return false;
616620

617621
if (Kind == DiagnosticKind::Error)
618622
return true;

test/FixCode/fixits-apply.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,8 @@ protocol Prot2 {
221221
}
222222
class Cls1 : Prot1 {}
223223
func testwhere<T: Prot2 where T.Ty == Cls1>(_: T) {}
224+
225+
enum E {
226+
case abc
227+
}
228+
func testEnumRename() { _ = E.Abc }

test/FixCode/fixits-apply.swift.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,8 @@ protocol Prot2 {
224224
}
225225
class Cls1 : Prot1 {}
226226
func testwhere<T: Prot2>(_: T) where T.Ty == Cls1 {}
227+
228+
enum E {
229+
case abc
230+
}
231+
func testEnumRename() { _ = E.Abc }

0 commit comments

Comments
 (0)