From 1a59c55ed5c6a0d53acd0259090cf57328748451 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 2 Mar 2016 20:51:49 +1000 Subject: 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. --- test/files/run/t9546b.scala | 13 +++++++++++++ test/files/run/t9546c.scala | 13 +++++++++++++ test/files/run/t9546d.scala | 16 ++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 test/files/run/t9546b.scala create mode 100644 test/files/run/t9546c.scala create mode 100644 test/files/run/t9546d.scala (limited to 'test/files') 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 + } +} + -- cgit v1.2.3