diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-03-02 20:51:49 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-03-02 22:11:55 +1000 |
commit | 1a59c55ed5c6a0d53acd0259090cf57328748451 (patch) | |
tree | f61cf8d36e1341bba2f3d4131945b3c02b37a0db /test | |
parent | 861e4766da5a2271ae66d5d5fd054f6fe01ac7b9 (diff) | |
download | scala-1a59c55ed5c6a0d53acd0259090cf57328748451.tar.gz scala-1a59c55ed5c6a0d53acd0259090cf57328748451.tar.bz2 scala-1a59c55ed5c6a0d53acd0259090cf57328748451.zip |
Refactor transform of case apply in refchecks
I've identified a dead call to `transformCaseApply` that
seems to date back to Scala 2.6 vintages, in which case
factory methods were a fictional companion method, rather
than a real apply method in a companion module.
This commit adds an abort in that code path to aide code
review (if our test suite still passes, we know that I've
removed dead code, rather than silently changing behaviour.)
The following commit will remove it altogether
I then inlined a slightly clunky abstraction in the two
remaining calls to `transformCaseApply`. It was getting in the
way of a clean fix to SI-9546, the topic of the next commit.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t9546b.scala | 13 | ||||
-rw-r--r-- | test/files/run/t9546c.scala | 13 | ||||
-rw-r--r-- | test/files/run/t9546d.scala | 16 |
3 files changed, 42 insertions, 0 deletions
diff --git a/test/files/run/t9546b.scala b/test/files/run/t9546b.scala new file mode 100644 index 0000000000..0b4d2d3fe5 --- /dev/null +++ b/test/files/run/t9546b.scala @@ -0,0 +1,13 @@ +package foo { + case class Opt[A](val get: A) extends AnyVal { + } + object Opt { + def mkOpt = Opt("") + } +} + +object Test { + def main(args: Array[String]): Unit = { + foo.Opt.mkOpt + } +} diff --git a/test/files/run/t9546c.scala b/test/files/run/t9546c.scala new file mode 100644 index 0000000000..ea6a5a36b4 --- /dev/null +++ b/test/files/run/t9546c.scala @@ -0,0 +1,13 @@ +package foo { + case class Opt[A] private[foo](val get: A) + object Opt { + def mkOpt = Opt("") + } +} + +object Test { + def main(args: Array[String]): Unit = { + foo.Opt.mkOpt + } +} + diff --git a/test/files/run/t9546d.scala b/test/files/run/t9546d.scala new file mode 100644 index 0000000000..00bf37dc18 --- /dev/null +++ b/test/files/run/t9546d.scala @@ -0,0 +1,16 @@ +class X { + def test: Any = { + object Opt { + def mkOpt = Opt("") + } + case class Opt[A] private[X](val get: A) + Opt.mkOpt + } +} + +object Test { + def main(args: Array[String]): Unit = { + new X().test + } +} + |