Skip to content

Can't compile quotations matching with HK type arguments involved #9360

Closed
@rssh

Description

@rssh

Minimized code

package a

import scala.quoted._

trait CPM[F[_]]

def fun[M[_],T](t:T)(using m:CPM[M]):M[T] = ???

object M {

  inline def transform[F[_],T](t:T): F[T] =
     ${ transformImpl[F,T]('t) }

  def transformImpl[F[_]:Type,T:Type](t:Expr[T])(using Quotes):Expr[F[T]] = {
     import quotes.reflect._
     t match {
       case '{ a.fun[$mt,$tt]($t)(using $m) } => ???
     }

  }

}

Output

[error] -- [E057] Type Mismatch Error: /Users/rssh/tests/scala-misc/dotty/match-hk-hk/match-hk-hk/src/main/scala/a/M.scala:17:22 
[error] 17 |       case '{ a.fun[$mt,$tt]($t)(using $m) } => ???
[error]    |                      ^
[error]    |Type argument $mt does not conform to upper bound [_$1] =>> Any in subpart a.CPM[$mt] of inferred type scala.quoted.Expr[a.CPM[$mt]]
[error] one error found

Expectation

should compile

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