Skip to content

unable to create a quoted.Liftable #7858

Closed
@johnynek

Description

@johnynek

minimized code

object Foo {
  given Liftable[Boolean] {
    def toExpr(b: Boolean)(given QuoteContext): Expr[Boolean] =
      if (b) '{ true } else '{ false }
  }
}

I get:

[error] -- Error: /home/oscar/oss/olelo/src/main/scala/Olelo.scala:7:8 -----------------
[error] 7 |  given Liftable[Boolean] {
[error]   |        ^
[error]   |object creation impossible, since def toExpr(x: Boolean): (given quoted.QuoteContext) => quoted.Expr[Boolean] is not defined
[error]   |(Note that T does not match Boolean)
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

expectation

The error message is confusing to me. What is T? I don't mention that in my code. Also, it seems I have the method it is complaining about.

since this example is listed: https://dotty.epfl.ch/docs/reference/metaprogramming/macros.html

I thought this would work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions