Skip to content

Commit 008a57f

Browse files
authored
Merge pull request #4205 from benlangmuir/fixit-anyobject
[fixcode] Add ( as AnyObject) fixit to the whitelist
2 parents 3cdba7b + 454ee8a commit 008a57f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ class JSONFixitWriter : public DiagnosticConsumer {
635635
Info.ID == diag::selector_construction_suggest.ID ||
636636
Info.ID == diag::selector_literal_deprecated_suggest.ID ||
637637
Info.ID == diag::attr_noescape_deprecated.ID ||
638-
Info.ID == diag::attr_autoclosure_escaping_deprecated.ID)
638+
Info.ID == diag::attr_autoclosure_escaping_deprecated.ID ||
639+
Info.ID == diag::any_as_anyobject_fixit.ID)
639640
return true;
640641

641642
return false;

test/FixCode/fixits-apply.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,7 @@ enum E {
236236
case abc
237237
}
238238
func testEnumRename() { _ = E.Abc }
239+
240+
func testAnyToAnyObject(x: Any) {
241+
x.instMeth(p: 1)
242+
}

test/FixCode/fixits-apply.swift.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,7 @@ enum E {
239239
case abc
240240
}
241241
func testEnumRename() { _ = E.Abc }
242+
243+
func testAnyToAnyObject(x: Any) {
244+
(x as AnyObject).instMeth(p: 1)
245+
}

0 commit comments

Comments
 (0)