mirror of https://github.com/sbt/sbt.git
Fix NPE in task macro accessing q"{...}".symbol.pos
We shouldn't assume that the qualifier of a `Select` is a `SymTree`; it may be a `Block`. One place that happens is after the transformation of named/defaults applications. That causes the reported `NullPointerException'. In any case, using `qual.symbol.pos` sense here; it yields the position of the defintions *referred to* by `qual`, not the position of `qual` itself. Both problems are easily fixed: use `qual.pos` instead. Fixes #1107
This commit is contained in:
parent
361c34324e
commit
af7eca1080
|
|
@ -27,3 +27,8 @@ key1 := {
|
||||||
)
|
)
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/sbt/sbt/issues/1107
|
||||||
|
def appcfgTask(a: String, b: String) = Def.task("")
|
||||||
|
|
||||||
|
TaskKey[Unit]("test") := appcfgTask(b = "", a = "").value
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ object Instance
|
||||||
def addType(tpe: Type, qual: Tree, selection: Tree): Tree =
|
def addType(tpe: Type, qual: Tree, selection: Tree): Tree =
|
||||||
{
|
{
|
||||||
qual.foreach(checkQual)
|
qual.foreach(checkQual)
|
||||||
val vd = util.freshValDef(tpe, qual.symbol.pos, functionSym)
|
val vd = util.freshValDef(tpe, qual.pos, functionSym)
|
||||||
inputs ::= new Input(tpe, qual, vd)
|
inputs ::= new Input(tpe, qual, vd)
|
||||||
util.refVal(selection, vd)
|
util.refVal(selection, vd)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue