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
+12
Original file line number
Diff line number
Diff line change
@@ -152,6 +152,18 @@ struct RedeclChecking {
152
152
// CHECK-DIAGS: }
153
153
// CHECK-DIAGS: END CONTENTS OF FILE
154
154
155
+
@attached(body)
156
+
public macro ThrowCancellation()= #externalMacro(module:"MacroDefinition", type:"ThrowCancellationMacro")
157
+
158
+
// https://github.com/swiftlang/swift/issues/79039 - Make sure we diagnose the
159
+
// error mismatch.
160
+
@ThrowCancellation // expected-note {{in expansion of macro 'ThrowCancellation' on global function 'issue79039()' here}}
161
+
func issue79039()throws(DecodingError)
162
+
// CHECK-DIAGS: @__swiftmacro_9MacroUser10issue7903917ThrowCancellationfMb_.swift:2:11: error: thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'
163
+
164
+
@ThrowCancellation // expected-note {{in expansion of macro 'ThrowCancellation' on global function 'issue79039_2()' here}}
165
+
func issue79039_2()throws(DecodingError){}
166
+
// CHECK-DIAGS: @__swiftmacro_9MacroUser12issue79039_217ThrowCancellationfMb_.swift:2:11: error: thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'
0 commit comments