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

Ensures children are correctly handled when not varargs #721

Merged
merged 1 commit into from
Nov 6, 2024
Merged
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
11 changes: 6 additions & 5 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 Expand Up @@ -210,7 +211,7 @@ lazy val docs =
project.settings(librarySettings, macroAnnotationSettings).dependsOn(web, hot, docsMacros, history)

ThisBuild / updateIntellij := {}
val intelliJVersion = "231.8109.175" // 2023.1
val intelliJVersion = "242.20224.300" // 2023.2

lazy val coreIntellijSupport = project.settings(
org.jetbrains.sbtidea.Keys.buildSettings :+ (
Expand Down
14 changes: 13 additions & 1 deletion core/src/main/scala-2/slinky/core/annotations/react.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,19 @@ object ReactMacrosImpl {
q"this.apply(Props.apply[..$tparams](...$applyValues))"
}

q"""def apply[..$tparams](...$paramssWithoutChildren)(${childrenParam.get}): _root_.slinky.core.KeyAndRefAddingStage[Def] =
val children = {
val tpe = childrenParam.get.tpe
if (tpe != null && (tpe =:= typeOf[Seq[_root_.slinky.core.facade.ReactElement]] ||
tpe =:= typeOf[List[_root_.slinky.core.facade.ReactElement]] ||
(tpe.typeSymbol == definitions.RepeatedParamClass &&
tpe.typeArgs.headOption.exists(_ =:= typeOf[_root_.slinky.core.facade.ReactElement])))) {
q"${childrenParam.get.name}: _root_.slinky.core.facade.ReactElement_*"
} else {
q"${childrenParam.get}"
}
}

q"""def apply[..$tparams](...$paramssWithoutChildren)($children): _root_.slinky.core.KeyAndRefAddingStage[Def] =
$body"""
} else {
q"""def apply[..$tparams](...$paramssWithoutChildren): _root_.slinky.core.KeyAndRefAddingStage[Def] =
Expand Down
Loading
Loading