Skip to content

Commit

Permalink
Cross-build for Scala 2.12 (fix stanch#5), release 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stanch committed Apr 14, 2017
1 parent 064c8ff commit 0b3f8da
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 43 deletions.
9 changes: 8 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
val commonSettings = Seq(
organization := "org.stanch",
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8", "2.12.1"),
scalacOptions ++= Seq(
"-feature", "-deprecation",
"-Xlint", "-Ywarn-unused-import", "-Xfatal-warnings"
),
scalacOptions in (Compile, doc) += "-no-link-warnings",
resolvers += Resolver.bintrayRepo("stanch", "maven"),
licenses := Seq(("GPL-3.0", url("http://www.gnu.org/licenses/gpl-3.0.en.html")))
)

val core = project.settings(commonSettings: _*).settings(
name := "reftree",
version := "0.8.2",
version := "0.9.0",
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.2",
"com.lihaoyi" %% "sourcecode" % "0.1.3",
Expand Down Expand Up @@ -53,5 +59,6 @@ val demo = project.settings(commonSettings: _*).dependsOn(core).settings(

addCommandAlias("demo", "demo/test:console")

commonSettings
publish := {}
publishLocal := {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package reftree.contrib

import reftree.core._
import zipper.Zipper

/**
* This object includes several simplified [[RefTree]] representations
Expand Down
76 changes: 36 additions & 40 deletions core/src/main/scala/reftree/core/CollectionInstances.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import reftree.util.Reflection.PrivateFields
trait CollectionInstances {
implicit def `Option RefTree`[A: ToRefTree]: ToRefTree[Option[A]] = ToRefTree[Option[A]] {
case value @ Some(a) RefTree.Ref(value, Seq(a.refTree))
case value @ None RefTree.Ref(value, Seq.empty).rename("None")
case value RefTree.Ref(value, Seq.empty).rename("None")
}

implicit def `Array RefTree`[A: ToRefTree]: ToRefTree[Array[A]] = ToRefTree[Array[A]] { value
Expand Down Expand Up @@ -80,48 +80,44 @@ trait CollectionInstances {
}

implicit def `HashSet RefTree`[A: ToRefTree]: ToRefTree[HashSet[A]] =
ToRefTree[HashSet[A]] { value
if (value.isEmpty) {
RefTree.Ref(value, Seq.empty).rename("HashSet.EmptyHashSet")
} else value match {
case leaf: HashSet.HashSet1[A]
val hash = leaf.privateField[Int]("hash")
val key = leaf.privateField[A]("key")
RefTree.Ref(leaf, Seq(hash.refTree, key.refTree)).rename("HashSet.HashSet1")
case collision: HashSet.HashSetCollision1[A]
val hash = collision.privateField[Int]("hash")
val ks = collision.privateField[ListSet[A]]("ks")
RefTree.Ref(collision, Seq(hash.refTree, ks.refTree)).rename("HashSet.HashSetCollision1")
case trie: HashSet.HashTrieSet[A]
val size = trie.privateField[Int]("size0")
val bitmap = trie.privateField[Int]("bitmap")
val elems = trie.privateField[Array[HashSet[A]]]("elems")
val binBitmap = RefTree.Val(bitmap, Some(RefTree.Val.Bin), highlight = false, elide = false)
RefTree.Ref(trie, Seq(size.refTree, binBitmap, elems.refTree)).rename("HashSet.HashTrieSet")
}
ToRefTree[HashSet[A]] {
case leaf: HashSet.HashSet1[A]
val hash = leaf.privateField[Int]("hash")
val key = leaf.privateField[A]("key")
RefTree.Ref(leaf, Seq(hash.refTree, key.refTree)).rename("HashSet.HashSet1")
case collision: HashSet.HashSetCollision1[A]
val hash = collision.privateField[Int]("hash")
val ks = collision.privateField[ListSet[A]]("ks")
RefTree.Ref(collision, Seq(hash.refTree, ks.refTree)).rename("HashSet.HashSetCollision1")
case trie: HashSet.HashTrieSet[A]
val size = trie.privateField[Int]("size0")
val bitmap = trie.privateField[Int]("bitmap")
val elems = trie.privateField[Array[HashSet[A]]]("elems")
val binBitmap = RefTree.Val(bitmap, Some(RefTree.Val.Bin), highlight = false, elide = false)
RefTree.Ref(trie, Seq(size.refTree, binBitmap, elems.refTree)).rename("HashSet.HashTrieSet")
case empty
RefTree.Ref(empty, Seq.empty).rename("HashSet.EmptyHashSet")
}

implicit def `HashMap RefTree`[A: ToRefTree, B: ToRefTree]: ToRefTree[HashMap[A, B]] =
ToRefTree[HashMap[A, B]] { value
if (value.isEmpty) {
RefTree.Ref(value, Seq.empty).rename("HashMap.EmptyHashMap")
} else value match {
case leaf: HashMap.HashMap1[A, B]
val hash = leaf.privateField[Int]("hash")
val key = leaf.privateField[A]("key")
val value = leaf.privateField[A]("value")
RefTree.Ref(leaf, Seq(hash.refTree, key.refTree, value.refTree)).rename("HashMap.HashMap1")
case collision: HashMap.HashMapCollision1[A, B]
val hash = collision.privateField[Int]("hash")
val kvs = collision.privateField[ListMap[A, B]]("kvs")
RefTree.Ref(collision, Seq(hash.refTree, kvs.refTree)).rename("HashMap.HashMapCollision1")
case trie: HashMap.HashTrieMap[A, B]
val size = trie.privateField[Int]("size0")
val bitmap = trie.privateField[Int]("bitmap")
val elems = trie.privateField[Array[HashMap[A, B]]]("elems")
val binBitmap = RefTree.Val(bitmap, Some(RefTree.Val.Bin), highlight = false, elide = false)
RefTree.Ref(trie, Seq(size.refTree, binBitmap, elems.refTree)).rename("HashMap.HashTrieMap")
}
ToRefTree[HashMap[A, B]] {
case leaf: HashMap.HashMap1[A, B]
val hash = leaf.privateField[Int]("hash")
val key = leaf.privateField[A]("key")
val value = leaf.privateField[A]("value")
RefTree.Ref(leaf, Seq(hash.refTree, key.refTree, value.refTree)).rename("HashMap.HashMap1")
case collision: HashMap.HashMapCollision1[A, B]
val hash = collision.privateField[Int]("hash")
val kvs = collision.privateField[ListMap[A, B]]("kvs")
RefTree.Ref(collision, Seq(hash.refTree, kvs.refTree)).rename("HashMap.HashMapCollision1")
case trie: HashMap.HashTrieMap[A, B]
val size = trie.privateField[Int]("size0")
val bitmap = trie.privateField[Int]("bitmap")
val elems = trie.privateField[Array[HashMap[A, B]]]("elems")
val binBitmap = RefTree.Val(bitmap, Some(RefTree.Val.Bin), highlight = false, elide = false)
RefTree.Ref(trie, Seq(size.refTree, binBitmap, elems.refTree)).rename("HashMap.HashTrieMap")
case empty
RefTree.Ref(empty, Seq.empty).rename("HashMap.EmptyHashMap")
}

private def redBlackTreeRefTree[A: ToRefTree, B: ToRefTree](
Expand Down
1 change: 0 additions & 1 deletion demo/src/main/scala/reftree/demo/AnimationExamples.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import de.sciss.fingertree.{FingerTree, Measure}
import com.softwaremill.quicklens._
import monocle.function.all._
import monocle.macros.GenLens
import monocle.std.list._
import reftree.core.RefTree
import reftree.diagram.{Diagram, Animation}
import reftree.render.{AnimationOptions, RenderingOptions, Renderer}
Expand Down

0 comments on commit 0b3f8da

Please sign in to comment.