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

Compiler crash when trying to use tupled method arguments #21638

Closed
goshacodes opened this issue Sep 24, 2024 · 7 comments
Closed

Compiler crash when trying to use tupled method arguments #21638

goshacodes opened this issue Sep 24, 2024 · 7 comments
Assignees

Comments

@goshacodes
Copy link

goshacodes commented Sep 24, 2024

Compiler version

3.5.1
3.5.0
3.4.2

Problem

Hi! I'm trying to use tupled method arguments in method body and this leads to compiler crash.

Minimized

inline def example: Int =
  ${ exampleMacro }
  
def exampleMacro(using quotes: Quotes): Expr[Int] =
  import quotes.reflect.*

  def tupled(args: List[Term]) =
    args.foldRight[Term]('{ EmptyTuple }.asTerm) { (el, acc) =>
      Select
        .unique(acc, "*:")
        .appliedToTypes(List(el.tpe, acc.tpe))
        .appliedToArgs(List(el))
    }

  val sym = Symbol.newMethod(
    parent = Symbol.spliceOwner,
    name = "BANG",
    tpe = MethodType(List("x", "y"))(_ => List(TypeRepr.of[Int], TypeRepr.of[Int]), _ => TypeRepr.of[Int]),
    Flags.EmptyFlags,
    Symbol.noSymbol
  )

  Block(
    List(
      DefDef(
        sym,
        params => Some(
          '{
            val tupledParams = ${tupled(params.flatten.collect { case t: Term => t }).asExprOf[(Int, Int)]}
            1
          }.asTerm
        )
      )
    ),
    Apply(Ref(sym), List('{1}.asTerm, '{1}.asTerm))
  ).asExprOf[Int]

Output (click arrow to expand)

 unhandled exception while running MegaPhase{lambdaLift, elimStaticThis, countOuterAccesses} on /Users/g.kovalev/IdeaProjects/backstub/src/main/scala/backstub/main.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.

     while compiling: /Users/g.kovalev/IdeaProjects/backstub/src/main/scala/backstub/main.scala
        during phase: MegaPhase{lambdaLift, elimStaticThis, countOuterAccesses}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.14
    compiler version: version 3.5.1
            settings: -classpath /Users/g.kovalev/IdeaProjects/backstub/target/scala-3.5.1/classes:/Users/g.kovalev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.5.1/scala3-library_3-3.5.1.jar:/Users/g.kovalev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar -d /Users/g.kovalev/IdeaProjects/backstub/target/scala-3.5.1/classes -experimental true

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.

     while compiling: <no file>
        during phase: parser
                mode: Mode()
     library version: version 2.13.14
    compiler version: version 3.5.1
            settings: -classpath /Users/g.kovalev/IdeaProjects/backstub/target/scala-3.5.1/classes:/Users/g.kovalev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.5.1/scala3-library_3-3.5.1.jar:/Users/g.kovalev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar -d /Users/g.kovalev/IdeaProjects/backstub/target/scala-3.5.1/classes -experimental true


[error] java.lang.IllegalArgumentException: Could not find proxy for y: Int in [parameter y, method BANG, method hello, the top-level definitions in package backstub, package backstub, package <root>], encl = method hello, owners = method hello, the top-level definitions in package backstub, package backstub, package <root>; enclosures = method hello, the top-level definitions in package backstub, package backstub, package <root>
[error] dotty.tools.dotc.transform.LambdaLift$Lifter.searchIn$1(LambdaLift.scala:137)
[error] dotty.tools.dotc.transform.LambdaLift$Lifter.proxy(LambdaLift.scala:150)
[error] dotty.tools.dotc.transform.LambdaLift$Lifter.proxyRef(LambdaLift.scala:168)
[error] dotty.tools.dotc.transform.LambdaLift.transformIdent(LambdaLift.scala:287)
[error] dotty.tools.dotc.transform.MegaPhase.goIdent(MegaPhase.scala:621)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:240)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.loop$3(MegaPhase.scala:486)
[error] dotty.tools.dotc.transform.MegaPhase.transformTrees(MegaPhase.scala:486)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:296)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.loop$3(MegaPhase.scala:486)
[error] dotty.tools.dotc.transform.MegaPhase.transformTrees(MegaPhase.scala:486)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:296)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:244)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:319)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:337)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:251)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.loop$2(MegaPhase.scala:471)
[error] dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:476)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:315)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.loop$2$$anonfun$1(MegaPhase.scala:474)
[error] dotty.tools.dotc.transform.MegaPhase.loop$2(MegaPhase.scala:476)
[error] dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:476)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:315)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:251)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.loop$2(MegaPhase.scala:471)
[error] dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:476)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:315)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:265)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.loop$2(MegaPhase.scala:471)
[error] dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:476)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:315)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:337)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:265)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:465)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:465)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:376)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:272)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:452)
[error] dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:465)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:465)
[error] dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:396)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:399)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:454)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:481)
[error] dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:493)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:334)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:396)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:288)
[error] dotty.tools.dotc.Run.compileSuspendedUnits(Run.scala:410)
[error] dotty.tools.dotc.Driver.finish(Driver.scala:63)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:196)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:251)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:186)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:166)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:241)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:166)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:214)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$3(Incremental.scala:178)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$3$adapted(Incremental.scala:176)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:454)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:117)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:265)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:409)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:496)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:396)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:170)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2427)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2377)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:41)
[error] sbt.internal.io.Retry$.apply(Retry.scala:47)
[error] sbt.internal.io.Retry$.apply(Retry.scala:29)
[error] sbt.internal.io.Retry$.apply(Retry.scala:24)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:41)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2375)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] sbt.Execute.work(Execute.scala:292)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error] java.base/java.lang.Thread.run(Thread.java:1583)
[error]            
[error] stack trace is suppressed; run last Compile / compileIncremental for the full output
[error] (Compile / compileIncremental) java.lang.IllegalArgumentException: Could not find proxy for y: Int in [parameter y, method BANG, method hello, the top-level definitions in package backstub, package backstub, package <root>], encl = method hello, owners = method hello, the top-level definitions in package backstub, package backstub, package <root>; enclosures = method hello, the top-level definitions in package backstub, package backstub, package <root>
[error] Total time: 1 s, completed 27 сент. 2024 г., 14:14:44
@goshacodes goshacodes added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 24, 2024
@dwijnand dwijnand changed the title Compiler crush on Term.betaReduce Compiler crash on Term.betaReduce Sep 24, 2024
@goshacodes goshacodes changed the title Compiler crash on Term.betaReduce Compiler crush on Term.betaReduce Sep 24, 2024
@goshacodes goshacodes changed the title Compiler crush on Term.betaReduce Compiler crash on Term.betaReduce Sep 25, 2024
@Gedochao Gedochao added area:transform stat:needs minimization Needs a self contained minimization and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 26, 2024
@jchyb jchyb added the area:metaprogramming:reflection Issues related to the quotes reflection API label Sep 26, 2024
@goshacodes
Copy link
Author

goshacodes commented Sep 27, 2024

@jchyb @Gedochao Hi, I've made a minimized example, it is not about Term.betaReduce, it is about using ?tupled? method arguments.
Could you please help me with a workaround if possible?

inline def example: Int =
  ${ exampleMacro }
  
def exampleMacro(using quotes: Quotes): Expr[Int] =
  import quotes.reflect.*

  def tupled(args: List[Term]) =
    args.foldRight[Term]('{ EmptyTuple }.asTerm) { (el, acc) =>
      Select
        .unique(acc, "*:")
        .appliedToTypes(List(el.tpe, acc.tpe))
        .appliedToArgs(List(el))
    }

  val sym = Symbol.newMethod(
    parent = Symbol.spliceOwner,
    name = "BANG",
    tpe = MethodType(List("x", "y"))(_ => List(TypeRepr.of[Int], TypeRepr.of[Int]), _ => TypeRepr.of[Int]),
    Flags.EmptyFlags,
    Symbol.noSymbol
  )

  Block(
    List(
      DefDef(
        sym,
        params => Some(
          '{
            val tupledParams = ${tupled(params.flatten.collect { case t: Term => t }).asExprOf[(Int, Int)]}
            1
          }.asTerm
        )
      )
    ),
    Apply(Ref(sym), List('{1}.asTerm, '{1}.asTerm))
  ).asExprOf[Int]

@goshacodes goshacodes changed the title Compiler crash on Term.betaReduce Compiler crash when trying to use tupled method arguments Sep 27, 2024
@goshacodes
Copy link
Author

Found solution here.
#13599
Can we handle this exception somehow and show error message telling what to do?
This is not very clear first time

@Gedochao
Copy link
Contributor

@goshacodes I'm not sure if the example you posted is indeed the minimization of this... the code you provided seems to compile fine for me, no crashes 🤔 (although I had to add the missing import scala.quoted.*)

@goshacodes
Copy link
Author

🤔🤔🤔

@jchyb
Copy link
Contributor

jchyb commented Sep 27, 2024

@Gedochao It crashes for me, you are likely missing a file with macro call:

// main.scala
def main() = example

@goshacodes When you use -Xcheck-macro option, you get an additional checking phase that checks the correctness of generated code. Since it has substantial performance footprint on compilation (that is unnecessary for macro library users), it's made optional, but highly recommended for macro development phase. This error here is indeed caught with -Xcheck-macro and ends compilation before the compiler crashes:

-- Error: main.scala:1:13 ------------------------------------------------------
1 |def main() = example
  |             ^^^^^^^
  |Exception occurred while executing macro expansion.
  |java.lang.AssertionError: assertion failed: Tree had an unexpected owner for val tupledParams
  |Expected: method BANG (main$package$._$_$BANG)
  |But was: val macro (main$package$._$macro)
|
  |The code of the definition of val tupledParams is
  |val tupledParams: scala.Tuple2[scala.Int, scala.Int] = scala.Tuple$package.EmptyTuple.*:[y.type, scala.Tuple$package.EmptyTuple.type](y).*:[x.type, scala.*:[y, scala.Tuple$package.EmptyTuple]](x)
  |
  |which was found in the code
  |{
  |  val tupledParams: scala.Tuple2[scala.Int, scala.Int] = scala.Tuple$package.EmptyTuple.*:[y.type, scala.Tuple$package.EmptyTuple.type](y).*:[x.type, scala.*:[y, scala.Tuple$package.EmptyTuple]](x)
  |  1
  |}
  |
  |which has the AST representation
  |Inlined(Some(TypeIdent("macro$package$")), Nil, Block(List(ValDef("tupledParams", Inferred(), Some(Inlined(None, Nil, Apply(TypeApply(Select(Apply(TypeApply(Select(Inlined(Some(TypeIdent("macro$package$")), Nil, Ident("EmptyTuple")), "*:"), List(Inferred(), Inferred())), List(Ident("y"))), "*:"), List(Inferred(), Inferred())), List(Ident("x"))))))), Literal(IntConstant(1))))
  |
  |
  |
  |Tip: The owner of a tree can be changed using method `Tree.changeOwner`.
  |Tip: The default owner of definitions created in quotes can be changed using method `Symbol.asQuotes`.
  |
  |     at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
  |     at scala.quoted.runtime.impl.QuotesImpl$$anon$10.traverse(QuotesImpl.scala:3154)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1801)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1801)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.fold$1(Trees.scala:1665)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.apply(Trees.scala:1667)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1698)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1802)
  |     at scala.quoted.runtime.impl.QuotesImpl$$anon$10.traverse(QuotesImpl.scala:3162)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1801)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1801)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1718)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1671)
  |     at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1802)
  |     at scala.quoted.runtime.impl.QuotesImpl$$anon$10.traverse(QuotesImpl.scala:3162)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$.xCheckMacroOwners(QuotesImpl.scala:3163)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$.scala$quoted$runtime$impl$QuotesImpl$reflect$$$xCheckedMacroOwners(QuotesImpl.scala:3116)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$DefDef$.apply$$anonfun$3$$anonfun$1(QuotesImpl.scala:307)
  |     at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:312)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$DefDef$.apply$$anonfun$3(QuotesImpl.scala:308)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$.scala$quoted$runtime$impl$QuotesImpl$reflect$$$withDefaultPos(QuotesImpl.scala:3107)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$DefDef$.apply(QuotesImpl.scala:306)
  |     at scala.quoted.runtime.impl.QuotesImpl$reflect$DefDef$.apply(QuotesImpl.scala:303)
  |     at macro$package$.exampleMacro(macro.scala:29)
  |
  |-----------------------------------------------------------------------------
  |Inline stack trace
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |This location contains code that was inlined from macro.scala:4
4 |  ${ exampleMacro }
  |  ^^^^^^^^^^^^^^^^^
   -----------------------------------------------------------------------------

@goshacodes
Copy link
Author

Got it, thank you!

@Gedochao Gedochao removed the stat:needs minimization Needs a self contained minimization label Oct 17, 2024
@jchyb
Copy link
Contributor

jchyb commented Oct 17, 2024

Closing as the requested check is already handled by -Xcheck-macros.

@jchyb jchyb closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants