From 0d88951cd10d6b777c4f055f017d942d8a27f09e Mon Sep 17 00:00:00 2001 From: Jens Halm <3116929+jenshalm@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:36:05 +0100 Subject: [PATCH] fixes for breaking changes of Xsource:3 in 2.13.14 --- build.sbt | 4 ++++ .../scala/laika/internal/parse/hocon/ConfigResolver.scala | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 3cd53efa7..12a907c1c 100644 --- a/build.sbt +++ b/build.sbt @@ -50,6 +50,9 @@ inThisBuild( ) ) +def inferOverrideFor2_13(version: String): Seq[String] = + if (version.startsWith("2.13")) Seq("-Xsource-features:infer-override") else Nil + def disableMissingInterpolatorWarning(options: Seq[String]): Seq[String] = options.map { opt => if (opt.startsWith("-Xlint")) opt + ",-missing-interpolator" else opt @@ -134,6 +137,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) "org.scalameta" %%% "munit" % versions.munit % "test", "org.typelevel" %%% "cats-core" % versions.catsCore ), + scalacOptions ++= inferOverrideFor2_13(scalaVersion.value), Test / scalacOptions ~= disableMissingInterpolatorWarning ) .jvmSettings( diff --git a/core/shared/src/main/scala/laika/internal/parse/hocon/ConfigResolver.scala b/core/shared/src/main/scala/laika/internal/parse/hocon/ConfigResolver.scala index ade10c27b..bc983a1a3 100644 --- a/core/shared/src/main/scala/laika/internal/parse/hocon/ConfigResolver.scala +++ b/core/shared/src/main/scala/laika/internal/parse/hocon/ConfigResolver.scala @@ -296,7 +296,7 @@ private[laika] object ConfigResolver { obj.values.groupBy(_.key.getOrElse(Key.root)).mapValuesStrict(_.map(_.value)).toSeq.map { case (key, values) => val merged = values.reduce(mergeValues(key)) match { - case obj: ObjectBuilderValue => mergeObjects(obj) + case obv: ObjectBuilderValue => mergeObjects(obv) case other => other } BuilderField(key, merged) @@ -373,8 +373,8 @@ private[laika] object ConfigResolver { extract(field + "." + index, arrValue) } if (nested.isEmpty) wrap(failure) else nested - case InvalidBuilderValue(obj: ObjectBuilderValue, failure) => - val nested = extractErrors(obj) + case InvalidBuilderValue(obv: ObjectBuilderValue, failure) => + val nested = extractErrors(obv) if (nested.isEmpty) wrap(failure) else nested case InvalidBuilderValue(_, failure) => wrap(failure) case incl: IncludeBuilderValue =>