With -Xprint:typer you can see the synthetic, which is listed with a direct link:
package oops { object Test extends scala.AnyRef { def <init>(): oops.Test.type = { Test.super.<init>(); () }; def testFunction(): Unit = { def recursiveMethod(i: Int, j: Int = 3): Unit = i match { case 0 => scala.this.Predef.println(scala.StringContext.apply("finished").s()) case (i @ _) => recursiveMethod(i.-(1), recursiveMethod$default$2) }; val shapes: List[String] = immutable.this.Nil; def recursive(i: Int): Unit = { i; () }; <synthetic> def recursiveMethod$default$2: Int @scala.annotation.unchecked.uncheckedVariance = 3; () }; def main(args: Array[String]): Unit = () } }
There are at least a few tickets related to creating methods close to their origin in order to avoid these kinds of invisible problems.
Update: for pririent:
Oldie but goodie
Closer to the heart, if not directly related to this problem
I especially liked the "rename function so that it is not a prefix of another function."
This shows how renaming reorders participants:
abstract trait Oops extends scala.AnyRef { def /*Oops*/$init$(): Unit = { () }; def testFunction(): Unit = { def recursiveMethod(i: Int, j: Int = 3): Unit = i match { case 0 => scala.this.Predef.println(scala.StringContext.apply("finished").s()) case (i @ _) => recursiveMethod(i.-(1), recursiveMethod$default$2) }; <synthetic> def recursiveMethod$default$2: Int @scala.annotation.unchecked.uncheckedVariance = 3; val shapes: List[String] = immutable.this.Nil; def xrecursive(i: Int): Unit = { i; () }; () } };
Needless to add, it should be a mistake or regression. Correctly?
Update:
Indeed, the sorting test is syntName.toString.startsWith , which explains why renaming another function matters. This shows how a fragile name distorts all errors. He likes termites that come out of the tree so often, reminding you that over the past five years they have compromised the structural integrity of the frame.
This is the code with the comment [Martin] This is pretty ugly. So he is not unknown, he just needs someone with free time.
som-snytt
source share