Skip to content

Commit 31b04da

Browse files
authored
Merge pull request #3929 from akyrtzi/fixcode-note-escaping
[FixCode] Make sure to accept the fixit in note about adding '@escapi
2 parents d120638 + 92c0980 commit 31b04da

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ class JSONFixitWriter : public DiagnosticConsumer {
601601
Info.ID == diag::convert_let_to_var.ID ||
602602
Info.ID == diag::parameter_extraneous_double_up.ID ||
603603
Info.ID == diag::attr_decl_attr_now_on_type.ID ||
604+
Info.ID == diag::noescape_parameter.ID ||
605+
Info.ID == diag::noescape_autoclosure.ID ||
606+
Info.ID == diag::where_inside_brackets.ID ||
604607
Info.ID == diag::selector_construction_suggest.ID ||
605608
Info.ID == diag::selector_literal_deprecated_suggest.ID)
606609
return true;

test/FixCode/fixits-apply.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,15 @@ class NoSemi {
209209
enum Bar { case bar }
210210
var foo: .Bar = .bar
211211
}
212+
213+
func fnWithClosure(c: @escaping ()->()) {}
214+
func testescape(rec: ()->()) {
215+
fnWithClosure { rec() }
216+
}
217+
218+
protocol Prot1 {}
219+
protocol Prot2 {
220+
associatedtype Ty = Prot1
221+
}
222+
class Cls1 : Prot1 {}
223+
func testwhere<T: Prot2 where T.Ty == Cls1>(_: T) {}

test/FixCode/fixits-apply.swift.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,15 @@ class NoSemi {
212212
enum Bar { case bar }
213213
var foo: .Bar = .bar
214214
}
215+
216+
func fnWithClosure(c: @escaping ()->()) {}
217+
func testescape(rec: @escaping ()->()) {
218+
fnWithClosure { rec() }
219+
}
220+
221+
protocol Prot1 {}
222+
protocol Prot2 {
223+
associatedtype Ty = Prot1
224+
}
225+
class Cls1 : Prot1 {}
226+
func testwhere<T: Prot2>(_: T) where T.Ty == Cls1 {}

0 commit comments

Comments
 (0)