Handle Global in Scope#toString

Print "Global" instead of "Zero / Zero / Zero".
This commit is contained in:
Dale Wijnand 2017-10-05 20:21:38 +01:00
parent 05c2c506b2
commit 2a5ba9475d
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
1 changed files with 4 additions and 3 deletions

View File

@ -29,9 +29,10 @@ final case class Scope(project: ScopeAxis[Reference],
def in(config: ConfigKey): Scope = copy(config = Select(config))
def in(task: AttributeKey[_]): Scope = copy(task = Select(task))
override def toString: String = {
if (extra == This) s"$project / $config / $task"
else s"Scope($project, $config, $task, $extra)"
override def toString: String = this match {
case Scope(Zero, Zero, Zero, Zero) => "Global"
case Scope(_, _, _, This) => s"$project / $config / $task"
case _ => s"Scope($project, $config, $task, $extra)"
}
}
object Scope {