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
[ASTScope] Match parent scopes in lookupCatchNode for brace stmts
Rather than looking for a given BraceStmtScope child for a particular
catch node, check whether the given catch node is the parent of the
innermost BraceStmtScope we've found, looking through an intermediate
source file if needed. This ensures it works correctly when the
BraceStmtScope is in a macro expansion.
rdar://149036108
Copy file name to clipboardExpand all lines: test/Macros/macro_expand.swift
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -134,6 +134,19 @@ class HasStoredPropertyClassInvalid {
134
134
#AddStoredProperty((Self.self,0).1) // expected-note {{in expansion of macro 'AddStoredProperty' here}}
135
135
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-2]]_2_33_{{.*}}AddStoredPropertyfMf_.swift:1:22: error: covariant 'Self' type cannot be referenced from a stored property initializer
136
136
}
137
+
138
+
@attached(body)
139
+
public macro ThrowCancellation()= #externalMacro(module:"MacroDefinition", type:"ThrowCancellationMacro")
140
+
141
+
// https://github.com/swiftlang/swift/issues/79039 - Make sure we diagnose the
142
+
// error mismatch.
143
+
@ThrowCancellation // expected-note {{in expansion of macro 'ThrowCancellation' on global function 'issue79039()' here}}
144
+
func issue79039()throws(DecodingError)
145
+
// CHECK-DIAGS: @__swiftmacro_9MacroUser10issue7903917ThrowCancellationfMb_.swift:2:11: error: thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'
146
+
147
+
@ThrowCancellation // expected-note {{in expansion of macro 'ThrowCancellation' on global function 'issue79039_2()' here}}
148
+
func issue79039_2()throws(DecodingError){}
149
+
// CHECK-DIAGS: @__swiftmacro_9MacroUser12issue79039_217ThrowCancellationfMb_.swift:2:11: error: thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'
0 commit comments