diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-28 16:36:27 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-02-07 20:56:22 +0100 |
commit | a0ee6e996e602bf5729687d7301f60b340d57061 (patch) | |
tree | 68dbbf1351a9c84619f6afa2e5b28c162f0e4293 /test | |
parent | 8d25d05e9bf848d763e7b657d9c7e96ea5cb8daf (diff) | |
download | scala-a0ee6e996e602bf5729687d7301f60b340d57061.tar.gz scala-a0ee6e996e602bf5729687d7301f60b340d57061.tar.bz2 scala-a0ee6e996e602bf5729687d7301f60b340d57061.zip |
SI-5082 Cycle avoidance between case companions
We can synthesize the case companion unapply without forcing
the info of the case class, by looking at the parameters in
the `ClassDef` tree, rather than at `sym.caseFieldAccessors`.
Access to non-public case class fields routed through the
already-renamed case accessor methods. The renamings are
conveyed via a back-channel (a per-run map, `renamedCaseAccessors`),
rather than via the types to give us enough slack to avoid
the cycle.
Some special treatment of private[this] parameters is needed
to avoid a misleading error message. Fortunately, we can
determine this without forcing the info of the case class,
by inspecting the parameter accessor trees.
This change may allow us to resurrect the case class ProductN
parentage, which was trialled but abandoned in the lead up
to 2.10.0.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t5082.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/pos/t5082.scala b/test/files/pos/t5082.scala new file mode 100644 index 0000000000..63eeda38ba --- /dev/null +++ b/test/files/pos/t5082.scala @@ -0,0 +1,14 @@ +trait Something[T] +object Test { class A } +case class Test() extends Something[Test.A] + +object User { + val Test() = Test() +} + +object Wrap { + trait Something[T] + object Test { class A } + case class Test(a: Int, b: Int)(c: String) extends Something[Test.A] + val Test(x, y) = Test(1, 2)(""); (x + y).toString +} |