Skip to content

Conversation

@noti0na1
Copy link
Member

Fix #24547

@noti0na1
Copy link
Member Author

noti0na1 commented Nov 28, 2025

Em...
With this fix, the test should be compilable, as in 3.7, but it does not pass the -Ycheck:all, as in 3.7. There are some issues with this macro even before 3.8.

Error: java.lang.AssertionError: assertion failed: bad owner; value $3$ has owner value $4$, expected was value $4
owner chain = value $3$, value $4$, value macro, method reproTest, the top-level definitions in package <empty>, package <empty>, package <root>, ctxOwners = value $4, value $4, value $4, method reproTest, method reproTest, method reproTest, method reproTest, method reproTest, method reproTest, method reproTest, the top-level definitions in package <empty>, the top-level definitions in package <empty>, package <empty>, package <empty>, package <empty>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>, package <root>,  <none>,  <none>,  <none>,  <none>
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.transform.TreeChecker$Checker.checkOwner(TreeChecker.scala:575)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats$$anonfun$1(TreeChecker.scala:687)
        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.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:686)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1516)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1520)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:306)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:673)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.$anonfun$19(Typer.scala:1617)
        at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:2738)
        at dotty.tools.dotc.typer.Applications.harmonic$(Applications.scala:470)
        at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:155)
        at dotty.tools.dotc.typer.Typer.typedIf(Typer.scala:1620)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3680)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3890)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3909)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1516)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1520)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:306)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:673)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.typedLabeled(Typer.scala:2329)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedLabeled$$anonfun$1(TreeChecker.scala:696)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedLabeled(TreeChecker.scala:696)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3664)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3758)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3952)
        at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2968)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedValDef(TreeChecker.scala:622)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3650)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3758)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3863)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3909)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1516)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1520)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:306)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:673)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedInlined$$anonfun$1(TreeChecker.scala:676)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedInlined(TreeChecker.scala:676)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3694)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.ReTyper.typedInlined(ReTyper.scala:100)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedInlined$$anonfun$1(TreeChecker.scala:676)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedInlined(TreeChecker.scala:676)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3694)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3890)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3909)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1516)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1520)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:306)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:673)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3952)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1523)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock$$anonfun$1(TreeChecker.scala:673)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withBlock(TreeChecker.scala:306)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedBlock(TreeChecker.scala:673)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3952)
        at dotty.tools.dotc.typer.Typer.$anonfun$68(Typer.scala:3028)
        at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
        at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:3028)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$1(TreeChecker.scala:648)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:651)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3653)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3758)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3863)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3909)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3328)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:618)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3659)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3663)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3758)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3863)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3909)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3461)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedPackageDef(TreeChecker.scala:717)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3705)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3759)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3836)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3841)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3952)
        at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:131)
        at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:111)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:383)
        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:376)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:380)
        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:1324)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:373)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:420)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:420)
        at scala.Function0.apply$mcV$sp(Function0.scala:42)
        at dotty.tools.dotc.Run.showProgress(Run.scala:482)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:420)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:432)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:432)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:325)
        at dotty.tools.dotc.Run.compileSuspendedUnits(Run.scala:446)
        at dotty.tools.dotc.Driver.finish(Driver.scala:63)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
        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.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:148)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$9(BloopHighLevelCompiler.scala:181)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:73)
        at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:72)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$8(BloopHighLevelCompiler.scala:181)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
        at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
        at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
        at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

@noti0na1 noti0na1 marked this pull request as ready for review November 28, 2025 13:40
@noti0na1
Copy link
Member Author

I propose: we merge this into 3.8 to avoid retains interacting with any types during macro/inline expansion, and keep the original issue open for further investigation.

cc @odersky @hamzaremmal

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OtherwiseLGTM

@odersky odersky assigned noti0na1 and unassigned odersky Nov 28, 2025
@odersky
Copy link
Contributor

odersky commented Nov 28, 2025

Agreed. Let's merge for 3.8.0 but keep the issue open.

@noti0na1 noti0na1 added this to the 3.8.0 milestone Nov 28, 2025
@noti0na1 noti0na1 added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Nov 28, 2025
@noti0na1 noti0na1 merged commit 7fc43a0 into scala:main Nov 28, 2025
46 checks passed
@noti0na1 noti0na1 deleted the fix-24547 branch November 28, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler crash in getkyo/kyo + dotty-cps-async/dotty-cps-async

2 participants