From da8c50e474c867df0f663fb2a14ea5579552406b Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Thu, 9 Nov 2023 17:27:28 +0900 Subject: [PATCH] samples: add scala compiler options. fix warnings (#856) --- samples/scala/build.gradle.kts | 7 +++++++ .../src/teavm/scala/org/teavm/samples/scala/Client.scala | 2 +- .../src/teavm/scala/org/teavm/samples/scala/Grammar.scala | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/samples/scala/build.gradle.kts b/samples/scala/build.gradle.kts index ca818b6ef..229a786cb 100644 --- a/samples/scala/build.gradle.kts +++ b/samples/scala/build.gradle.kts @@ -29,3 +29,10 @@ teavm.js { addedToWebApp = true mainClass = "org.teavm.samples.scala.Client" } + +tasks.withType { + scalaCompileOptions.additionalParameters = listOf( + "-feature", + "-deprecation", + ) +} diff --git a/samples/scala/src/teavm/scala/org/teavm/samples/scala/Client.scala b/samples/scala/src/teavm/scala/org/teavm/samples/scala/Client.scala index ea08a6847..ae2cff137 100644 --- a/samples/scala/src/teavm/scala/org/teavm/samples/scala/Client.scala +++ b/samples/scala/src/teavm/scala/org/teavm/samples/scala/Client.scala @@ -6,7 +6,7 @@ import org.teavm.jso.dom.html._ import org.teavm.samples.scala.Calculator.{eval, parse, print} object Client { - def main(args: Array[String]) { + def main(args: Array[String]): Unit = { val doc = HTMLDocument.current val exprElem = doc.getElementById("expr").asInstanceOf[HTMLInputElement] val calcElem = doc.getElementById("calculate") diff --git a/samples/scala/src/teavm/scala/org/teavm/samples/scala/Grammar.scala b/samples/scala/src/teavm/scala/org/teavm/samples/scala/Grammar.scala index c5ac9b818..16cf31236 100644 --- a/samples/scala/src/teavm/scala/org/teavm/samples/scala/Grammar.scala +++ b/samples/scala/src/teavm/scala/org/teavm/samples/scala/Grammar.scala @@ -17,11 +17,11 @@ trait Rule[T] { def |(other: => Rule[T]): Rule[T] = Rule.firstOf(this, other) - def *(): Rule[List[T]] = Rule.unlimited(this) + def * : Rule[List[T]] = Rule.unlimited(this) def >>[S](f: T => S): Rule[S] = Rule.andThen(this, f) - def ?(): Rule[Option[T]] = Rule.optional(this) + def ? : Rule[Option[T]] = Rule.optional(this) def debug(str: String) = Rule.rule { x => val (result, rem) = parse(x)