bug icon indicating copy to clipboard operation
bug copied to clipboard

Weird error message with compiler-generated variable names

Open scabug opened this issue 12 years ago • 3 comments

Can you do something to avoid x$3 in error message? I think that ls instead of x$3 will be much better

type OI = Option[Int]
def boo(z: OI, ls: List[OI], rs: List[OI]): (List[OI], List[OI]) = {
      val (ls,rs) = z match {
        case Some(_) => (z::ls, rs)
        case _       => (ls, z::rs)
      }
      (ls,rs)
}

/* recursive value x$3 needs type
      val (ls,rs): (List[OI], List[OI]) = z match {
           ^
*/

scabug avatar Sep 03 '13 12:09 scabug

Imported From: https://issues.scala-lang.org/browse/SI-7808?orig=1 Reporter: Dmitrii Kosarev (kakadu) Affected Versions: 2.10.2

scabug avatar Sep 03 '13 12:09 scabug

Scala 3.4.0-RC3: Recursive value $1$ needs type

SethTisue avatar Jan 29 '24 19:01 SethTisue

Scala 3 -explain-cyclic:

-- [E045] Cyclic Error: t7808.scala:5:9 --------------------------------------------------------------------------------
5 |    val (ls, rs) = z match {
  |         ^
  |         Recursive value $1$ needs type
  |
  |         The error occurred while trying to compute the signature of value $1$
  |           which required to compute the signature of value ls
  |           which required to compute the signature of value $1$
  |
  |          Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
  |
  | longer explanation available when compiling with `-explain`

Use the single non-synthetic in the error message.

Also dotty needs -explain-everything to reduce cycles of asking for more output.

som-snytt avatar Feb 02 '24 20:02 som-snytt