You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to expand macros in the middle of
CSApply can result in attempting to run
MiscDiagnostics within a closure that hasn't yet
had the solution applied to the AST, which can
crash the implicit-self diagnostic logic. Move
the expansion to the end of CSApply such that
expansions are type-checked along with local
decls, ensuring it's run after the solution has
been applied to the AST.
rdar://138997009
Copy file name to clipboardExpand all lines: test/Macros/macro_misc_diags.swift
+25Lines changed: 25 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -98,3 +98,28 @@ _ = #trailingClosure {
98
98
// CHECK-DIAG: Client.swift:[[@LINE-1]]:27: warning: trailing closure in this context is confusable with the body of the statement; pass as a parenthesized argument to silence this warning
99
99
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-4]]{{.*}}trailingClosurefMf_.swift:2:27: warning: trailing closure in this context is confusable with the body of the statement
100
100
}
101
+
102
+
// rdar://138997009 - Make sure we don't crash in MiscDiagnostics' implicit
103
+
// self diagnosis.
104
+
structrdar138997009{
105
+
func foo(){}
106
+
func bar(){
107
+
_ ={
108
+
_ = #trailingClosure{
109
+
foo()
110
+
}
111
+
}
112
+
}
113
+
}
114
+
115
+
classrdar138997009_Class{
116
+
func foo(){}
117
+
func bar(){
118
+
_ ={
119
+
_ = #trailingClosure{
120
+
foo()
121
+
// CHECK-DIAG: @__swiftmacro_6Client0017Clientswift_yEEFcfMX[[@LINE-3]]{{.*}}trailingClosurefMf_.swift:2:9: error: call to method 'foo' in closure requires explicit use of 'self' to make capture semantics explicit
0 commit comments