Skip to content

Commit ec539d6

Browse files
committed
[fixcode] Enabled protocol<...> fixits
The old syntax is deprecated in swift 3, and these fixits seem quite safe, so apply them for migration. rdar://problem/27794981
1 parent a33203f commit ec539d6

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

lib/FrontendTool/FrontendTool.cpp

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

641644
return false;

test/FixCode/fixits-apply.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,9 @@ enum E {
236236
case abc
237237
}
238238
func testEnumRename() { _ = E.Abc }
239+
240+
func testProtocolCompositionSyntax() {
241+
var _: protocol<>
242+
var _: protocol<Prot1>
243+
var _: protocol<Prot1, Prot2>
244+
}

test/FixCode/fixits-apply.swift.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,9 @@ enum E {
239239
case abc
240240
}
241241
func testEnumRename() { _ = E.Abc }
242+
243+
func testProtocolCompositionSyntax() {
244+
var _: Any
245+
var _: Prot1
246+
var _: Prot1 & Prot2
247+
}

0 commit comments

Comments
 (0)