- revert scalaVersion from 2.12.6 to 2.12.4 because `1.0 until ...` is deprecated in 2.12.6
  - recommended workaround is to use BigDecimal ranges, but this shallow fix caused a ClassCastException

- revert sbt to 0.13.17 because unlike local sbt, Travis CI's sbt doesn't know how to self-upgrade to 1.1.x

- add implicit syntax for `Int => UInt64` ; our existing `Int => Term` implicit produces `Int64`.
This commit is contained in:
Arya Irani 2018-06-27 12:48:14 -04:00
parent 41497a1240
commit 763bd3a750
4 changed files with 14 additions and 6 deletions

View File

@ -14,7 +14,7 @@ lazy val commonSettings = Seq(
//"-XX:LiveNodeCountInliningCutoff"
),
organization := "org.unisonweb",
scalaVersion := "2.12.6",
scalaVersion := "2.12.4",
scalacOptions ++= Seq(
"-feature",
"-deprecation",

View File

@ -477,9 +477,17 @@ object Term {
def apply(args: Term*) = Apply(fn, args: _*)
}
implicit class IntegerSyntax(val i: Int) extends AnyVal {
def unsigned: Term = Unboxed(intToUnboxed(i), UnboxedType.UInt64)
}
implicit class LongSyntax(val l: Long) extends AnyVal {
def unsigned: Term = Unboxed(longToUnboxed(l), UnboxedType.UInt64)
}
implicit def bool(b: Boolean): Term = Unboxed(boolToUnboxed(b), UnboxedType.Boolean)
implicit def number(n: Long): Term = Unboxed(longToUnboxed(n), UnboxedType.Int64)
implicit def number(n: Int): Term = Unboxed(intToUnboxed(n), UnboxedType.Int64)
implicit def signed(n: Long): Term = Unboxed(longToUnboxed(n), UnboxedType.Int64)
implicit def signed(n: Int): Term = Unboxed(intToUnboxed(n), UnboxedType.Int64)
implicit def double(n: Double): Term = Unboxed(doubleToUnboxed(n), UnboxedType.Float)
implicit def stringAsText(s: String): Term = Text(util.Text.fromString(s))
implicit def nameAsVar(s: Name): Term = Var(s)

View File

@ -354,13 +354,13 @@ object CompilationTests {
ok
},
test("ex1") { implicit T =>
equal(eval(Sequence.size(Sequence(1,2,3))), 3: Term)
equal(eval(Sequence.size(Sequence(1,2,3))), 3.unsigned)
},
test("ex2 (underapplication)") { implicit T =>
val t: Term =
Let('x -> Sequence(1,2,3),
'fn -> Sequence.take(2))(Sequence.size('fn.v('x)))
equal(eval(t), 2: Term)
equal(eval(t), 2.unsigned)
}
),
suite("text") (

View File

@ -1 +1 @@
sbt.version=1.1.2
sbt.version=0.13.17