mirror of https://github.com/sbt/sbt.git
Don't warn on by-name keys
.. which is apparently what the type of bare vals in *.sbt files are. Fixes #3299, again.
This commit is contained in:
parent
8d9a3a35d2
commit
d3d105515a
|
|
@ -65,7 +65,7 @@ abstract class BaseTaskLinterDSL extends LinterDSL {
|
|||
val wrapperName = nme.decodedName.toString
|
||||
val (qualName, isSettingKey) =
|
||||
Option(qual.symbol)
|
||||
.map(sym => (sym.name.decodedName.toString, sym.info <:< typeOf[SettingKey[_]]))
|
||||
.map(sym => (sym.name.decodedName.toString, qual.tpe <:< typeOf[SettingKey[_]]))
|
||||
.getOrElse((ap.pos.lineContent, false))
|
||||
|
||||
if (!isSettingKey && !shouldIgnore && isTask(wrapperName, tpe.tpe, qual)) {
|
||||
|
|
|
|||
|
|
@ -151,6 +151,15 @@ class TaskPosSpec {
|
|||
}
|
||||
}
|
||||
|
||||
locally {
|
||||
import sbt._, Def._
|
||||
def withKey(foo: => SettingKey[String]) = {
|
||||
Def.task { if (true) foo.value }
|
||||
}
|
||||
val foo = settingKey[String]("")
|
||||
withKey(foo)
|
||||
}
|
||||
|
||||
locally {
|
||||
import sbt._
|
||||
import sbt.Def._
|
||||
|
|
@ -171,4 +180,17 @@ class TaskPosSpec {
|
|||
(1 to 10).map(_ => foo.value)
|
||||
}
|
||||
}
|
||||
|
||||
locally {
|
||||
import sbt._, Def._
|
||||
def withKey(bar: => SettingKey[Int]) = {
|
||||
Def.task {
|
||||
List(42).map { _ =>
|
||||
if (true) bar.value
|
||||
}
|
||||
}
|
||||
}
|
||||
val bar = settingKey[Int]("bar")
|
||||
withKey(bar)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue