Fixes Zero / Zero / Zero / name handling

Prior to this change `Zero / Zero / Zero / name` broke as folllows:

```
scala> Zero / Zero / Zero / name
Zero / Zero / Zero / name
<console>:18: error: inferred type arguments [sbt.Zero.type] do not conform to method /'s type parameter bounds [K <: sbt.SlashSyntax.Key[K]]
       Zero / Zero / Zero / name
                   ^
```
This commit is contained in:
Eugene Yokota 2017-10-05 02:43:50 -04:00
parent dd9b2b2f3a
commit 53bbb99617
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package sbt
import sbt.librarymanagement.Configuration
import sbt.internal.util.AttributeKey
/**
* SlashSyntax implements the slash syntax to scope keys for build.sbt DSL.
@ -57,7 +58,12 @@ object SlashSyntax {
}
/** RichConfiguration wraps a configuration to provide the `/` operator for scoping. */
final class RichConfiguration(protected val scope: Scope) extends RichScopeLike
final class RichConfiguration(protected val scope: Scope) extends RichScopeLike {
// This is for handling `Zero / Zero / Zero / name`.
def /(taskAxis: ScopeAxis[AttributeKey[_]]): RichScope =
new RichScope(scope.copy(task = taskAxis))
}
/** Both `Scoped.ScopingSetting` and `Scoped` are parents of `SettingKey`, `TaskKey` and
* `InputKey`. We'll need both, so this is a convenient type alias. */

View File

@ -10,6 +10,7 @@ lazy val root = (project in file("."))
Compile / console / scalacOptions += "-Ywarn-numeric-widen",
projA / Compile / console / scalacOptions += "-feature",
Zero / Zero / name := "foo",
Zero / Zero / Zero / name := "foo",
libraryDependencies += uTest % Test,
testFrameworks += new TestFramework("utest.runner.Framework"),