From 08afedbb2fe685e3d6a87a3e02b8c97f21bd5da1 Mon Sep 17 00:00:00 2001 From: jultty Date: Sun, 12 Nov 2023 17:58:01 -0300 Subject: [PATCH] val/var + string interpolation example --- build.sbt | 4 +++- src/main/scala/Main.scala | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index ee6237c..e72822d 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,9 @@ lazy val root = project libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test, - wartremoverErrors ++= Warts.unsafe, + wartremoverErrors ++= Warts.unsafe.filterNot(Set( + Wart.Var, + ).contains), wartremoverErrors ++= Seq( Wart.ArrayEquals, Wart.AnyVal, Wart.Equals, Wart.ExplicitImplicitTypes, Wart.FinalCaseClass, Wart.ImplicitConversion, diff --git a/src/main/scala/Main.scala b/src/main/scala/Main.scala index 6c20ef6..38fa3e3 100644 --- a/src/main/scala/Main.scala +++ b/src/main/scala/Main.scala @@ -1,8 +1,14 @@ @main def hello: Unit = - println("Hello, Scala") + val a_char = ',' + val immutable = "Scala" + var mutable = "lo" + println(s"Hel${mutable}es$a_char $immutable!") // ??? // throws unimplemented +// Suppresses a WartRemover warning +// @SuppressWarnings(Array("org.wartremover.warts.Var")) + // imperative import scala.collection.mutable.ListBuffer