Closed
Description
Minimized code
2 files:
X.scala:
package x
import scala.quoted._
trait CB[T]
trait M[F[_]]
object MCB extends M[CB]
given M[CB] = MCB
object Y {
inline def foundMF1[F[_],A](inline x: A)(using M[F]) : Boolean = ${
foundMFImpl1('x)
}
def foundMFImpl1[F[_]:Type,A:Type](f:Expr[A])(using qctx: QuoteContext):Expr[Boolean] = {
Expr( Expr.summon[M[F]].isDefined )
}
}
and Main.scala
package x
object Main {
def main(args:Array[String]):Unit =
println(Y.foundMF1[CB,Any]({ case 1 => 10 }))
}
Output
rssh@rssh4 endless-compile % sbt clean compile
[info] welcome to sbt 1.3.13 (N/A Java 14.0.1)
[info] loading settings for project endless-compile-build from plugins.sbt ...
[info] loading project definition from /Users/rssh/tests/dotty/endless-compile/project
Fetching latest Dotty nightly version...
Latest Dotty nightly build version: 0.27.0-bin-20200807-dfcc0b1-NIGHTLY
[info] loading settings for project root from build.sbt ...
[info] set current project to test (in build file:/Users/rssh/tests/dotty/endless-compile/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed 8 Aug 2020, 11:32:08
[info] Compiling 2 Scala sources to /Users/rssh/tests/dotty/endless-compile/target/scala-0.27/classes ...
| => root / Compile / compileIncremental 541s
Expectation
will compiles.