From 895d454f5aa2c682feef6100346c7930505212ba Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 27 May 2022 13:31:05 +1000 Subject: [PATCH] Fix Scala 3 --- .../main/scala/japgolly/scalajs/react/ComponentDom.scala | 4 ++-- .../src/main/scala/japgolly/scalajs/react/Renderable.scala | 7 +++---- .../scala/japgolly/scalajs/react/test/TestContainer.scala | 6 +++--- .../scala/japgolly/scalajs/react/test/TestReactRoot.scala | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/ComponentDom.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/ComponentDom.scala index f81aa4f0d..d2cd88845 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/ComponentDom.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/ComponentDom.scala @@ -26,8 +26,8 @@ sealed trait ComponentDom { final def toText: Option[dom.Text] = mounted.flatMap { - case t: dom.Text => Some(t) - case _ => None + case Node(t: dom.Text) => Some(t) + case _ => None } /** For testing purposes. */ diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Renderable.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Renderable.scala index f3ad7af48..922f09916 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Renderable.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Renderable.scala @@ -1,15 +1,14 @@ package japgolly.scalajs.react import japgolly.scalajs.react.component.Generic.{UnmountedRaw => Component} -import japgolly.scalajs.react.facade.React import japgolly.scalajs.react.vdom.VdomNode /** Typeclass for anything that React can render. * * @since v2.2.0 / React 18 */ -@inline final case class Renderable[-A](raw: A => React.Node) extends AnyVal { - @inline def apply(a: A): React.Node = +@inline final case class Renderable[-A](raw: A => facade.React.Node) extends AnyVal { + @inline def apply(a: A): facade.React.Node = raw(a) } @@ -18,7 +17,7 @@ object Renderable { @inline implicit def long: Renderable[Long] = Renderable(_.toString) - @inline implicit def raw[A](implicit ev: A => React.Node): Renderable[A] = + @inline implicit def raw[A](implicit ev: A => facade.React.Node): Renderable[A] = Renderable(ev) @inline implicit def vdom: Renderable[VdomNode] = diff --git a/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestContainer.scala b/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestContainer.scala index c09023ec3..067c83130 100644 --- a/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestContainer.scala +++ b/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestContainer.scala @@ -1,10 +1,10 @@ package japgolly.scalajs.react.test -import japgolly.scalajs.react.facade +import japgolly.scalajs.react.{facade => mainFacade} import org.scalajs.dom object TestContainer { - def apply(c: facade.ReactDOM.Container): TestContainer = + def apply(c: mainFacade.ReactDOM.Container): TestContainer = new TestContainer { override type Self = TestDom override protected def Self(n2: dom.Node) = TestDom(n2) @@ -23,7 +23,7 @@ object TestContainer { */ trait TestContainer extends TestDom { - def container: facade.ReactDOM.Container + def container: mainFacade.ReactDOM.Container final def node = fold(identity, identity, identity) diff --git a/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestReactRoot.scala b/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestReactRoot.scala index 82500af6a..b9e1dce4f 100644 --- a/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestReactRoot.scala +++ b/library/testUtil/src/main/scala/japgolly/scalajs/react/test/TestReactRoot.scala @@ -1,14 +1,14 @@ package japgolly.scalajs.react.test -import japgolly.scalajs.react._ +import japgolly.scalajs.react.{facade => mainFacade, _} import org.scalajs.dom object TestReactRoot { - def apply(container: facade.ReactDOM.RootContainer): TestReactRoot = + def apply(container: mainFacade.ReactDOM.RootContainer): TestReactRoot = apply(ReactDOM.createRoot(container), container) - def apply(root: ReactRoot, container: facade.ReactDOM.Container): TestReactRoot = { + def apply(root: ReactRoot, container: mainFacade.ReactDOM.Container): TestReactRoot = { @inline def r = root @inline def c = container new TestReactRoot {