Skip to content

Commit

Permalink
get rest compiling, and update build/ci somewhat
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek committed Nov 6, 2024
1 parent 8d14477 commit e3b5c56
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 44 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- '8'
- '11'
scala:
- '2.13.15'
- '3.5.2'
timeout-minutes: 30
testPY:
runs-on: ubuntu-latest
Expand All @@ -44,7 +44,7 @@ jobs:
java:
- '11'
scala:
- '2.13.15'
- '3.5.2'
python:
- '3.9'
timeout-minutes: 30
Expand All @@ -66,7 +66,7 @@ jobs:
java:
- '11'
scala:
- '2.13.15'
- '3.5.2'
timeout-minutes: 30
testWithCoverageReport:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
strategy:
matrix:
scala:
- '2.13.15'
- '3.5.2'
java:
- '8'
name: ci
Expand Down
16 changes: 9 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ lazy val commonSettings = Seq(
"utf-8", // Specify character encoding used by source files.
//"-rewrite", "-source", "3.4-migration",
"-explaintypes", // Explain type errors in more detail.
"-explain",
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:higherKinds", // Allow higher-kinded types
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
//"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
// "-Xfatal-warnings", // Fail the compilation if there are any warnings.
/*
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
// "-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
Expand All @@ -40,19 +42,19 @@ lazy val commonSettings = Seq(
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
*/
// "-Ywarn-dead-code", // Warn when dead code is identified. // this kills ability to use ???
// "-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused",
//"-Ywarn-numeric-widen", // Warn when numerics are widened.
//"-Ywarn-unused",
// "-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
/* "-Ywarn-unused:locals", // Warn if a local definition is unused */
/* "-Ywarn-unused:params", // Warn if a value parameter is unused. */
/* "-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused. */
/* "-Ywarn-unused:privates", // Warn if a private member is unused. */
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused.
"-Xsource:3",
"-Ypatmat-exhaust-depth",
"40",
//"-Ywarn-value-discard", // Warn when non-Unit expression results are unused.
//"-Xsource:3",
//"-Ypatmat-exhaust-depth", "40",
"-Wconf:cat=deprecation&msg=.*Stream.*:s"
),
Compile / console / scalacOptions --= Seq(
Expand Down
6 changes: 3 additions & 3 deletions cli/src/main/scala/org/bykn/bosatsu/TypedExprToProto.scala
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ object ProtoConverter {
}
}

buildTable(types.toArray)(typeFromProto _)
buildTable(types.toArray)(typeFromProto)
}

def buildPatterns(
Expand Down Expand Up @@ -426,7 +426,7 @@ object ProtoConverter {
}
}

buildTable(pats.toArray)(patternFromProto _)
buildTable(pats.toArray)(patternFromProto)
}

def recursionKindFromProto(
Expand Down Expand Up @@ -567,7 +567,7 @@ object ProtoConverter {
}
}

buildTable(exprs.toArray)(expressionFromProto _)
buildTable(exprs.toArray)(expressionFromProto)
}

private def parsePack(pstr: String, context: => String): Try[PackageName] =
Expand Down
16 changes: 8 additions & 8 deletions cli/src/test/scala/org/bykn/bosatsu/PathModuleTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class PathModuleTest extends AnyFunSuite {
val out = run(
s"test $inputs --test_file test_workspace/Queue.bosatsu"
.split("\\s+")
.toSeq: _*
.toSeq*
)
out match {
case PathModule.Output.TestOutput(results, _) =>
Expand All @@ -138,7 +138,7 @@ class PathModuleTest extends AnyFunSuite {
val out = run(
"test --package_root test_workspace --search --test_file test_workspace/Bar.bosatsu"
.split("\\s+")
.toSeq: _*
.toSeq*
)
out match {
case PathModule.Output.TestOutput(results, _) =>
Expand All @@ -156,7 +156,7 @@ class PathModuleTest extends AnyFunSuite {
val out = run(
"transpile --input_dir test_workspace/ --outdir pyout --lang python --package_root test_workspace --externals test_workspace/Prog.bosatsu_externals --evaluators test_workspace/Prog.bosatsu_eval"
.split("\\s+")
.toSeq: _*
.toSeq*
)
out match {
case PathModule.Output.TranspileOut(_, _) =>
Expand All @@ -170,7 +170,7 @@ class PathModuleTest extends AnyFunSuite {
val out = run(
"json write --package_root test_workspace --search --main_file test_workspace/Bar.bosatsu"
.split("\\s+")
.toSeq: _*
.toSeq*
)
out match {
case PathModule.Output.JsonOutput(j @ Json.JObject(_), _) =>
Expand All @@ -191,7 +191,7 @@ class PathModuleTest extends AnyFunSuite {
.split("\\s+")
.toList :+ "[2, 4]"

run(cmd: _*) match {
run(cmd*) match {
case PathModule.Output.JsonOutput(Json.JNumberStr("8"), _) => succeed
case other => fail(s"expected json object output: $other")
}
Expand All @@ -203,7 +203,7 @@ class PathModuleTest extends AnyFunSuite {
.split("\\s+")
.toList :+ "[[2, 4], [3, 5]]"

run(cmd: _*) match {
run(cmd*) match {
case PathModule.Output.JsonOutput(
Json.JArray(Vector(Json.JNumberStr("8"), Json.JNumberStr("15"))),
_
Expand Down Expand Up @@ -267,7 +267,7 @@ class PathModuleTest extends AnyFunSuite {
val out = run(
"test --package_root test_workspace --input_dir test_workspace"
.split("\\s+")
.toSeq: _*
.toSeq*
)
out match {
case PathModule.Output.TestOutput(res, _) =>
Expand All @@ -285,7 +285,7 @@ class PathModuleTest extends AnyFunSuite {
run(
"json write --package_root test_workspace --input test_workspace/Foo.bosatsu --main Foo::x"
.split("\\s+")
.toSeq: _*
.toSeq*
) match {
case PathModule.Output.JsonOutput(Json.JString("this is Foo"), _) =>
succeed
Expand Down
30 changes: 15 additions & 15 deletions cli/src/test/scala/org/bykn/bosatsu/TestProtoType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class TestProtoType extends AnyFunSuite with ParTest {
pats = ProtoConverter.buildPatterns(ss.patterns.inOrder).map(_(idx - 1))
res <- pats.local[ProtoConverter.DecodeState](_.withTypes(tps))
} yield res
}(Eq.fromUniversalEquals)
}(using Eq.fromUniversalEquals)

forAll(Generators.genCompiledPattern(5))(testFn)
}
Expand All @@ -125,7 +125,7 @@ class TestProtoType extends AnyFunSuite with ParTest {
_.withTypes(tps).withPatterns(patTab)
)
} yield res
}(Eq.fromUniversalEquals)
}(using Eq.fromUniversalEquals)

forAll(
Generators.genTypedExpr(Gen.const(()), 4, rankn.NTypeGen.genDepth03)
Expand All @@ -136,9 +136,9 @@ class TestProtoType extends AnyFunSuite with ParTest {
forAll(Generators.interfaceGen) { iface =>
law(
iface,
ProtoConverter.interfaceToProto _,
ProtoConverter.interfaceFromProto _
)(Eq.fromUniversalEquals)
ProtoConverter.interfaceToProto,
ProtoConverter.interfaceFromProto
)(using Eq.fromUniversalEquals)
}
}

Expand All @@ -155,9 +155,9 @@ class TestProtoType extends AnyFunSuite with ParTest {
ifaces =>
law(
ifaces,
ProtoConverter.interfacesToProto[List] _,
ProtoConverter.interfacesFromProto _
)(sortedEq)
ProtoConverter.interfacesToProto[List],
ProtoConverter.interfacesFromProto
)(using sortedEq)
}
}

Expand All @@ -168,9 +168,9 @@ class TestProtoType extends AnyFunSuite with ParTest {
}.toList
law(
ifaces,
ProtoConverter.interfacesToProto[List] _,
ProtoConverter.interfacesFromProto _
)(sortedEq)
ProtoConverter.interfacesToProto[List],
ProtoConverter.interfacesFromProto
)(using sortedEq)
}
}

Expand Down Expand Up @@ -211,9 +211,9 @@ bar = 1
packs.toMap.values.toList.sortBy(_.name).map { pt =>
Package.setProgramFrom(tf.void(pt), ())
},
ser _,
deser _
)(Eq.fromUniversalEquals)
ser,
deser
)(using Eq.fromUniversalEquals)
)
}

Expand All @@ -227,7 +227,7 @@ bar = 1
}

val packList = packMap.toList.sortBy(_._1).map(_._2)
law(packList, ser _, deser _)(Eq.fromUniversalEquals)
law(packList, ser, deser)(using Eq.fromUniversalEquals)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ else:
assert(block(Pass, Pass) == Pass)

forAll(genNel(4, genStatement(3))) { case NonEmptyList(h, t) =>
val stmt = block(h, t: _*)
val stmt = block(h, t*)

def passCount(s: Statement): Int =
s match {
Expand Down Expand Up @@ -560,7 +560,7 @@ else:

forAll(genArgs) { case (lam, arg) =>
assert(
lam(arg: _*).simplify == Code
lam(arg*).simplify == Code
.substitute(lam.args.zip(arg).toMap, lam.result)
.simplify
)
Expand Down
2 changes: 1 addition & 1 deletion core/.js/src/main/scala/org/bykn/bosatsu/Par.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package org.bykn.bosatsu
*/
object Par {
class Box[A] {
private[this] var value: A = _
private var value: A = scala.compiletime.uninitialized
def set(a: A): Unit =
value = a
def get: A = value
Expand Down
4 changes: 2 additions & 2 deletions jsapi/src/main/scala/org/bykn/bosatsu/jsapi/JsApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object JsApi {
private def splitPath(p: String): List[String] =
p.split("/", -1).toList.map(_.toLowerCase.capitalize)

private val module = new MemoryMain[Either[Throwable, *], String](splitPath)
private val module = new MemoryMain[[X] =>> Either[Throwable, X], String](splitPath)

private def makeInputArgs(keys: Iterable[String]): List[String] =
keys.iterator.flatMap(key => "--input" :: key :: Nil).toList
Expand Down Expand Up @@ -71,7 +71,7 @@ object JsApi {
case Json.JObject(kvs) =>
js.Dictionary[js.Any](kvs.map { case (k, v) =>
(k, jsonToAny(v))
}: _*)
}*)
}

/** mainPackage can be null, in which case we find the package in mainFile
Expand Down
2 changes: 1 addition & 1 deletion jsui/.js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jsui/src/main/scala/org/bykn/bosatsu/jsui/Store.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Action.Cmd

object Store {
val memoryMain =
new MemoryMain[Either[Throwable, *], String](_.split("/", -1).toList)
new MemoryMain[[X] =>> Either[Throwable, X], String](_.split("/", -1).toList)

type HandlerFn = memoryMain.Output => String
def cmdHandler(cmd: Cmd): (List[String], HandlerFn) =
Expand Down

0 comments on commit e3b5c56

Please sign in to comment.