Skip to content

Commit

Permalink
slinky/scalajsreact: Hand-wrestle scalac into applying an implicit ev…
Browse files Browse the repository at this point in the history
…en though one a type parameter is inferred to be `Nothing`
  • Loading branch information
oyvindberg committed Jul 17, 2020
1 parent a31be4c commit fcc9f17
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class JapgollyGenStBuildingComponent(val outputPkg: Name, val scalaVersion: Vers
isOverride = false,
)
}
// @inline implicit def make[R <: js.Object](comp: StBuildingComponent[R]): japgolly.scalajs.react.vdom.VdomElement = {
// @inline implicit def make(comp: StBuildingComponent[_]): japgolly.scalajs.react.vdom.VdomElement = {
// if (comp.args(0) == null) {
// throw new IllegalStateException(
// "This component has already been built into a ReactElement, and cannot be reused"
Expand All @@ -322,7 +322,9 @@ class JapgollyGenStBuildingComponent(val outputPkg: Name, val scalaVersion: Vers
// japgolly.scalajs.react.vdom.VdomElement(ret)
// }
val make: MethodTree = {
val compParam = ParamTree(Name("comp"), false, false, builderRef, NotImplemented, NoComments)
// drop specific type parameters to help type inference in case they are inferred as `Nothing`
val wildcardRef = builderRef.copy(targs = builderRef.targs.map(_ => TypeRef.Wildcard))
val compParam = ParamTree(Name("comp"), false, false, wildcardRef, NotImplemented, NoComments)
val name = Name("make")
val compArgs = Select(Ref(compParam.name), Name("args"))
val args0 = Call(compArgs, IArray(IArray(NumberLit("0"))))
Expand Down Expand Up @@ -361,7 +363,7 @@ class JapgollyGenStBuildingComponent(val outputPkg: Name, val scalaVersion: Vers
IArray(Annotation.Inline),
ProtectionLevel.Default,
name,
builderTparams,
Empty,
IArray(IArray(compParam)),
impl,
TypeRef(JapgollyNames.vdom.ReactElement),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ class SlinkyGenStBuildingComponent(val outputPkg: Name, val scalaVersion: Versio
isOverride = false,
)
}
// @inline implicit def make[E, R <: js.Object](comp: StBuildingComponent[E, R]): slinky.core.facade.ReactElement = {

// @inline implicit def make(comp: StBuildingComponent[_, _]): slinky.core.facade.ReactElement = {
// if (comp.args(0) == null) {
// throw new IllegalStateException(
// "This component has already been built into a ReactElement, and cannot be reused"
Expand All @@ -356,7 +357,9 @@ class SlinkyGenStBuildingComponent(val outputPkg: Name, val scalaVersion: Versio
// ret
// }
val make: MethodTree = {
val compParam = ParamTree(Name("comp"), false, false, builderRef, NotImplemented, NoComments)
// drop specific type parameters to help type inference in case they are inferred as `Nothing`
val wildcardRef = builderRef.copy(targs = builderRef.targs.map(_ => TypeRef.Wildcard))
val compParam = ParamTree(Name("comp"), false, false, wildcardRef, NotImplemented, NoComments)
val name = Name("make")
val compArgs = Select(Ref(compParam.name), Name("args"))
val args0 = Call(compArgs, IArray(IArray(NumberLit("0"))))
Expand Down
4 changes: 2 additions & 2 deletions tests/material-ui/check-japgolly/m/material-ui/build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "material-ui"
version := "0.0-unknown-701126"
version := "0.0-unknown-a65706"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "0.0-unknown-e38a13",
"org.scalablytyped" %%% "react" % "0.0-unknown-1d4862",
"org.scalablytyped" %%% "std" % "0.0-unknown-7244e3")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
2 changes: 1 addition & 1 deletion tests/material-ui/check-japgolly/r/react/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
organization := "org.scalablytyped"
name := "react"
version := "0.0-unknown-e38a13"
version := "0.0-unknown-1d4862"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object StBuildingComponent {
}

@scala.inline
implicit def make[R <: js.Object](comp: StBuildingComponent[R]): VdomElement = {
implicit def make(comp: StBuildingComponent[_]): VdomElement = {
if (!scala.scalajs.runtime.linkingInfo.productionMode) {
if (comp.args(0) == null) throw new IllegalStateException("This component has already been built into a ReactElement, and cannot be reused")
}
Expand Down
4 changes: 2 additions & 2 deletions tests/material-ui/check-slinky/m/material-ui/build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "material-ui"
version := "0.0-unknown-614c02"
version := "0.0-unknown-4eb9bf"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "0.0-unknown-e3bc89",
"org.scalablytyped" %%% "react" % "0.0-unknown-707804",
"org.scalablytyped" %%% "std" % "0.0-unknown-e37381")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
2 changes: 1 addition & 1 deletion tests/material-ui/check-slinky/r/react/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
organization := "org.scalablytyped"
name := "react"
version := "0.0-unknown-e3bc89"
version := "0.0-unknown-707804"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object StBuildingComponent {
}

@scala.inline
implicit def make[E, R <: js.Object](comp: StBuildingComponent[E, R]): ReactElement = {
implicit def make[E, R <: js.Object](comp: StBuildingComponent[_, _]): ReactElement = {
if (!scala.scalajs.runtime.linkingInfo.productionMode) {
if (comp.args(0) == null) throw new IllegalStateException("This component has already been built into a ReactElement, and cannot be reused")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "componentstest"
version := "0.0-unknown-ab45fa"
version := "0.0-unknown-afe8e2"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-bootstrap"
version := "0.32-68849d"
version := "0.32-b16fb2"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-contextmenu"
version := "2.13.0-28c825"
version := "2.13.0-dae89c"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-dropzone"
version := "10.1.10-f22751"
version := "10.1.10-15e1fe"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-select"
version := "0.0-unknown-9acd3b"
version := "0.0-unknown-e73247"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
organization := "org.scalablytyped"
name := "react"
version := "16.9.2-db47e8"
version := "16.9.2-2f6895"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object StBuildingComponent {
}

@scala.inline
implicit def make[R <: js.Object](comp: StBuildingComponent[R]): VdomElement = {
implicit def make(comp: StBuildingComponent[_]): VdomElement = {
if (!scala.scalajs.runtime.linkingInfo.productionMode) {
if (comp.args(0) == null) throw new IllegalStateException("This component has already been built into a ReactElement, and cannot be reused")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "semantic-ui-react"
version := "0.0-unknown-b16717"
version := "0.0-unknown-68bb98"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "stardust-ui__react-component-event-listener"
version := "0.38.0-18786f"
version := "0.38.0-f18c85"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "stardust-ui__react-component-ref"
version := "0.38.0-dad8c6"
version := "0.38.0-645203"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"org.scalablytyped" %%% "react" % "16.9.2-db47e8",
"org.scalablytyped" %%% "react" % "16.9.2-2f6895",
"org.scalablytyped" %%% "std" % "0.0-unknown-1edc23")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "componentstest"
version := "0.0-unknown-36bc93"
version := "0.0-unknown-ddda58"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-bootstrap"
version := "0.32-208810"
version := "0.32-5214c4"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-contextmenu"
version := "2.13.0-c9ba15"
version := "2.13.0-f3209b"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-dropzone"
version := "10.1.10-aec754"
version := "10.1.10-27e829"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react-select"
version := "0.0-unknown-c80049"
version := "0.0-unknown-2fd041"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
organization := "org.scalablytyped"
name := "react"
version := "16.9.2-28879a"
version := "16.9.2-87e25d"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object StBuildingComponent {
}

@scala.inline
implicit def make[E, R <: js.Object](comp: StBuildingComponent[E, R]): ReactElement = {
implicit def make[E, R <: js.Object](comp: StBuildingComponent[_, _]): ReactElement = {
if (!scala.scalajs.runtime.linkingInfo.productionMode) {
if (comp.args(0) == null) throw new IllegalStateException("This component has already been built into a ReactElement, and cannot be reused")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "semantic-ui-react"
version := "0.0-unknown-b3c425"
version := "0.0-unknown-892797"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "stardust-ui__react-component-event-listener"
version := "0.38.0-33e610"
version := "0.38.0-499cbb"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "stardust-ui__react-component-ref"
version := "0.38.0-72f76a"
version := "0.38.0-a24233"
scalaVersion := "2.13.2"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.1.0",
"me.shadaj" %%% "slinky-web" % "0.6.5",
"org.scalablytyped" %%% "react" % "16.9.2-28879a",
"org.scalablytyped" %%% "react" % "16.9.2-87e25d",
"org.scalablytyped" %%% "std" % "0.0-unknown-d0ed57")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials")
Expand Down
Loading

0 comments on commit fcc9f17

Please sign in to comment.