Skip to content

Commit

Permalink
Allows derivation fallback messages to be suppressed
Browse files Browse the repository at this point in the history
  • Loading branch information
harana-bot committed Aug 10, 2024
1 parent f74988f commit eb521a4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
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
8 changes: 4 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
1 change: 1 addition & 0 deletions core/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ libraryDependencies ++= {
// Needed by useCallback due to false positive warning on implicit evidence
scalacOptions -= "-Ywarn-unused:implicits"
scalacOptions -= "-Wunused:implicits"
scalacOptions += "-Ywarn-unused:-nowarn"
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

0 comments on commit eb521a4

Please sign in to comment.