Open
Description
Compiler version
3.3.0-RC5
Minimized code
import scala.quoted.*
trait Thing[A]
transparent inline def repro[T] =
${ reproImpl[T] }
private def reproImpl[T: Type](using Quotes): Expr[Any] =
Expr.summon[Thing[T]]
'{null}
trait Foo
object Bar:
val instance = repro[Foo]
given instance.type = instance
Output
[error] -- [E046] Cyclic Error: /Users/jason/src/bug-reports/app/src/main/scala/Main.scala:56:8
[error] 56 | given instance.type = instance
[error] | ^
[error] | Cyclic reference involving val instance
[error] |----------------------------------------------------------------------------
[error] | Explanation (enabled by `-explain`)
[error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error] | value instance is declared as part of a cycle which makes it impossible for the
[error] | compiler to decide upon instance's type.
[error] | To avoid this error, try giving instance an explicit type.
[error] ----------------------------------------------------------------------------
Expectation
I'd expect this to compile.
This is as minimal as I could get it, the real use case would obviously be more useful than this. In this particular reproduction it needed instance.type
to be involved in some given
and reproImpl
to summon some unrelated given
(I was originally using a Mirror
but that is not required).