diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-05-31 15:23:04 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-06-07 17:10:36 +0200 |
commit | 09b2f39731386cd5b3688d5c3badf75d956d4f6d (patch) | |
tree | d122fc0e96d6c1cd22d7e0d0b5ee523563d534e7 /bridge/src/sbt-test/source-dependencies/trait-private-var | |
parent | 030ff82070197f0c126f5c0287e076b0f6b6dd8d (diff) | |
download | dotty-09b2f39731386cd5b3688d5c3badf75d956d4f6d.tar.gz dotty-09b2f39731386cd5b3688d5c3badf75d956d4f6d.tar.bz2 dotty-09b2f39731386cd5b3688d5c3badf75d956d4f6d.zip |
Make the dotty-bridge sbt project a subproject of dotty
Note that the dotty-bridge tests will not be run automatically by `test`
which is short for `dotty/test`, to run the dotty-bridge tests, do in sbt:
> dotty-bridge/test
> dotty-bridge/scripted
Original history: https://github.com/smarter/dotty-bridge/commits/master
Diffstat (limited to 'bridge/src/sbt-test/source-dependencies/trait-private-var')
6 files changed, 61 insertions, 0 deletions
diff --git a/bridge/src/sbt-test/source-dependencies/trait-private-var/B.scala b/bridge/src/sbt-test/source-dependencies/trait-private-var/B.scala new file mode 100644 index 000000000..a0bb35627 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-private-var/B.scala @@ -0,0 +1,3 @@ +object B extends A { + def main(args: Array[String]): Unit = println(bar) +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A0.scala b/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A0.scala new file mode 100644 index 000000000..cf57bdb33 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A0.scala @@ -0,0 +1,3 @@ +trait A { + def bar: Int = 0 +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A1.scala b/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A1.scala new file mode 100644 index 000000000..3eb53d77c --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A1.scala @@ -0,0 +1,5 @@ +trait A { + private var foo = 12 + // we need to access foo to trigger AbstractMethodError + def bar: Int = foo +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A2.scala b/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A2.scala new file mode 100644 index 000000000..60641457d --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-private-var/changes/A2.scala @@ -0,0 +1,5 @@ +trait A { + private val foo = 12 + // we need to access foo to trigger AbstractMethodError + def bar: Int = foo +} diff --git a/bridge/src/sbt-test/source-dependencies/trait-private-var/project/DottyInjectedPlugin.scala b/bridge/src/sbt-test/source-dependencies/trait-private-var/project/DottyInjectedPlugin.scala new file mode 100644 index 000000000..3433779b6 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-private-var/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-private-var/test b/bridge/src/sbt-test/source-dependencies/trait-private-var/test new file mode 100644 index 000000000..c120697d8 --- /dev/null +++ b/bridge/src/sbt-test/source-dependencies/trait-private-var/test @@ -0,0 +1,28 @@ +$ copy-file changes/A0.scala A.scala + +# compile and run for the first time to verify that everything works +> run + +# introduce private var and refer to it in a trait that we inherit from +# there'll be pair of getters and setters generated for private var that +# has to be implemented by a class (where you can declare corresponding field) +$ copy-file changes/A1.scala A.scala + +# If the introduction of a private var did not trigger the recompilation of B, +# then this will fail with AbstractMethodError because the getters and setters +# for the private var have not been generated. +> run + +# Try again with a private val +> clean + +$ copy-file changes/A0.scala A.scala + +# compile and run a clean project to verify that everything works +> run + +# introduce a private val in the trait +$ copy-file changes/A2.scala A.scala + +# Verify that B has been recompiled and that everything runs fine. +> run |