Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows derivation fallback messages to be suppressed #719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/sbt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
scalajs: ["1.9.0"]
scalajs: ["1.16.0"]
es2015_enabled: ["false", "true"]
steps:
- name: Configure git to disable Windows line feeds
Expand Down
9 changes: 5 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ addCommandAlias(
"compile:scalafix --check; test:scalafix --check; compile:scalafmtCheck; test:scalafmtCheck; scalafmtSbtCheck"
)

val scala212 = "2.12.17"
val scala213 = "2.13.10"
val scala3 = "3.2.2"
val scala212 = "2.12.19"
val scala213 = "2.13.14"
val scala3 = "3.3.3"

ThisBuild / scalaVersion := scala213
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := "4.7.6"
ThisBuild / semanticdbVersion := "4.9.9"

ThisBuild / tpolecatDefaultOptionsMode := DevMode

Expand Down Expand Up @@ -46,6 +46,7 @@ addCommandAlias(

lazy val crossScalaSettings = Seq(
crossScalaVersions := Seq(scala212, scala213, scala3),
scalacOptions += "-Wconf:cat=unused-nowarn:s",
Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.9.0")
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.16.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,19 @@ abstract class GenericDeriveImpl(val c: whitebox.Context) { self =>
createSealedTraitTypeclass(tTag.tpe, getSubclasses(symbol.asClass).toSeq)
}
} else {
val debugEnabled = Option(System.getProperty("slinky.derivation.debug"))
.filterNot(_.isEmpty)
.map(_.toLowerCase)
.map(v => "true".equals(v) || v.substring(0, 1) == "y")
.getOrElse(false)

memoTree(tTag.tpe) {
c.echo(
c.enclosingPosition,
s"Using fallback derivation for type ${tTag.tpe} (derivation: ${getClass.getSimpleName})"
)
if (debugEnabled) {
c.echo(
c.enclosingPosition,
s"Using fallback derivation for type ${tTag.tpe} (derivation: ${getClass.getSimpleName})"
)
}
createFallback(tTag.tpe)
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/src/test/scala/slinky/core/HooksComponentTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import slinky.web.ReactDOM
import slinky.web.html._

import org.scalatest.Assertion
import scala.concurrent.Promise
import scala.concurrent.{ExecutionContext, Promise}
import scala.util.Try

class HooksComponentTest extends AsyncFunSuite {
implicit override def executionContext = scala.concurrent.ExecutionContext.Implicits.global
implicit override def executionContext: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global

test("Can render a functional component with useState hook") {
val container = document.createElement("div")
Expand Down
Loading