aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchuyler Eldridge2018-12-12 01:54:22 -0500
committerGitHub2018-12-12 01:54:22 -0500
commit95801dca4d5667b3a87bed58085ef7476ae87f8b (patch)
tree15fdb4b390adf24d1604a3d57f7da8ff13bacfa5 /src
parent50ba95fe05cc348496425733554be5fc7d797de1 (diff)
parentc2de91d1d94a403fdeac8d3f45b2d67392cc4d9b (diff)
Merge pull request #963 from seldridge/digraph-add-fix
Remove side effect from DiGraph sum
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/firrtl/graph/DiGraph.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/graph/DiGraph.scala b/src/main/scala/firrtl/graph/DiGraph.scala
index 1d15d505..9cfcad52 100644
--- a/src/main/scala/firrtl/graph/DiGraph.scala
+++ b/src/main/scala/firrtl/graph/DiGraph.scala
@@ -349,8 +349,8 @@ class DiGraph[T] private[graph] (private[graph] val edges: LinkedHashMap[T, Link
* @return a DiGraph[T] containing all vertices and edges of each graph
*/
def +(that: DiGraph[T]): DiGraph[T] = {
- val eprime = edges.clone
- that.edges.map({ case (k, v) => eprime.getOrElseUpdate(k, new LinkedHashSet[T]) ++= v })
+ val eprime = edges.map({ case (k, v) => (k, v.clone) })
+ that.edges.foreach({ case (k, v) => eprime.getOrElseUpdate(k, new LinkedHashSet[T]) ++= v })
new DiGraph(eprime)
}
}