Skip to content

Commit 64ca149

Browse files
authored
Merge pull request #114 from scala/backport-lts-3.3-21969
Backport "Allow macro annotations to recover from suspension" to 3.3 LTS
2 parents 156f685 + 17bdc14 commit 64ca149

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/transform/MacroAnnotations.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class MacroAnnotations:
6060
// Replace this case with the nested cases.
6161
case ex0: InvocationTargetException =>
6262
ex0.getCause match
63+
case ex: CompilationUnit.SuspendException =>
64+
throw ex
6365
case ex: scala.quoted.runtime.StopMacroExpansion =>
6466
if !ctx.reporter.hasErrors then
6567
report.error("Macro expansion was aborted by the macro without any errors reported. Macros should issue errors to end-users when aborting a macro expansion with StopMacroExpansion.", annot.tree)

tests/neg-macros/annot-crash.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- Error: tests/neg-macros/annot-crash/Test_2.scala:1:0 ----------------------------------------------------------------
33
1 |@crash // error
44
|^^^^^^
5-
|Failed to evaluate macro.
5+
|Failed to evaluate macro annotation '@crash'.
66
| Caused by class scala.NotImplementedError: an implementation is missing
77
| scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
88
| crash.transform(Macro_1.scala:7)

0 commit comments

Comments
 (0)