Skip to content

Commit 2c415d0

Browse files
authored
Merge pull request #4237 from benlangmuir/fixits-swift3
[fixcode] Enable ( as AnyObject) and protocol<...> fixits
2 parents 611c6be + 41eaca6 commit 2c415d0

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,11 @@ 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 ||
640+
Info.ID == diag::deprecated_protocol_composition.ID ||
641+
Info.ID == diag::deprecated_protocol_composition_single.ID ||
642+
Info.ID == diag::deprecated_any_composition.ID)
639643
return true;
640644

641645
return false;

test/FixCode/fixits-apply.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,13 @@ enum E {
226226
case abc
227227
}
228228
func testEnumRename() { _ = E.Abc }
229+
230+
func testAnyToAnyObject(x: Any) {
231+
x.instMeth(p: 1)
232+
}
233+
234+
func testProtocolCompositionSyntax() {
235+
var _: protocol<>
236+
var _: protocol<Prot1>
237+
var _: protocol<Prot1, Prot2>
238+
}

test/FixCode/fixits-apply.swift.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,13 @@ enum E {
229229
case abc
230230
}
231231
func testEnumRename() { _ = E.Abc }
232+
233+
func testAnyToAnyObject(x: Any) {
234+
(x as AnyObject).instMeth(p: 1)
235+
}
236+
237+
func testProtocolCompositionSyntax() {
238+
var _: Any
239+
var _: Prot1
240+
var _: Prot1 & Prot2
241+
}

0 commit comments

Comments
 (0)