Add tests that check `sbtUnchecked` is respected

This commit is contained in:
jvican 2017-05-28 18:26:58 +02:00
parent b017eaee39
commit 6a31251a01
No known key found for this signature in database
GPG Key ID: 42DAFA0F112E8050
1 changed files with 36 additions and 0 deletions

View File

@ -27,6 +27,30 @@ class TaskPosSpec {
}
}
locally {
import sbt._
import sbt.Def._
val foo = taskKey[String]("")
var condition = true
val baz = Def.task[String] {
val fooAnon = () => foo.value: @sbtUnchecked
if (condition) fooAnon()
else fooAnon()
}
}
locally {
import sbt._
import sbt.Def._
val foo = taskKey[String]("")
var condition = true
val baz = Def.task[String] {
val fooAnon = () => (foo.value: @sbtUnchecked) + ""
if (condition) fooAnon()
else fooAnon()
}
}
locally {
import sbt._
import sbt.Def._
@ -77,6 +101,18 @@ class TaskPosSpec {
}
}
locally {
// missing .value error should not happen inside task dyn
import sbt._
import sbt.Def._
val foo = taskKey[String]("")
val avoidDCE = ""
val baz = Def.task[String] {
foo: @sbtUnchecked
avoidDCE
}
}
locally {
import sbt._
import sbt.Def._