Skip to content

Commit 0714d9d

Browse files
committed
Cross-build for Scala 2.13.0
1 parent 5bc544c commit 0714d9d

File tree

8 files changed

+29
-28
lines changed

8 files changed

+29
-28
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
ScalaZ3 for Scala 2.10, 2.11, and 2.12
2-
======================================
1+
ScalaZ3
2+
=======
33

4-
This is ScalaZ3 for Z3 4.7.1 and Scala 2.10, 2.11, and 2.12.
4+
This is ScalaZ3 for Z3 4.7.1 and Scala 2.10, 2.11, 2.12, and 2.13.
55

66
Compiling ScalaZ3
77
-----------------
@@ -14,7 +14,7 @@ Run
1414

1515
sbt +package
1616

17-
to compile Z3 4.7.1 and cross-compile ScalaZ3 for Scala 2.10, 2.11 and 2.12.
17+
to compile Z3 4.7.1 and cross-compile ScalaZ3 for Scala 2.10, 2.11, 2.12 and 2.13.
1818

1919
The JAR files will be in `target/scala-2.XX/scalaz3_2.XX-4.7.1.jar`
2020
and will contain the shared library dependencies.
@@ -74,13 +74,13 @@ Using ScalaZ3
7474

7575
### On a single operating system / architecture
7676

77-
Create a folder named `unmanaged` at the same level as your `build.sbt` file, and copy the JAR file in `target/scala-2.XX/scalaz3_2.XX-3.0.jar` into it.
77+
Create a folder named `unmanaged` at the same level as your `build.sbt` file, and copy the JAR file in `target/scala-2.XX/scalaz3_2.XX-4.7.1.jar` into it.
7878

7979
Then add, the following lines to your `build.sbt` file:
8080

8181
```scala
8282
unmanagedJars in Compile += {
83-
baseDirectory.value / "unmanaged" / s"scalaz3_${scalaBinaryVersion.value}-3.0.jar"
83+
baseDirectory.value / "unmanaged" / s"scalaz3_${scalaBinaryVersion.value}-4.7.1.jar"
8484
}
8585
```
8686

@@ -92,7 +92,7 @@ Make sure to name the resulting JAR files as `scalaz3-[osName]-[osArch]-[scalaBi
9292

9393
- `[osName]` is one of: `mac`, `win`, `unix`.
9494
- `[osArch]` corresponds to `System.getProperty("sun.arch.data.model")`, ie. `x64`, `fds`, etc.
95-
- `[scalaBinaryVersion]` is one of: `2.11`, `2.12`, `2.13`.
95+
- `[scalaBinaryVersion]` is one of: `2.10`, `2.11`, `2.12`, `2.13`.
9696

9797
Create a folder named `unmanaged` at the same level as your `build.sbt` file, and copy the aforementioned JAR files into it.
9898

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ lazy val root = (project in file("."))
1111
"-feature",
1212
),
1313
scalaVersion := "2.12.8",
14-
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.8"),
14+
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.8", "2.13.0"),
1515
libraryDependencies ++= Seq(
16-
"org.scalatest" %% "scalatest" % "3.0.7" % "test"
16+
"org.scalatest" %% "scalatest" % "3.0.8" % "test"
1717
),
1818
libraryDependencies ++= {
1919
CrossVersion.partialVersion(scalaVersion.value) match {

src/main/scala/z3/scala/Z3Context.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ sealed class Z3Context(val config: Map[String, String]) {
4141
val optimizerQueue = new Z3RefCountQueue[Z3Optimizer]
4242
val tacticQueue = new Z3RefCountQueue[Z3Tactic]
4343

44-
def this(params: (String,Any)*) = this(Map[String, Any](params : _*).mapValues(_.toString))
44+
def this(params: (String, Any)*) =
45+
this(params.map { case (s, a) => (s, a.toString) }.toMap)
4546

4647
private var deleted : Boolean = false
4748
override def finalize() : Unit = {
@@ -219,7 +220,7 @@ sealed class Z3Context(val config: Map[String, String]) {
219220

220221
consListList.foreach(cl => Native.delConstructorList(this.ptr, cl))
221222

222-
for((sort, consLst) <- (newSorts zip consScalaList)) yield {
223+
for((sort, consLst) <- (newSorts.toIndexedSeq zip consScalaList)) yield {
223224
val zipped = for (cons <- consLst) yield {
224225
val consFunPtr = new Native.LongPtr()
225226
val testFunPtr = new Native.LongPtr()
@@ -484,7 +485,7 @@ sealed class Z3Context(val config: Map[String, String]) {
484485
val sz = sorts.size
485486
val consPtr = new Native.LongPtr()
486487
val projFuns = new Array[Long](sz)
487-
val fieldNames = sorts.map(s => mkFreshStringSymbol(name + "-field")).toArray
488+
val fieldNames = sorts.map(s => mkFreshStringSymbol(s"$name-field")).toArray
488489
val sortPtr = Native.mkTupleSort(this.ptr, name.ptr, sz, fieldNames.map(_.ptr), sorts.map(_.ptr).toArray, consPtr, projFuns)
489490
val newSort = new Z3Sort(sortPtr, this)
490491
val consFuncDecl = new Z3FuncDecl(consPtr.value, sz, this)

src/test/scala/z3/scala/Abs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class Abs extends FunSuite with Matchers {
2727
result should equal(Some(true))
2828

2929
val array2Ev = model.eval(array2)
30-
array2Ev should be ('defined)
30+
array2Ev should be (Symbol("defined"))
3131
val array2Val = model.getArrayValue(array2Ev.get)
32-
array2Val should be ('defined)
32+
array2Val should be (Symbol("defined"))
3333
val (valueMap, default) = array2Val.get
3434
valueMap(z3.mkInt(0, is)) should equal (z3.mkInt(1, is))
3535
valueMap(z3.mkInt(1, is)) should equal (z3.mkInt(0, is))

src/test/scala/z3/scala/Arrays.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class Arrays extends FunSuite with Matchers {
3232
result should equal(Some(true))
3333

3434
val array1Evaluated = model.eval(array1)
35-
array1Evaluated should be ('defined)
35+
array1Evaluated should be (Symbol("defined"))
3636
array1Evaluated match {
3737
case Some(ae) =>
3838
val array1Val = model.getArrayValue(ae)
39-
array1Val should be ('defined)
39+
array1Val should be (Symbol("defined"))
4040
//println("When evaluated, array1 is: " + array1Val)
4141
array1Val match {
4242
case Some((valueMap,default)) =>
@@ -47,11 +47,11 @@ class Arrays extends FunSuite with Matchers {
4747
}
4848

4949
val array2Evaluated = model.eval(array2)
50-
array2Evaluated should be ('defined)
50+
array2Evaluated should be (Symbol("defined"))
5151
array2Evaluated match {
5252
case Some(ae) => {
5353
val array2Val = model.getArrayValue(ae)
54-
array2Val should be ('defined)
54+
array2Val should be (Symbol("defined"))
5555
//println("When evaluated, array2 is: " + array2Val)
5656
array2Val match {
5757
case Some((valueMap,default)) => {

src/test/scala/z3/scala/Quantifiers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class Quantifiers extends FunSuite with Matchers {
3636
* (declare-fun array-of (Type) Type)
3737
*/
3838
val typeSort = z3.mkUninterpretedSort("Type")
39-
val subtype = z3.mkFuncDecl("subtype", List[Z3Sort](typeSort, typeSort).toArray, z3.mkBoolSort)
40-
val arrayOf = z3.mkFuncDecl("array-of", List[Z3Sort](typeSort).toArray, typeSort)
39+
val subtype = z3.mkFuncDecl("subtype", List[Z3Sort](typeSort, typeSort).toIndexedSeq, z3.mkBoolSort)
40+
val arrayOf = z3.mkFuncDecl("array-of", List[Z3Sort](typeSort).toIndexedSeq, typeSort)
4141

4242
val syms @ List(xSym, ySym, zSym) = List("x", "y", "z").map(z3.mkSymbol(_))
4343
val consts @ List(x, y, z) = syms.map(sym => z3.mkConst(sym, typeSort))

src/test/scala/z3/scala/Sequences.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Sequences extends FunSuite with Matchers {
2121
val s1eval = model.eval(s1)
2222
val s2eval = model.eval(s2)
2323

24-
s1eval should be ('defined)
25-
s2eval should be ('defined)
24+
s1eval should be (Symbol("defined"))
25+
s2eval should be (Symbol("defined"))
2626
}
2727

2828
test("Different head") {
@@ -61,7 +61,7 @@ class Sequences extends FunSuite with Matchers {
6161
val s1eval = model.eval(s1)
6262
val s2eval = model.eval(s2)
6363

64-
s1eval should be ('defined)
65-
s2eval should be ('defined)
64+
s1eval should be (Symbol("defined"))
65+
s2eval should be (Symbol("defined"))
6666
}
6767
}

src/test/scala/z3/scala/Sets.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ class Sets extends FunSuite with Matchers {
2020

2121
val s1eval = model.eval(s1)
2222
val s2eval = model.eval(s2)
23-
s1eval should be ('defined)
24-
s2eval should be ('defined)
23+
s1eval should be (Symbol("defined"))
24+
s2eval should be (Symbol("defined"))
2525
(s1eval,s2eval) match {
2626
case (Some(se1), Some(se2)) =>
2727
val s1val = model.getSetValue(se1)
2828
val s2val = model.getSetValue(se2)
29-
s1val should be ('defined)
30-
s2val should be ('defined)
29+
s1val should be (Symbol("defined"))
30+
s2val should be (Symbol("defined"))
3131
s1val should not equal (s2val)
3232
//println("Set values :" + s1val + ", " + s2val)
3333
case _ =>

0 commit comments

Comments
 (0)