Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

TASTy Reflect docs is getting outdated #5

Open
anatoliykmetyuk opened this issue Jul 2, 2019 · 0 comments
Open

TASTy Reflect docs is getting outdated #5

anatoliykmetyuk opened this issue Jul 2, 2019 · 0 comments
Labels
intent:report-outdated You want to report that a piece of knowledge in the docs is no longer up to date

Comments

@anatoliykmetyuk
Copy link
Contributor

Link to the knowledge: http://dotty.epfl.ch/docs/reference/metaprogramming/tasty-reflect.html
More information:

E.g.:

def natConstImpl(x: Expr[Int]) given (qctx: QuoteContext): Expr[Int] = {
  import qctx.tasty._
  val xTree: Term = x.unseal
  xTree match {
    case Term.Literal(Constant.Int(n)) =>
      if (n <= 0)
        QuoteError("Parameter must be natural number")
      n.toExpr
    case _ =>
      QuoteError("Parameter must be a known constant")
  }
}

Last time I ran this example, xTree was an Inline containing Term.Literal and not the raw Term.Literal. You get the raw Term.Literal if you do underlyingArgument on the tree.

Also, the foldOver method is mentioned in the article on a number of occasions, which does not seem to be present in the API anymore.

@anatoliykmetyuk anatoliykmetyuk added the intent:report-outdated You want to report that a piece of knowledge in the docs is no longer up to date label Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
intent:report-outdated You want to report that a piece of knowledge in the docs is no longer up to date
Projects
None yet
Development

No branches or pull requests

1 participant