Skip to content

Wrong macro dependency detected #8919

Closed
@nicolasstucki

Description

@nicolasstucki

Minimized code

import scala.quoted._

object Macros {

  implicit inline def identityMaped[T](x: => T): T = ${ impl('x) }

  def impl[T: Type](x: Expr[T])(using qctx: QuoteContext) : Expr[T] = {
    import qctx.tasty._
    val identityMap = new TreeMap { }
    val transformed = identityMap.transformTerm(x.unseal).seal.cast[T]
    transformed
  }
}

Output

Cyclic macro dependencies in tests/run-macros/tasty-tree-map/quoted_1.scala.
Compilation stopped since no further progress can be made.

To fix this, place macros in one set of files and their callers in another.

But it works is the import is import qctx.tasty.{_, given _}

Expectation

Should not be tagged as having cyclic dependencies. See: https://github.com/lampepfl/dotty/blob/b488860e45e7449f1a59744e1e796d8590623410/compiler/src/dotty/tools/dotc/typer/Inliner.scala#L1408

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions