Skip to content

How to access showExtractors in M3? #10832

Closed
@hmf

Description

@hmf

Minimized code

  private def unsealUnderlying[T](p:Expr[T])(using t:Type[T], qctx:Quotes): Expr[T] = {
    import qctx.reflect._

    val xTree0: Term = Term.of(p)
    xTree0 match {
      case Inlined(_, _, _) =>  
        Term.of(p).underlying.asExprOf[T]
      case _ =>
        report.throwError(s"unsealUnderlying: Expected HList reference but got ${p.show} -- (${Term.of(p).showExtractors})", p)
    }
  }

  private def unsealUnderlying2[T](p:Expr[T])(using t:Type[T], qctx:Quotes): Expr[T] = {
    import qctx.reflect._

    val xTree0: Term = p.asTerm
    xTree0 match {
      case Inlined(_, _, _) =>  
        Term.of(p).underlying.asExprOf[T]
      case _ =>
        report.throwError(s"unsealUnderlying: Expected HList reference but got ${p.show} -- (${xTree0.showExtractors})", p)
    }
  }

Output

[error] 132 |        report.throwError(s"unsealUnderlying: Expected HList reference but got ${p.show} -- (${Term.of(p).showExtractors})", p)
[error]     |                                                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |             value showExtractors is not a member of qctx.reflect.Term

Expectation

To be able to show the extractor. I have searched the repo for showExtractors and only found the documentation here. No release note so were can I find an example?

Tested in the latest 3.0.0-M3

TIA

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions