diff options
Diffstat (limited to 'bridge/src/sbt-test/source-dependencies/trait-super')
7 files changed, 67 insertions, 0 deletions
diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/A.scala b/bridge/src/sbt-test/source-dependencies/trait-super/A.scala new file mode 100644 index 000000000..52ad7e6a0 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/A.scala @@ -0,0 +1,6 @@ +trait A { + def x: Int +} +class E extends A { + def x = 19 +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/B.scala b/bridge/src/sbt-test/source-dependencies/trait-super/B.scala new file mode 100644 index 000000000..cba4cc427 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/B.scala @@ -0,0 +1,6 @@ +trait B extends A { + abstract override def x = 1 +} +trait C extends A { + abstract override def x = 3 +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/Main.scala b/bridge/src/sbt-test/source-dependencies/trait-super/Main.scala new file mode 100644 index 000000000..37d821d9d --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/Main.scala @@ -0,0 +1,10 @@ +class X extends E with C with B + +object Main { + + def main(args: Array[String]): Unit = { + val x = new X + val expected = args(0).toInt + assert(x.x == expected, "Expected " + expected + ", got " + x.x) + } +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/changes/B2.scala b/bridge/src/sbt-test/source-dependencies/trait-super/changes/B2.scala new file mode 100644 index 000000000..c89acd3ae --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/changes/B2.scala @@ -0,0 +1,6 @@ +trait B extends A { + abstract override def x = super.x + 2 +} +trait C extends A { + abstract override def x = 3 +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/changes/B3.scala b/bridge/src/sbt-test/source-dependencies/trait-super/changes/B3.scala new file mode 100644 index 000000000..2a7ba55ec --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/changes/B3.scala @@ -0,0 +1,6 @@ +trait B extends A { + abstract override def x = super.x + 2 +} +trait C extends A { + abstract override def x = super.x +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/project/DottyInjectedPlugin.scala b/bridge/src/sbt-test/source-dependencies/trait-super/project/DottyInjectedPlugin.scala new file mode 100644 index 000000000..3433779b6 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/project/DottyInjectedPlugin.scala @@ -0,0 +1,17 @@ +import sbt._ +import Keys._ + +object DottyInjectedPlugin extends AutoPlugin { + override def requires = plugins.JvmPlugin + override def trigger = allRequirements + + override val projectSettings = Seq( + scalaVersion := "0.1-SNAPSHOT", + scalaOrganization := "ch.epfl.lamp", + scalacOptions += "-language:Scala2", + scalaBinaryVersion := "2.11", + autoScalaLibrary := false, + libraryDependencies ++= Seq("org.scala-lang" % "scala-library" % "2.11.5"), + scalaCompilerBridgeSource := ("ch.epfl.lamp" % "dotty-bridge" % "0.1.1-SNAPSHOT" % "component").sources() + ) +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-super/test b/bridge/src/sbt-test/source-dependencies/trait-super/test new file mode 100644 index 000000000..b14d5dc76 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-super/test @@ -0,0 +1,16 @@ +# Dotty: This test has been disabled because super accessors are introduced +# in PostTyper but the sbt phase is run before PostTyper so that tests like +# "constants" succeed. + +# This test verifies that adding/removing calls to super in traits properly +# recompiles subclasses. super calls introduce accessors that are not in +# the public API, so this is not picked up by the usual API change detection. + +> run 1 + +$ copy-file changes/B2.scala B.scala +> run 5 + +$ copy-file changes/B3.scala B.scala +> run 21 + |