Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompilationUnit.SuspendException during CodeGen #21983

Closed
mrdziuban opened this issue Nov 19, 2024 · 2 comments · Fixed by #22009
Closed

CompilationUnit.SuspendException during CodeGen #21983

mrdziuban opened this issue Nov 19, 2024 · 2 comments · Fixed by #22009
Assignees
Labels
area:metaprogramming:other Issues tied to metaprogramming/macros not covered by the other labels. itype:bug itype:crash

Comments

@mrdziuban
Copy link

Compiler version

Reproduced on 3.4.3, 3.5.2, and the latest nightly 3.6.3-RC1-bin-20241119-cc4a324-NIGHTLY

Minimized code

https://github.com/mrdziuban/scala3-suspend-exception

The README there describes the 4 files involved, they're all pretty minimal. The most complex, and I think the one most likely related to the issue, is VisitorMacros.scala.

Output (click arrow to expand)

dotty.tools.dotc.CompilationUnit$SuspendException
Error while emitting /Users/matt/scala3-suspend-exception/src/main/scala/example/UsesTest.scala
null

I patched the compiler to remove NoStackTrace from SuspendException and got this:

dotty.tools.dotc.CompilationUnit$SuspendException
  at dotty.tools.dotc.CompilationUnit.suspend(CompilationUnit.scala:110)
  at dotty.tools.dotc.typer.Namer$SuspendCompleter.complete(Namer.scala:1746)
  at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:865)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
  at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
  at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:66)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.isOneOf(SymDenotations.scala:116)
  at dotty.tools.dotc.core.SymDenotations$SymDenotation.isEffectivelyErased(SymDenotations.scala:1033)
  at dotty.tools.dotc.transform.PruneErasedDefs.transformSym(PruneErasedDefs.scala:39)
  at dotty.tools.dotc.core.DenotTransformers$SymTransformer.transform(DenotTransformers.scala:72)
  at dotty.tools.dotc.core.DenotTransformers$SymTransformer.transform$(DenotTransformers.scala:67)
  at dotty.tools.dotc.transform.PruneErasedDefs.transform(PruneErasedDefs.scala:26)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:838)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:124)
  at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:118)
  at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
  at dotty.tools.dotc.core.Symbols$Symbol.name(Symbols.scala:277)
  at dotty.tools.dotc.core.Scopes$MutableScope.unlink(Scopes.scala:348)
  at dotty.tools.dotc.core.Scopes$Scope.drop$1(Scopes.scala:174)
  at dotty.tools.dotc.core.Scopes$Scope.filteredScope$$anonfun$1(Scopes.scala:181)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619)
  at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617)
  at scala.collection.AbstractIterator.foreach(Iterator.scala:1303)
  at dotty.tools.dotc.core.Scopes$Scope.filteredScope(Scopes.scala:171)
  at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$apply(TypeErasure.scala:739)
  at dotty.tools.dotc.core.TypeErasure.eraseInfo(TypeErasure.scala:825)
  at dotty.tools.dotc.core.TypeErasure$.transformInfo(TypeErasure.scala:277)
  at dotty.tools.dotc.transform.Erasure.transform(Erasure.scala:99)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:838)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:855)
  at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:884)
  at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:124)
  at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:118)
  at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:109)
  at dotty.tools.dotc.core.Symbols$.toDenot(Symbols.scala:544)
  at dotty.tools.backend.jvm.BTypesFromSymbols.definedClasses$$anonfun$1(BTypesFromSymbols.scala:197)
  at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:103)
  at dotty.tools.backend.jvm.BTypesFromSymbols.definedClasses(BTypesFromSymbols.scala:197)
  at dotty.tools.backend.jvm.BTypesFromSymbols.getMemberClasses(BTypesFromSymbols.scala:192)
  at dotty.tools.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:152)
  at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol$$anonfun$1(BTypesFromSymbols.scala:65)
  at scala.collection.mutable.HashMap.getOrElse(HashMap.scala:451)
  at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:66)
  at dotty.tools.backend.jvm.BTypesFromSymbols.$anonfun$4(BTypesFromSymbols.scala:124)
  at scala.collection.immutable.List.map(List.scala:247)
  at dotty.tools.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:124)
  at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol$$anonfun$1(BTypesFromSymbols.scala:65)
  at scala.collection.mutable.HashMap.getOrElse(HashMap.scala:451)
  at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:66)
  at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.getClassBType(BCodeHelpers.scala:178)
  at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.getClassBType$(BCodeHelpers.scala:130)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.getClassBType(BCodeSkelBuilder.scala:134)
  at dotty.tools.backend.jvm.BCodeHelpers.primitiveOrClassToBType$1$$anonfun$1(BCodeHelpers.scala:718)
  at scala.collection.immutable.HashMap.getOrElse(HashMap.scala:722)
  at dotty.tools.backend.jvm.BCodeHelpers.primitiveOrClassToBType$1(BCodeHelpers.scala:718)
  at dotty.tools.backend.jvm.BCodeHelpers.dotty$tools$backend$jvm$BCodeHelpers$$typeToTypeKind(BCodeHelpers.scala:737)
  at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind(BCodeHelpers.scala:202)
  at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind$(BCodeHelpers.scala:130)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.toTypeKind(BCodeSkelBuilder.scala:134)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.symInfoTK(BCodeSkelBuilder.scala:163)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder$locals$.makeLocal(BCodeSkelBuilder.scala:542)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder$locals$.getOrMakeLocal$$anonfun$1(BCodeSkelBuilder.scala:547)
  at scala.collection.mutable.AnyRefMap.getOrElse(AnyRefMap.scala:157)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder$locals$.getOrMakeLocal(BCodeSkelBuilder.scala:547)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:317)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:303)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:117)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlockTo$$anonfun$1(BCodeBodyBuilder.scala:1093)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.immutable.List.foreach(List.scala:334)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlockTo(BCodeBodyBuilder.scala:1093)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:457)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:303)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLabeledTo(BCodeBodyBuilder.scala:606)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:333)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:303)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:117)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlockTo$$anonfun$1(BCodeBodyBuilder.scala:1093)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.immutable.List.foreach(List.scala:334)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlockTo(BCodeBodyBuilder.scala:1093)
  at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadTo(BCodeBodyBuilder.scala:457)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:899)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:922)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:699)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen$$anonfun$1(BCodeSkelBuilder.scala:705)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.immutable.List.foreach(List.scala:334)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:705)
  at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:293)
  at dotty.tools.backend.jvm.CodeGen.genClass(CodeGen.scala:160)
  at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:62)
  at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:117)
  at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:115)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.immutable.List.foreach(List.scala:334)
  at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:115)
  at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:120)
  at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:90)
  at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.immutable.List.foreach(List.scala:334)
  at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
  at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:98)
  at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
  at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
  at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:383)
  at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:395)
  at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
  at dotty.tools.dotc.Run.compileUnits(Run.scala:395)
  at dotty.tools.dotc.Run.compileSources(Run.scala:282)
  at dotty.tools.dotc.Run.compile(Run.scala:267)
  at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
  at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
  at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
  at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
  at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:196)
  at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
  at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:251)
  at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:186)
  at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:166)
  at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:241)
  at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:166)
  at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:214)
  at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
  at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
  at sbt.internal.inc.Incremental$.$anonfun$apply$3(Incremental.scala:178)
  at sbt.internal.inc.Incremental$.$anonfun$apply$3$adapted(Incremental.scala:176)
  at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:454)
  at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:117)
  at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
  at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
  at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:265)
  at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:409)
  at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:496)
  at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:396)
  at sbt.internal.inc.Incremental$.apply(Incremental.scala:170)
  at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
  at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
  at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
  at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
  at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
  at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2427)
  at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2377)
  at sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:41)
  at sbt.internal.io.Retry$.apply(Retry.scala:47)
  at sbt.internal.io.Retry$.apply(Retry.scala:29)
  at sbt.internal.io.Retry$.apply(Retry.scala:24)
  at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:41)
  at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2375)
  at scala.Function1.$anonfun$compose$1(Function1.scala:49)
  at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
  at sbt.std.Transform$$anon$4.work(Transform.scala:69)
  at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
  at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
  at sbt.Execute.work(Execute.scala:292)
  at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
  at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
  at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
  at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
  at java.base/java.lang.Thread.run(Thread.java:1583)
@mrdziuban mrdziuban added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 19, 2024
@mrdziuban
Copy link
Author

Seems somewhat related to #18517

@Gedochao Gedochao added area:metaprogramming:other Issues tied to metaprogramming/macros not covered by the other labels. and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 20, 2024
@jchyb
Copy link
Contributor

jchyb commented Nov 22, 2024

Further minimized:
VisitorMacros.scala:

package example

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]
}

UsesTest.scala:

package example

val _ = Test.Foo

Test.scala

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]
  }
}

hamzaremmal added a commit that referenced this issue Nov 26, 2024
Related PR: #21651
There, a mechanism was added to the Phase classes, where any phase could
catch a SuspendException and have a compilation unit suspended (stopped
and recompiled later). In this fix, we rethrow incorrectly caught
SuspendExceptions, so that the aforementioned mechanism can take care of
the rest.
Fixes: #21983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:other Issues tied to metaprogramming/macros not covered by the other labels. itype:bug itype:crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants