Skip to content

Commit 5150220

Browse files
committed
Fix nullary with side effects error
- remove explicit scala.collection.Seq from test - ignore nullary-unit error from tests and from TdmlTests trait DAFFODIL-2152
1 parent 092ffc4 commit 5150220

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

build.sbt

+20-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ lazy val commonSettings = Seq(
241241
scalaVersion := "2.12.20",
242242
crossScalaVersions := Seq("2.12.20"),
243243
scalacOptions ++= buildScalacOptions(scalaVersion.value),
244+
Test / scalacOptions ++= buildTestScalacOptions(scalaVersion.value),
244245
Compile / compile / javacOptions ++= buildJavacOptions(),
245246
logBuffered := true,
246247
transitiveClassifiers := Seq("sources", "javadoc"),
@@ -297,7 +298,25 @@ def buildScalacOptions(scalaVersion: String) = {
297298
// TODO: scala 2.12 phase out
298299
// the import is needed for Scala 2.12 but issues an unused import warning under 2.13, so we add this to
299300
// suppresss the warning
300-
"-Wconf:origin=scala.collection.compat.*:s"
301+
"-Wconf:origin=scala.collection.compat.*:s",
302+
// suppress nullary-unit warning in the specific trait
303+
"-Wconf:cat=lint-nullary-unit:silent,site=org.apache.daffodil.junit.tdml.TdmlTests:silent"
304+
)
305+
case _ => Seq.empty
306+
}
307+
308+
commonOptions ++ scalaVersionSpecificOptions
309+
}
310+
311+
def buildTestScalacOptions(scalaVersion: String) = {
312+
val commonOptions = Seq.empty
313+
314+
val scalaVersionSpecificOptions = CrossVersion.partialVersion(scalaVersion) match {
315+
case Some((2, 12)) => Seq.empty
316+
case Some((2, 13)) =>
317+
Seq(
318+
// suppress nullary-unit warning in tests
319+
"-Wconf:cat=lint-nullary-unit:silent"
301320
)
302321
case _ => Seq.empty
303322
}

0 commit comments

Comments
 (0)