Skip to content
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

handle breaking change in transitive dep scalameta 4.5.0 #194

Closed
wants to merge 3 commits into from

Conversation

bjaglin
Copy link

@bjaglin bjaglin commented Feb 26, 2022

Follow-up of scalacenter/scalafix#1556. Not meant to be merged for now, but to centralize investigation.

@bjaglin
Copy link
Author

bjaglin commented Mar 1, 2022

=======
=> Diff
=======
--- obtained
+++ expected
@@ -24,9 +24,9 @@
∙
-  val fk1 = λ[FuncK[Option, List]](_.toList)
+  val fk1 = new FuncK[Option, List] { def apply[A$](a$: Option[A$]): List[A$] = a$.toList }
   val fk2 = new FuncK[Option, List] { def apply[A$](a$: Option[A$]): List[A$] = Nil }
-  val fk3 = λ[List ~> Option](_.headOption)
+  val fk3 = new (List ~> Option) { def apply[A$](a$: List[A$]): Option[A$] = a$.headOption }
   val fk4 = new (List ~> Option) { def apply[A$](xs: List[A$]): Option[A$] = xs.lastOption }
   val fk5 = new (({ type λ[α$] = Foo[α$, Int] })#λ ~> Option) { def apply[A$](a$: Foo[A$, Int]): Option[A$] = None }
-  val fk6 = λ[FuncK[List, λ[x => List[List[x]]]]](List(_))
-  val fk7 = λ[List ~> Option](_.headOption.map(identity))
+  val fk6 = new FuncK[List, ({ type λ[x] = List[List[x]] })#λ] { def apply[A$](a$: List[A$]): List[List[A$]] = List(a$) }
+  val fk7 = new (List ~> Option) { def apply[A$](a$: List[A$]): Option[A$] = a$.headOption.map(identity) }
   val fk8 = new (List ~> Option) { def apply[A$](list: List[A$]): Option[A$] = {
         
[info] RuleSuite:
[info] - fix/One.scala
[info] - fix/Alternative.scala
[info] - fix/KindProjectorRewrite.scala *** FAILED ***
[info]   see above (AbstractSemanticRuleSuite.scala:91)
[info] - fix/AddSerializable.scala
[info] - fix/TypedLambdaParamRewrite.scala
[info] - fix/AddImplicitNotFound.scala
[info] - fix/Compose.scala
[info] - fix/Invariant.scala
[info] - fix/Apply.scala
[info] - fix/AddSummoner.scala
[info] Run completed in 1 second, 66 milliseconds.
[info] Total number of tests run: 10
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 9, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***

@bjaglin
Copy link
Author

bjaglin commented Mar 2, 2022

-@ import $ivy.`org.scalameta::scalameta:4.4.35`, scala.meta._ 
+@ import $ivy.`org.scalameta::scalameta:4.5.0`, scala.meta._ 
 @ """object Foo { val a = λ[FuncK[Option, List]](_.toList) }""".parse[Source].get 
 res1: Source = Source(
   stats = List(
     Defn.Object(
       mods = List(),
       name = Term.Name(value = "Foo"),
       templ = Template(
         early = List(),
         inits = List(),
         self = Self(name = , decltpe = None),
         stats = List(
           Defn.Val(
             mods = List(),
             pats = List(Pat.Var(name = Term.Name(value = "a"))),
             decltpe = None,
             rhs = Term.Apply(
              fun = Term.ApplyType(fun = Term.Name(value = "λ"), targs = List(Type.Apply(tpe = Type.Name(value = "FuncK"), args = List(Type.Name(value = "Option"), Type.Name(value = "List"))))),
-              args = List(Term.Select(qual = _, name = Term.Name(value = "toList")))
+              args = List(Term.AnonymousFunction(body = Term.Select(qual = _, name = Term.Name(value = "toList"))))
             )
           )
         ),
         derives = List()
       )
     )
   )
 )

The regression comes from scalameta/scalameta#2601

@bjaglin
Copy link
Author

bjaglin commented Mar 2, 2022

Marking this as ready for visibility. Following-up about the wider impact of this in scalacenter/scalafix#1556 (comment).

@bjaglin bjaglin marked this pull request as ready for review March 2, 2022 23:00
@bjaglin bjaglin changed the title test scalafix SNAPSHOT with scalameta 4.5.0 handle breaking change in transitive dep scalameta 4.5.0 Mar 2, 2022
@@ -1,4 +1,7 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
resolvers += Resolver.sonatypeRepo("snapshots")
dependencyOverrides += "ch.epfl.scala" % "scalafix-interfaces" % "0.9.34+52-a83785c4-SNAPSHOT"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjaglin
Copy link
Author

bjaglin commented Apr 6, 2022

@sh0hei scalafix 0.10.0 is around the corner and running simulacrum-scalafix 0.5.0 as-is on scalafix 0.10.x will cause missed rewrites as identified by the tests above (and a warning for the user as described in the release notes). I can update this PR as soon as 0.10.0 is tagged, and I guess a 0.6.0 (only compatible with scalafix 0.10.x) would be useful?

vendamere added a commit that referenced this pull request Apr 26, 2023
Fixes issue related to updating identified in #194 by @bjaglin
Updates to scala 2.12.17 and 2.13.10
vendamere added a commit that referenced this pull request Apr 26, 2023
Fixes issue related to updating identified in #194 by @bjaglin
Updates to scala 2.12.17 and 2.13.10
@vendamere
Copy link
Collaborator

Closing since this was handled in #243 and have a draft release in #244
Thanks @bjaglin

@vendamere vendamere closed this May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants