-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
cross-build for 2.13 #287
cross-build for 2.13 #287
Conversation
At least bijection-core |
@martijnhoekstra are you still working on this? I can pick it up if you don't mind. |
Oh, yes, I can pick this up again; I thought this one was ready to go, but maybe it isn't. |
build.sbt
Outdated
@@ -39,7 +39,7 @@ def versionFallback(scalaVersion: String, packageVersion210: String, version: St | |||
|
|||
val buildLevelSettings = Seq( | |||
organization := "com.twitter", | |||
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1"), | |||
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1", "2.13.0"), |
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.
Worth updating all of them? I think the latest are 2.10.6, 2.11.12, 2.12.10, & 2.13.1
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.
2.10.7, I think
Also we should probably get the CI build green. |
Yeah, I think scala-steward is a win for all repos. |
2027265
to
d0ae146
Compare
Oh, it turns out I had lots of half-baked stuff laying around for bijection. There was lots of stuff that needed fixing, and I'm not sure what order I had in mind for that. Maybe first we can see what scala-steward brings to the table. |
@martijnhoekstra what about a quick fixup on this PR so we can get it in and let scala-steward pick up the rest? |
@nevillelyh if it indeed turns out to be a quick fixup I'm all for it. When I get home tonight I can work on that, and see if it is and the problem is just scalafmt, or if there is more going on. |
quick update: this is far farther from home than I had hoped. |
I'd like to use the strategy of making a We did something like this here: |
that sounds good @johnynek -- even without the bincompat argument it'll be necessary. |
I burned this branch to the ground, and started it with a new blank slate. Marked the PR WIP. |
//things do work out. Without, we get diverging expansion starting at | ||
//Injection.fromImplicitBijection | ||
implicit val i1 = Bijection.fromInjection(Injection.int2String) | ||
def ibij: ImplicitBijection[CA, CB] = implicitly[ImplicitBijection[List[Int], Vector[String @@ Rep[Int]]]] |
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.
@johnynek I pushed my WIP, as I'm hitting a hurdle here: scala 2.13 runs out of heap trying to get some sort of LUB here (I haven't figured out what it's trying to LUB). Ideas/sage advice/sharp insight more than welcome.
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.
The whole A @@ Rep[B]
trick is very rarely used. In general, most cases would use Injection[A, B]
It may be that something with the tricks to do @@
//if we start here with Bijection.fromInjection(Injection.int2String) | ||
//things do work out. Without, we get diverging expansion starting at | ||
//Injection.fromImplicitBijection | ||
implicit val i1 = Bijection.fromInjection(Injection.int2String) |
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.
it could help to put a type here, maybe Bijection[Int, String @@ Rep[Int]]
?
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 keeps getting weirder. With
implicit val i1 = Bijection.fromInjection(Injection.int2String)
def ibij: ImplicitBijection[CA, CB] = implicitly[ImplicitBijection[CA, CB]]
it succeeds fine.
With def ibij: ImplicitBijection[CA, CB] = implicitly[ImplicitBijection[List[Int], Vector[String @@ Rep[Int]]
it crashes the compiler with OOM. That's obviously a compiler bug, but it's not immediately clear to me if, and if so how we can work around.
scala/bug#11770 messes up bijection-clojure. Worked around by calling generated static java methods. |
0aba187
to
1ca6489
Compare
bijection-core/src/test/java/com/twitter/bijection/TestBijectionInJava.java
Outdated
Show resolved
Hide resolved
implicit val numericTypeclassBijection: TypeclassBijection[Numeric] = | ||
new TypeclassBijection[Numeric] { | ||
def apply[A, B](tc: Numeric[A], bij: Bijection[A, B]) = | ||
new Numeric[B] { | ||
def plus(x: B, y: B) = bij(tc.plus(bij.invert(x), bij.invert(y))) | ||
def minus(x: B, y: B) = bij(tc.minus(bij.invert(x), bij.invert(y))) | ||
def times(x: B, y: B) = bij(tc.times(bij.invert(x), bij.invert(y))) | ||
def negate(x: B) = bij(tc.negate(bij.invert(x))) | ||
def fromInt(x: Int) = bij(tc.fromInt(x)) | ||
def toInt(x: B) = tc.toInt(bij.invert(x)) | ||
def toLong(x: B) = tc.toLong(bij.invert(x)) | ||
def toFloat(x: B) = tc.toFloat(bij.invert(x)) | ||
def toDouble(x: B) = tc.toDouble(bij.invert(x)) | ||
def compare(x: B, y: B) = tc.compare(bij.invert(x), bij.invert(y)) | ||
} | ||
} | ||
|
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.
Extending numeric requires an extra member in 2.13. Probably not worth it to split this test up, as typeclass testing seems adequately tested in other tests. Does it need additional replacements?
bijection-core/src/test/java/com/twitter/bijection/TestBijectionInJava.java
Outdated
Show resolved
Hide resolved
@@ -73,7 +71,7 @@ trait LowPriorityJson { | |||
* You need to import all the methods of this object to get general | |||
* Injection[T,JsonNode] to work | |||
*/ | |||
object JsonNodeInjection extends LowPriorityJson with java.io.Serializable { | |||
object JsonNodeInjection extends CollectionJson with LowPriorityJson with java.io.Serializable { |
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 approach, with version specific parts mixed in to a version-neutral "main" can also be applied to the other split files. The upside is less duplicated code. The downside is more complexity. Both are backward binary compatible.
Happy to do it either way.
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.
https://github.com/twitter/bijection/compare/develop...martijnhoekstra:213_unsplit?expand=1 is the "keep as much as possible together" approach
Rebased to fix conflicts in tests |
6a01c7d
to
1a77bc8
Compare
|
rebased |
Any update on the status of this? This is blocking the conversion of the memcached module over in #771 (which seems to be the last dependencyless module) |
If I remember right this is ready for review |
This looks good anything keeping this from merging? |
LGTM and MiMa is green too. @johnynek wanna take a final look? |
This is great! Thanks for all the hard work! |
Nice! Is a release also possible? |
No description provided.