scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Cyclic reference being computed where non exists

Open rcano opened this issue 3 years ago • 1 comments

Compiler version

3.1.1

Minimized code

See this Scastie: https://scastie.scala-lang.org/TA9CIzqHS86RzcpAidG2UA

object Test {
    import com.typesafe.config.ConfigFactory
    import io.getquill.*

    case class H2JObject(obj: Any)

    val ctx = new H2JdbcContext(CamelCase, ConfigFactory.parseString(""))

    implicit def a: ctx.Encoder[H2JObject] = ???
    implicit def b: ctx.Decoder[H2JObject] = ??? 
}

Output

Cyclic reference involving val ctx at both implicit defs

Expectation

Code should compile fine. This happens when using given instead of implicit as well. The solution is to explicitly write the type of ctx

rcano avatar Feb 09 '22 17:02 rcano

why is this assigned to me @anatoliykmetyuk ? I don't work on the compiler

rcano avatar May 27 '25 14:05 rcano