Skip to content

Commit

Permalink
Upgrade to Scala 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Apr 9, 2024
1 parent 8f33a7c commit adc9a59
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ ThisBuild / versionScheme := Some("early-semver")
ThisBuild / scalaVersion := scala3Version

lazy val tyrianVersion = TyrianVersion.getVersion
lazy val scala3Version = "3.3.3"
lazy val scala3Version = "3.4.1"
lazy val tyrianDocsVersion = "0.10.0"
lazy val scalaJsDocsVersion = "1.16.0"
lazy val scalaDocsVersion = "3.3.3"
lazy val scalaDocsVersion = "3.4.1"
lazy val indigoDocsVersion = "0.16.0"

lazy val commonSettings: Seq[sbt.Def.Setting[_]] = Seq(
Expand Down
2 changes: 1 addition & 1 deletion examples/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sbtwelcome._
Global / onChangedBuildSource := ReloadOnSourceChanges

lazy val tyrianVersion = TyrianVersion.getVersion
lazy val scala3Version = "3.3.3"
lazy val scala3Version = "3.4.1"

lazy val commonSettings: Seq[sbt.Def.Setting[_]] = Seq(
version := tyrianVersion,
Expand Down
2 changes: 1 addition & 1 deletion examples/mill/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.github.davidgregory084.TpolecatModule

object counter extends ScalaJSModule with TpolecatModule {

def scalaVersion = "3.3.3"
def scalaVersion = "3.4.1"
def scalaJSVersion = "1.16.0"

def buildSite() =
Expand Down
2 changes: 1 addition & 1 deletion examples/server-examples/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val LogbackVersion = "1.2.6"
val MunitCatsEffectVersion = "1.0.6"

lazy val tyrianVersion = TyrianVersion.getVersion
lazy val scala3Version = "3.3.3"
lazy val scala3Version = "3.4.1"

Global / onChangedBuildSource := ReloadOnSourceChanges

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object Routes:
case request @ GET -> Root / "spa.js" =>
val spa = fs2.io.file.Path(
"."
) / "spa" / "target" / "scala-3.3.3" / "spa-opt" / "main.js"
) / "spa" / "target" / "scala-3.4.1" / "spa-opt" / "main.js"
StaticFile.fromPath(spa.absolute, Some(request)).getOrElseF(NotFound(spa.absolute.toString))

case GET -> Root / "ssr" / in =>
Expand Down
2 changes: 1 addition & 1 deletion examples/subcomponents/src/main/scala/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object Main extends TyrianIOApp[Msg, Model]:
button(onClick(Msg.Insert))(text("insert"))
) ++ counters

div()(elems: _*)
div()(elems*)

def subscriptions(model: Model): Sub[IO, Msg] =
Sub.None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object InfiniteScroll:
table(hxIndicator := ".htmx-indicator")(
thead(tr(th("Name"), th("Id"))),
tbody(
rows: _*
rows*
)
)
)
Expand Down
6 changes: 3 additions & 3 deletions tyrian-io/src/main/scala/tyrian/TyrianIOApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ trait TyrianIOApp[Msg, Model] extends TyrianAppF[IO, Msg, Model]:
val run: IO[Nothing] => Unit = _.unsafeRunAndForget()

object TyrianIOApp:
def onLoad(appDirectory: (String, TyrianAppF[IO, _, _])*): Unit =
TyrianAppF.onLoad(appDirectory: _*)
def onLoad(appDirectory: (String, TyrianAppF[IO, ?, ?])*): Unit =
TyrianAppF.onLoad(appDirectory*)

def launch(appDirectory: Map[String, TyrianAppF[IO, _, _]]): Unit =
def launch(appDirectory: Map[String, TyrianAppF[IO, ?, ?]]): Unit =
TyrianAppF.launch(appDirectory)
6 changes: 3 additions & 3 deletions tyrian-zio/src/main/scala/tyrian/TyrianZIOApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ trait TyrianZIOApp[Msg, Model](using Async[Task]) extends TyrianAppF[Task, Msg,
}

object TyrianZIOApp:
def onLoad(appDirectory: (String, TyrianAppF[Task, _, _])*)(using Async[Task]): Unit =
TyrianAppF.onLoad(appDirectory: _*)
def onLoad(appDirectory: (String, TyrianAppF[Task, ?, ?])*)(using Async[Task]): Unit =
TyrianAppF.onLoad(appDirectory*)

def launch(appDirectory: Map[String, TyrianAppF[Task, _, _]])(using Async[Task]): Unit =
def launch(appDirectory: Map[String, TyrianAppF[Task, ?, ?]])(using Async[Task]): Unit =
TyrianAppF.launch(appDirectory)
2 changes: 1 addition & 1 deletion tyrian/js/src/main/scala/tyrian/Cmd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sealed trait Cmd[+F[_], +Msg]:
Cmd.merge(this, other)

object Cmd:
given CanEqual[Cmd[_, _], Cmd[_, _]] = CanEqual.derived
given CanEqual[Cmd[?, ?], Cmd[?, ?]] = CanEqual.derived

final def merge[F[_], Msg, LubMsg >: Msg](a: Cmd[F, Msg], b: Cmd[F, LubMsg]): Cmd[F, LubMsg] =
(a, b) match {
Expand Down
4 changes: 2 additions & 2 deletions tyrian/js/src/main/scala/tyrian/Sub.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ sealed trait Sub[+F[_], +Msg]:

object Sub:

given CanEqual[Option[_], Option[_]] = CanEqual.derived
given CanEqual[Sub[_, _], Sub[_, _]] = CanEqual.derived
given CanEqual[Option[?], Option[?]] = CanEqual.derived
given CanEqual[Sub[?, ?], Sub[?, ?]] = CanEqual.derived

final def merge[F[_], Msg, LubMsg >: Msg](a: Sub[F, Msg], b: Sub[F, LubMsg]): Sub[F, LubMsg] =
(a, b) match {
Expand Down
6 changes: 3 additions & 3 deletions tyrian/js/src/main/scala/tyrian/TyrianAppF.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ object TyrianAppF:
/** Launch app instances after DOMContentLoaded.
*/
@nowarn("msg=discarded")
def onLoad[F[_]: Async](appDirectory: Map[String, TyrianAppF[F, _, _]]): Unit =
def onLoad[F[_]: Async](appDirectory: Map[String, TyrianAppF[F, ?, ?]]): Unit =
val documentReady = new Promise((resolve, _reject) => {
document.addEventListener("DOMContentLoaded", _ => resolve(()))
if (document.readyState != DocumentReadyState.loading) {
Expand All @@ -143,12 +143,12 @@ object TyrianAppF:
})
documentReady.`then`(_ => launch[F](appDirectory))

def onLoad[F[_]: Async](appDirectory: (String, TyrianAppF[F, _, _])*): Unit =
def onLoad[F[_]: Async](appDirectory: (String, TyrianAppF[F, ?, ?])*): Unit =
onLoad(appDirectory.toMap)

/** Find data-tyrian-app HTMLElements and launch corresponding TyrianAppF instances
*/
def launch[F[_]: Async](appDirectory: Map[String, TyrianAppF[F, _, _]]): Unit =
def launch[F[_]: Async](appDirectory: Map[String, TyrianAppF[F, ?, ?]]): Unit =
document.querySelectorAll("[data-tyrian-app]").foreach { element =>
val tyrianAppElement = element.asInstanceOf[HTMLElement]
val tyrianAppName = tyrianAppElement.dataset.get("tyrianApp")
Expand Down
12 changes: 6 additions & 6 deletions tyrian/js/src/main/scala/tyrian/runtime/SubHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import scala.annotation.tailrec
object SubHelper:

// Flatten all the subs into a list of indvidual subs.
def flatten[F[_], Msg](sub: Sub[F, Msg]): List[Sub.Observe[F, _, Msg]] =
def flatten[F[_], Msg](sub: Sub[F, Msg]): List[Sub.Observe[F, ?, Msg]] =
@tailrec
def rec(remaining: List[Sub[F, Msg]], acc: List[Sub.Observe[F, _, Msg]]): List[Sub.Observe[F, _, Msg]] =
def rec(remaining: List[Sub[F, Msg]], acc: List[Sub.Observe[F, ?, Msg]]): List[Sub.Observe[F, ?, Msg]] =
remaining match
case Nil =>
acc
Expand All @@ -28,22 +28,22 @@ object SubHelper:
rec(sbs ++ ss, acc)

case (s: Sub.Observe[_, _, _]) :: ss =>
rec(ss, s.asInstanceOf[Sub.Observe[F, _, Msg]] :: acc)
rec(ss, s.asInstanceOf[Sub.Observe[F, ?, Msg]] :: acc)

rec(List(sub), Nil)

def aliveAndDead[F[_]: Concurrent, Msg](
subs: List[Sub.Observe[F, _, Msg]],
subs: List[Sub.Observe[F, ?, Msg]],
current: List[(String, F[Unit])]
): (List[(String, F[Unit])], List[F[Unit]]) =
val (a, d) = current.partition { case (id, _) => subs.exists(_.id == id) }
(a, d.map(_._2))

def findNewSubs[F[_]: Concurrent, Msg](
subs: List[Sub.Observe[F, _, Msg]],
subs: List[Sub.Observe[F, ?, Msg]],
alive: List[String],
inProgress: List[String]
): List[Sub.Observe[F, _, Msg]] =
): List[Sub.Observe[F, ?, Msg]] =
subs.filter(s => alive.forall(_ != s.id) && !inProgress.contains(s.id))

def runObserve[F[_], A, Msg](sub: Sub.Observe[F, A, Msg])(callback: Either[Throwable, Option[Msg]] => Unit)(using
Expand Down
2 changes: 1 addition & 1 deletion tyrian/shared/src/main/scala/tyrian/HTMLRendering.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension [Msg](html: Html[Msg])

s"""<${tag.name}$attributes>$children</${tag.name}>"""

extension (a: Attr[_])
extension (a: Attr[?])
def render: String =
a match
case _: Event[_, _] => ""
Expand Down
2 changes: 1 addition & 1 deletion tyrian/shared/src/main/scala/tyrian/Html.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ object Html extends HtmlTags with HtmlAttributes:
Property("type", "radio"),
Property("name", name),
if checked then Property("checked", "checked") else Property.empty
) ++ attributes: _*
) ++ attributes*
)

def text(plainText: String): Text = Text(plainText)
Expand Down
2 changes: 1 addition & 1 deletion website/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import scala.concurrent.duration.DurationInt
import laika.sbt.LaikaPreviewConfig
import java.time.OffsetDateTime

ThisBuild / scalaVersion := "3.3.3"
ThisBuild / scalaVersion := "3.4.1"

enablePlugins(LaikaPlugin, GhpagesPlugin)

Expand Down

0 comments on commit adc9a59

Please sign in to comment.