diff --git a/compiler/src/dotty/tools/backend/jvm/CodeGen.scala b/compiler/src/dotty/tools/backend/jvm/CodeGen.scala index c5b0ec0929b8..d4843cd56639 100644 --- a/compiler/src/dotty/tools/backend/jvm/CodeGen.scala +++ b/compiler/src/dotty/tools/backend/jvm/CodeGen.scala @@ -84,6 +84,7 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)( registerGeneratedClass(mirrorClassNode, isArtifact = true) catch case ex: InterruptedException => throw ex + case ex: CompilationUnit.SuspendException => throw ex case ex: Throwable => ex.printStackTrace() report.error(s"Error while emitting ${unit.source}\n${ex.getMessage}", NoSourcePosition) diff --git a/tests/pos-macros/i21983/Test.scala b/tests/pos-macros/i21983/Test.scala new file mode 100644 index 000000000000..bf008583c7d9 --- /dev/null +++ b/tests/pos-macros/i21983/Test.scala @@ -0,0 +1,13 @@ +package example + +sealed trait Test + +object Test { + case object Foo extends Test + + val visitorType = mkVisitorType[Test] + + trait Visitor[A] { + type V[a] = visitorType.Out[a] + } +} diff --git a/tests/pos-macros/i21983/UsesTest.scala b/tests/pos-macros/i21983/UsesTest.scala new file mode 100644 index 000000000000..803e93c328c9 --- /dev/null +++ b/tests/pos-macros/i21983/UsesTest.scala @@ -0,0 +1,3 @@ +package example + +val _ = Test.Foo diff --git a/tests/pos-macros/i21983/VisitorMacros.scala b/tests/pos-macros/i21983/VisitorMacros.scala new file mode 100644 index 000000000000..5a5cc453c525 --- /dev/null +++ b/tests/pos-macros/i21983/VisitorMacros.scala @@ -0,0 +1,13 @@ +package example + +import scala.deriving.Mirror +import scala.quoted.* + +private def mkVisitorTypeImpl[T: Type](using q: Quotes): Expr[VisitorType[T]] = + '{new VisitorType[T]{}} + +transparent inline def mkVisitorType[T]: VisitorType[T] = ${ mkVisitorTypeImpl[T] } + +trait VisitorType[T] { + type Out[A] +}