-
Notifications
You must be signed in to change notification settings - Fork 186
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
Var-arg pattern (#59) #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution! First pass of review.
readme/Rewrites.scalatex
Outdated
@@ -139,6 +139,36 @@ | |||
Such members already have a return type of @code{Unit} and sometimes this is unexpected. | |||
Adding an explicit return type makes it more obvious. | |||
|
|||
@sect(DottyVarArgPattern.toString) | |||
@p | |||
Replaces @code{@} symbols in VarArg patterns with a colon (@code{:}). See @lnk{http://dotty.epfl.ch/docs/reference/changed/vararg-patterns.html} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line here has a syntax error, I think the @
symbol needs to be escaped with @@
. To test locally run readme/run
.
readme/Rewrites.scalatex
Outdated
|
||
object VarArg { | ||
List(1, 2, 3, 4) match { | ||
case List(1, 2, xs @ _*) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we minimize this example to
// before
case List(1, 2, xs @ _*)
// after
case List(1, 2, _*)
object VarArg { | ||
List(1, 2, 3, 4) match { | ||
case List(1, 2, xs @ _*) => | ||
val ys: Seq[Int] = xs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line and below? We should try to have as small tests as possible.
import scala.meta.tokens.Token | ||
import scalafix.Patch | ||
|
||
case object VarArg extends Rewrite { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to DottyVarArgPattern
.
Ready for the second pass :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @gosubpl !
I am not sure what caused the CI error, I fetched your fork and I am unable to reproduce locally. I restarted the CI.
readme/Rewrites.scalatex
Outdated
// before | ||
case List(1, 2, xs @@ _*) | ||
// after | ||
case List(1, 2, _*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing colon?
I tracked down the issue to a configuration error in the ci build script. I opened #186 to fix this. |
Also, please run |
Please rebase on top of master and see if that fixes the CI errors. |
Many thanks @olafurpg ! Rebased & the doc error fixed (plus a minor sbt build issue for local builds). We'll see if it builds :) |
Cool! Looks like all the tests pass. Only thing missing is to run./scalafmt and we are good to go! |
Sorry 'bout the fmt, fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 great work @gosubpl
@olafurpg many thanks for all your help, and thanks for your patience, this was my first PR for |
* use sbt 1.3+ SemanticdbPlugin to get semanticdb output * test Scala 2.12 rule against Scala 3 input using sbt-projectmatrix * Check Scala 2.x input/output with Scala 2.x rule (as before) * Check Scala 3 input/output with Scala 2.12 rule * Disable coverage (even after `coverage` command) on input/output projects as scoverage is not available in Scala 3 and coverage there is not useful there anyway * Limit strict conflictManager to rules to workaround false positives caused by org.scala-lang:scaladoc_3:3.0.0 * Scala 3: removeUnused cannot work as compiler support is missing * Scala 3: package objects imports do not work well * Scala 3: groupExplicitlyImportedImplicitsSeparately has no effect
Refs #59