Closed MateuszKubuszok closed 3 months ago
Attention: Patch coverage is 64.16667%
with 86 lines
in your changes missing coverage. Please review.
Project coverage is 86.73%. Comparing base (
919f243
) to head (53e9cda
). Report is 86 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I need to test somehow whether this change will not break https://github.com/scalalandio/chimney/issues/496 / https://github.com/scalalandio/chimney/pull/497. Testing it is a bit of a PITA, but the is nothing in the ADTs' API (both on Scala2 and on Scala 3) that would make me certain I used them the right way.
(sbt publish-local-for-tests
)
Sooo:
//> using plugin org.wartremover:::wartremover:3.1.7
// Scala 2:
//> using scala 2.13.14
//> using options -Xfatal-warnings -P:wartremover:traverser:org.wartremover.warts.Unsafe -Wmacros:both -Xmacro-settings:chimney.SuppressWarnings=none -Vmacro
//> using dep io.scalaland::chimney:1.3.0-6-g42ce88f-SNAPSHOT
case class Foo(a: Option[String], b: Option[Int])
case class Bar(a: String, b: Int, c: Long)
import io.scalaland.chimney.dsl._
println(
scala.compiletime.codeOf(
Foo(Some("test"), Some(1024))
.intoPartial[Bar]
.withFieldConst(_.c, 1024L)
.transform
)
)
always pass (even though @SuppressWarnings
is disabled, and we can check with -Vmacro
that it gets properly set up to be modified/left intact/removed) while
//> using plugin org.wartremover:::wartremover:3.1.7
// Scala 3:
//> using scala 3.3.3
//> using options -Xfatal-warnings -P:wartremover:traverser:org.wartremover.warts.Unsafe -Xmacro-settings:chimney.SuppressWarnings=org.wartremover.warts.Var
//> using dep io.scalaland::chimney:1.3.0-6-g42ce88f-SNAPSHOT
case class Foo(a: Option[String], b: Option[Int])
case class Bar(a: String, b: Int, c: Long)
import io.scalaland.chimney.dsl._
println(
Foo(Some("test"), Some(1024))
.intoPartial[Bar]
.withFieldConst(_.c, 1024L)
.transform
)
)
always fails (an in the source code annotations are always absent :/)
After testing with sbt... Scala 2 works as expected... while Scala 3 always pass, whether annotations are applied or not :/
// build.sbt
libraryDependencies += "io.scalaland" %% "chimney" % "1.3.0-7-g939c063-SNAPSHOT"
wartremoverErrors ++= Warts.all
//scalaVersion := "3.3.3"
scalaVersion := "2.13.14"
scalacOptions += "-Wmacros:both" // Scala 2-only
scalacOptions += "-Xmacro-settings:chimney.SuppressWarnings=none"
scalacOptions += "-Xmacro-settings:chimney.transformer.MacrosLogging=true"
// project/plugins.sbt
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.1.7")
// src/main/scala/test/example.scala
package test
import io.scalaland.chimney.dsl._
final case class Foo(a: Option[String], b: Option[Int])
final case class Bar(a: String, b: Int, c: Long)
object Example {
def main(args: Array[String]): Unit =
println(
Foo(Some("test"), Some(1024))
.intoPartial[Bar]
.withFieldConst(_.c, 1024L)
//.enableMacrosLogging
.transform
)
}
Sooo, for now let's continue, it seems that behavior is unchanged (verified with newer commit and Scala 3), if we notice some changes in wartemover and Scala 3 we'll return to the this.
-Xmacro-settings
Transformer
(Boolean
) flagchimney.transformer.InheritedAccessors=boolean
chimney.transformer.MethodAccessors=boolean
chimney.transformer.DefaultValues=boolean
chimney.transformer.BeanSetters=boolean
chimney.transformer.BeanSettersIgnoreUnmatched=boolean
chimney.transformer.NonUnitBeanSetters=boolean
chimney.transformer.BeanGetters=boolean
chimney.transformer.OptionDefaultsToNone=boolean
chimney.transformer.PartialUnwrapsOption=boolean
chimney.transformer.NonAnyValWrappers=boolean
chimney.transformer.ImplicitConflictResolution=Total/Partial/false
chimney.transformer.MacrosLogging=boolean
Patcher
(Boolean
) flagchimney.patcher.IgnoreRedundantPatcherFields=boolean
chimney.patcher.IgnoreNoneInPatch=boolean
chimney.patcher.MacrosLogging=boolean
@SuppressWarnings(Array(...))
and@NoWarn(...)
chimney.SuppressWarnings=false/list
chimney.NoWarn=false/true/msg