-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide Scala-version-agnostic way of reading macro settings #572
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #572 +/- ##
==========================================
- Coverage 88.05% 86.73% -1.33%
==========================================
Files 153 154 +1
Lines 5911 5986 +75
Branches 500 540 +40
==========================================
- Hits 5205 5192 -13
- Misses 706 794 +88 ☔ View full report in Codecov by Sentry. |
8b877df
to
4089e36
Compare
4089e36
to
939c063
Compare
( 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 //> 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 :/) |
…arnings application to Gateways
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. |
918ff35
to
53e9cda
Compare
-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