Skip to content

given swallows inline errors #9014

Closed
@yilinwei

Description

@yilinwei

Minimized example

trait Bar[T]

object Bar {

  import scala.quoted._

  inline given [T] as Bar[T] = ${ impl[T] }

  def impl[T](using qctx: QuoteContext, t: Type[T]): Expr[Bar[T]] = {
    import qctx.tasty._
    import util._

    t.unseal match {
      case _ =>
        qctx.error("Failed to expand!")
        '{ ??? }
    }
  }
}

object Foo {
  summon[Bar[String]]
}

Output

ala:9:21                                                                            
[error] 9 |  summon[Bar[String]]
[error]   |                     ^
[error]   |no implicit argument of type pprint.Bar[String] was found for parameter x 
of method summon in object DottyPredef.                                             
[error]   |I found:
[error]   |
[error]   |    {
[error]   |      {
[error]   |        ???
[error]   |      }:pprint.Bar[String]
[error]   |    }
[error]   |
[error]   |But method given_Bar_T in object Bar does not match type pprint.Bar[String
].                                                                                  

Expectation

Ideally, the macro expansion should show the qctx.error.

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