-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cyclic reference error when refering to an implicit parameter from another implicit parameter's type #18258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The error seems self-contained enough for a spree, and might offer an interesting tour of rare parts of the compiler |
This issue was picked for the Scala Issue Spree of tomorrow, July 2nd. @mbovel and @jan-pieter will be working on it! If you have any insight into the issue or guidance on how to fix it, please leave it here. |
Reproduced. Let class myAnnot(s: String) extends scala.annotation.Annotation
trait Showable[A]
def f(using Showable[Int])(using otherParam: Unit @myAnnot(summon[Showable[Int]](4))) = ???
|
Further minimized thanks to @EugeneFlesselle: class myAnnot(s: Int) extends scala.annotation.Annotation
def f(using otherParam: Unit @myAnnot(summon[Int])) = ??? So it seems Arguably, it should not? |
This can also be minimized like so: class myAnnot(s: Int) extends scala.annotation.Annotation
given String @myAnnot(summon[Int]) = "" // error: Cyclic reference involving val given_String In that case it seems even more dubious that it should see itself. Both these cases are also surprising, as the type of the given/using is different from the one of the summon, so there is no recursion going on ! |
Compiler version
3.3.0 / 3.3.1-RC1
Minimized code & Ouptut
Expectation
Either both methods should compile, or neither of them should
As I don't see any cyclic reference with
otherParam
, I assume the correct fix is to makef2
succeedThis also has implications for the following:
(
f4
surprisingly desugars tof3
: https://docs.scala-lang.org/scala3/reference/contextual/context-bounds.html#)The text was updated successfully, but these errors were encountered: