-
Notifications
You must be signed in to change notification settings - Fork 243
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
Support cross-compiling build with 2.13.0-M5 #759
Conversation
2.13 build is failing on breaking changes to collections. This appears several places: pre 2.13: |
note to self, use https://github.com/scala/scala-collection-compat ? |
Codecov Report
@@ Coverage Diff @@
## master #759 +/- ##
==========================================
- Coverage 52.36% 48.68% -3.68%
==========================================
Files 196 212 +16
Lines 11885 12817 +932
Branches 1613 1088 -525
==========================================
+ Hits 6223 6240 +17
- Misses 5662 6577 +915
Continue to review full report at Codecov.
|
commit above cross compiles for main src, but test code compile fails |
I don't have a strong opinion, but I'd prefer if you could use scala-collection-compat. |
@larsrh I am using it. OTOH I might not be using it in the best possible way, since I'm figuring out both the spire code and compat somewhat by trial and error. |
Sorry, I must've missed that. Unfortunately I currently don't have the bandwidth to aid in the process. |
I've had a look at your ongoing work, thank you so much! It can be quite painful to move a beast of a codebase like Spire. Some of the things you've been modifying are quite obscure, such as the partial algebras (groupoids and the like). Happy to cross check your progress. I suggest the following: let's not try to upgrade everything at the same time. A source of breakage is the immtuable Instead, we should stay on 2.11/2.12 and upgrade the collection syntax (factories, etc...), merge that. Then, in a second step, address the immutable Seq. (I haven't checked, though, whether |
Thanks @denisrosset! I have been fooling around with getting test code to compile for 2.11 (which is likely to also work for 2.12 when it does). You can see that the bulk of the breakage (no surprise) has been around the removal of TraversableLike, and CanBuildFrom -> Factory. I got somewhat rat-holed drilling into why the testing code is failing to resolve the new implicit signatures, although I may have just needed One thing I'd love to find is a write-up of what cross-compiling code is "supposed" to look like. "If you are doing everything right, your code should look analogous to these examples..." Based on source diving, I think it's supposed to be "use Iterable and friends as the replacement for Traversable, and use Factory as the replacement CBF" but until I can compile the testing my confidence isn't very high 😁 |
You know what? After you get part of this done, let's write a post for the Typelevel blog. That would be greatly valuable information. (And you know more than me about the transition at this point!) Very happy to have |
#765 is merged now which contained the bumped dependency part of this PR. |
just a note on current state. the analog of
Next experiment will be defining something like The general theme with this has been that spire leverages pre-2.13 constructs (SeqLike, Traversable, @specialized, etc) in such a highly coupled way that cross-compiling to 2.13 is tricky |
Another thing I'm going to try is replacing signatures of the form |
And even when it compiles, it sometimes still maps to nonspecialized code, so buyer beware. For these collection enrichment operations, why not fork the pre-2.13 and 2.13 code? and maintain both versions? Also, let's rename |
I started over with a fresh branch (not pushed yet) that is somewhat cleaner. The |
Looks like tut problems with 2.13 are a known issue: tpolecat/tut#246 |
A summary of quirks unresolved on this PR:
|
OK, the infinite looping is a BigDecimal regression: scala/bug#11152 |
Thanks for digging into this! Truly heroic ☺ |
I'll fix it really soon! (It's already fixed, but I'll get a proper test into the PR.) Or I won't, if it's not a range thing, and you will have to set a sane precision with |
@Ichoran thank you! If I set a |
The
|
picking up some additional inf-looping, which I am pretty sure has to do with Rational and its use of BigDecimal |
Now not so sure that scala/bug#11152 is the problem here, but definitely seems to have something to do with constructing |
I have now resolved the remaining compile errors. There are two remaining unit tests that are inf-looping for scala 2.13. I have these turned off at run-time when running 2.13, and they will now continue to run pre 2.13. @denisrosset, @larsrh, I am ready to propose this for review and hopefully merging. I believe the remaining loose ends are best addressed by filing dedicated issues:
|
I had a look, fine for me; if you can open issues to track the following:
|
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!
This is epic! Thank you so much, @erikerlandson 🎉 |
@larsrh, my pleasure! Can we publish a "-M5" package build for this? |
I'm travelling at the moment, so it'll have to wait for a few days. But I can equip @denisrosset with the publishing rights. |
@@ -543,8 +548,9 @@ lazy val warnUnusedImport = Seq( | |||
CrossVersion.partialVersion(scalaVersion.value) match { | |||
case Some((2, 10)) => | |||
Seq() | |||
case Some((2, n)) if n >= 11 => | |||
case Some((2, n)) if ((n >= 11) && (n <= 12)) => |
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.
just a silly style thing, but you can case Some((2, 11 | 12))
. I sometimes forget that |
is usable other than at the top level of the match.
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.
I had no idea!
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.
There's also
import sbt.librarymanagement.{ SemanticSelector, VersionNumber }
VersionNumber(scalaVersion.value).matchesSemVer(SemanticSelector("2.11.x || 2.12.x"))
…t_eff sql package lint + minor efficiencies
PR for #742