diff --git a/sbt/src/sbt-test/actions/compile-time-only/build.sbt b/sbt/src/sbt-test/actions/compile-time-only/build.sbt index 12bdd2f9a..b3a0950e2 100644 --- a/sbt/src/sbt-test/actions/compile-time-only/build.sbt +++ b/sbt/src/sbt-test/actions/compile-time-only/build.sbt @@ -1 +1,12 @@ -libraryDependencies += "org.scala-sbt" % "sbt" % sbtVersion.value \ No newline at end of file +libraryDependencies += "org.scala-sbt" % "sbt" % sbtVersion.value + + +lazy val expectErrorNotCrash = taskKey[Unit]("Ensures that sbt properly set types on Trees so that the compiler doesn't crash on a bad reference to .value, but gives a proper error instead.") + +expectErrorNotCrash := { + val fail = (compile in Compile).failure.value + fail.directCause match { + case Some(x: xsbti.CompileFailed) => () + case _ => error("Compiler crashed instead of providing a compile-time-only exception.") + } +} diff --git a/sbt/src/sbt-test/actions/compile-time-only/test b/sbt/src/sbt-test/actions/compile-time-only/test index 43b7af6f1..5b8d05504 100644 --- a/sbt/src/sbt-test/actions/compile-time-only/test +++ b/sbt/src/sbt-test/actions/compile-time-only/test @@ -2,7 +2,7 @@ $ copy-file changes/A1.scala A.scala > compile $ copy-file changes/A2.scala A.scala --> compile +> expectErrorNotCrash $ copy-file changes/A3.scala A.scala --> compile \ No newline at end of file +> expectErrorNotCrash