From 9b94a16b73fd708a9fe33cf8c1548d62634a4c07 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Fri, 12 Sep 2014 20:51:04 +0200 Subject: [PATCH] Undone the revert on the optimization, and fixed setAll() The optimization, and therefore the change in the behavior of Relation, is now needed by the class Logic, and cannot be reverted. This patch (written by Josh) therefore changes the implementation of setAll() so that _1s is no longer used. --- main/src/main/scala/sbt/SettingCompletions.scala | 4 ++-- util/relation/src/main/scala/sbt/Relation.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main/src/main/scala/sbt/SettingCompletions.scala b/main/src/main/scala/sbt/SettingCompletions.scala index f3668de79..6b94c4c6b 100644 --- a/main/src/main/scala/sbt/SettingCompletions.scala +++ b/main/src/main/scala/sbt/SettingCompletions.scala @@ -27,7 +27,7 @@ private[sbt] object SettingCompletions { { import extracted._ val r = relation(extracted.structure, true) - val allDefs = r._1s.toSeq + val allDefs = Def.flattenLocals(Def.compiled(extracted.structure.settings, true)(structure.delegates, structure.scopeLocal, implicitly[Show[ScopedKey[_]]])).map(_._1) val projectScope = Load.projectScope(currentRef) def resolve(s: Setting[_]): Seq[Setting[_]] = Load.transformSettings(projectScope, currentRef.build, rootProject, s :: Nil) def rescope[T](setting: Setting[T]): Seq[Setting[_]] = @@ -353,4 +353,4 @@ private[sbt] object SettingCompletions { classOf[Long], classOf[String] ) -} \ No newline at end of file +} diff --git a/util/relation/src/main/scala/sbt/Relation.scala b/util/relation/src/main/scala/sbt/Relation.scala index dcd38fa90..987aafb14 100644 --- a/util/relation/src/main/scala/sbt/Relation.scala +++ b/util/relation/src/main/scala/sbt/Relation.scala @@ -129,7 +129,7 @@ private final class MRelation[A, B](fwd: Map[A, Set[B]], rev: Map[B, Set[A]]) ex def +(pair: (A, B)) = this + (pair._1, Set(pair._2)) def +(from: A, to: B) = this + (from, to :: Nil) - def +(from: A, to: Traversable[B]) = + def +(from: A, to: Traversable[B]) = if (to.isEmpty) this else new MRelation(add(fwd, from, to), (rev /: to) { (map, t) => add(map, t, from :: Nil) }) def ++(rs: Traversable[(A, B)]) = ((this: Relation[A, B]) /: rs) { _ + _ }