Skip to content

Commit 3f026be

Browse files
committed
[FixCode] Don't add .dynamicType
Adding .dynamicType interacts poorly with the swift migrator by invalidating some inits with type errors. rdar://problem/26642062
1 parent d5d48f3 commit 3f026be

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,10 @@ class JSONFixitWriter : public DiagnosticConsumer {
580580
Info.ID == diag::invalid_ibinspectable.ID ||
581581
Info.ID == diag::invalid_ibaction_decl.ID)
582582
return false;
583+
// Adding .dynamicType interacts poorly with the swift migrator by
584+
// invalidating some inits with type errors.
585+
if (Info.ID == diag::init_not_instance_member.ID)
586+
return false;
583587

584588
if (Kind == DiagnosticKind::Error)
585589
return true;

test/FixCode/fixits-apply.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,10 @@ protocol NonObjCProtocol {}
197197
@IBDesignable extension SomeProt {}
198198

199199
func attrNowOnType(@noescape foo: ()->()) {}
200+
201+
class InitDynType {
202+
init() {}
203+
func notInit() {
204+
self.init()
205+
}
206+
}

test/FixCode/fixits-apply.swift.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,10 @@ protocol NonObjCProtocol {}
200200
@IBDesignable extension SomeProt {}
201201

202202
func attrNowOnType(foo: @noescape ()->()) {}
203+
204+
class InitDynType {
205+
init() {}
206+
func notInit() {
207+
self.init()
208+
}
209+
}

0 commit comments

Comments
 (0)