lightbend-labs / scala-rewrites

Scalafix Rewrites for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get ExplicitNonNullaryApply working

japgolly opened this issue · comments

Hey! I'm on Scala 2.13.3, SemanticDB 4.3.17, sbt-scalafix 0.9.17, I've locally published this repo and added this to SBT:

      ThisBuild / scalacOptions += "-Yrangepos"
      ThisBuild / scalacOptions += "-P:semanticdb:synthetics:on"
      ThisBuild / scalafixDependencies += "org.scala-lang" %% "scala-rewrites" % "0.1.0-SNAPSHOT"

and I can't get anything to work.

> scalafix ExplicitNonNullaryApply
scalafix.sbt.InvalidArgument: Unknown rule 'ExplicitNonNullaryApply'

Hmmm, ok, look at source code - try again:

> scalafix fix.scala213.ExplicitNonNullaryApply
java.lang.IllegalArgumentException: requirement failed: List(-target:11, -unchecked, -Wconf:msg=may.not.be.exhaustive:e, -Wdead-code, -Wunused:explicits, -Wunused:implicits, -Wunused:imports, -Wunused:locals, -Wunused:nowarn, -Wunused:patvars, -Wunused:privates, -Xlint:adapted-args, -Xlint:constant, -Xlint:delayedinit-select, -Xlint:deprecation, -Xlint:eta-zero, -Xlint:implicit-not-found, -Xlint:inaccessible, -Xlint:infer-any, -Xlint:missing-interpolator, -Xlint:nonlocal-return, -Xlint:nullary-unit, -Xlint:option-implicit, -Xlint:poly-implicit-overload, -Xlint:private-shadow, -Xlint:stars-align, -Xlint:valpattern, -Xmixin-force-forwarders:false, -Xno-forwarders, -Xsource:2.13, -Ybackend-parallelism, 16, -Ycache-macro-class-loader:last-modified, -Ycache-plugin-class-loader:last-modified, -Yjar-compression-level, 9, -Ymacro-annotations, -Yno-generic-signatures, -Ypatmat-exhaust-depth, off, -Xcheckinit, -Xplugin:/home/golly/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.13.3/1.1.0/scalajs-compiler_2.13.3-1.1.0.jar, -Xplugin:/home/golly/.cache/coursier/v1/https/repo1.maven.org/maven2/org/typelevel/kind-projector_2.13.3/0.11.0/kind-projector_2.13.3-0.11.0.jar, -Xplugin:/home/golly/.cache/coursier/v1/https/repo1.maven.org/maven2/com/olegpy/better-monadic-for_2.13/0.3.1/better-monadic-for_2.13-0.3.1.jar, -Xplugin:/home/golly/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/semanticdb-scalac_2.13.3/4.3.17/semanticdb-scalac_2.13.3-4.3.17.jar, -P:semanticdb:targetroot:/tmp/shipreq.sbt/webapp-client-loaders/target/scala-2.13/meta)

I'm I doing something wrong or there something wrong with the rule?

Hey. I think you're running into https://github.com/scala/scala-rewrites/pull/34/files, which I hadn't realised until that PR.

Ok cool, I'm glad it makes sense to you. I did read through that PR though and I confess, it didn't quite make sense to me. Actually let me add a comment over there :)

Actually, I think I've got it! We need to wait for Scalafix 1.0 to be released before that rule can work, is that right?

Also do you know when that will be?

More immediately I think you should be able to fix your code by compiling it with 2.12 and then running the ExplicitNonNullaryApply rewrite.

I'm not sure where the failure is triggering (that "requirement failed" could be clearer) but basically while there is a scalameta semanticdb-scalac for 2.13, Scalafix doesn't support 2.13 yet. And I'm not sure when Scalfix 1.0 will be out.

Merged #34, so people don't fall into this pitfall. Improvement feedback is still welcome.