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
@@ -100,3 +100,28 @@ _ = #trailingClosure {
100
100
// 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
101
101
// 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
102
102
}
103
+
104
+
// rdar://138997009 - Make sure we don't crash in MiscDiagnostics' implicit
105
+
// self diagnosis.
106
+
structrdar138997009{
107
+
func foo(){}
108
+
func bar(){
109
+
_ ={
110
+
_ = #trailingClosure{
111
+
foo()
112
+
}
113
+
}
114
+
}
115
+
}
116
+
117
+
classrdar138997009_Class{
118
+
func foo(){}
119
+
func bar(){
120
+
_ ={
121
+
_ = #trailingClosure{
122
+
foo()
123
+
// 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