-
Notifications
You must be signed in to change notification settings - Fork 407
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
Changes to scalacheck to cross compile with Dotty #423
Conversation
b71fb5f
to
365a116
Compare
@rickynils Are you interested in these changes (or a subset)? Or should I close? |
365a116
to
1e1302c
Compare
@rickynils this would be great! bump! |
All comments against this PR were addressed 9 months ago, and yet it wasn't merged or closed, what's the hold up ? I've now rebased this PR to fix conflicts, while I was at it I removed one change which is no longer needed (Seed#apply) and added two extra commits to let Dotty compile the code without |
The |
Seems like all of this could be included a 1.14.1 bug fix release to me. I think the change to |
Are source-incompatible but binary-compatible changes allowed in the 1.14 branch ? One way to obtain the same result as dotty-staging@00f01af would be to simply remove the |
As described, that sounds like a change like that would be pretty disruptive to users in a 1.14.1 release. I wonder if you should create an issue (or issues) to discuss the various Dotty changes you need in ScalaCheck. One assumes there will need to be a lot of coordination and investigation. |
Besides this PR, the BooleanOperators thing is the only necessary change I'm aware of, we switched the Functional Programming course at EPFL to Dotty last year, the course introduces students to property checking with scalacheck (like the mooc), and those changes were the only one we needed to get everything working. |
Anything else needed to get this merged ? |
For a Boolean b and a prop p, the following is ambiguous in dotty: import Prop._ b ==> p Because Prop contains: implicit def BooleanOperators(b: => Boolean) = new ExtendedBoolean(b) implicit def propBoolean(b: Boolean): Prop = Prop(b) And both ExtendedBoolean and Prop provide a `==>` method, the one in `ExtendedBoolean` just forwards to the one in `Prop`. This is not ambiguous in scalac because `Boolean` wins against `=> Boolean` but it is in dotty (and intentionally so). In general, it seems that all the methods in BooleanOperators are also available on Prop, so BooleanOperators does not serve any purpose and can be deprecated. We can then make it non-implicit in a subsequent release of scalacheck (thus breaking source-compatiblity but not binary-compatiblity) to finally be able to compile it with Dotty (which also requires getting typelevel#423 in).
As a first step towards this, I've opened a PR to deprecate |
Unfortunately, we merged #498 first so there's a conflict. Fortunately, the conflict is just a single line. Would you be able to rebase? I also wonder if the new version of MiMa raises anything else. |
1194d67
to
b06de52
Compare
Rebased. |
Strange errors from MiMa:
It happens for Scala 2.11 and 2.12 for both Java and Scala.js 6.0. I'm not sure what to make of this. |
@dwijnand is that something you've seen before? |
Try restarting the build, travis flakiness manifests itself in weird ways sometimes |
Unfortunately, this also happens for me locally, as well. |
No, that's a new one. |
I was able to bisect it to the "Stop using reflective calls" commit. There's a lot of changes in that commit, but the change of |
rebase, now that #521 is merged? |
Would @non weigh-in on the binary-compat change? I've been meaning to explore it, but haven't because I predict he may have draw a harder line on this then I had done so previously. |
While it's technically possible to make them work with Dotty, it's better to just stop using them since they're slow and also unnecessary here.
Implicitly available functions do not provide implicit views in Dotty, so we need to call them explicitly. (Their long term replacement is documented in http://dotty.epfl.ch/docs/reference/contextual/conversions.html but cannot be used when cross-compiling with Scala 2 currently).
`prettyAny` defines an implicit conversion from `Any` to `Pretty`, this is really dangerous in general. Here the problem is that `Pretty` has a `map` member, so Dotty ends up choosing this conversion when we call `map` on an array. We work around this by first converting the array to a list, but the implicit conversions in this file should really be rethought.
7b95f2e
to
7bb0613
Compare
@ashawley I think this is OK. As you say, it's private to ScalaCheck and should be fine. We may want to do a 1.14.1-RC1 release, just to ensure that this works for people. Assuming there aren't compatibility bugs we can release the same code as 1.14.1. That said, I'm also fine just releasing 1.14.1 and if there are issues moving onto 1.14.2 to fix them (life is short). |
I'm gonna go ahead and merge this. @smarter thanks so much for sticking with this! |
Ok, just wanted to make sure you had reviewed these changes. Yes, I think doing a follow-up release should there be issues is a good plan. |
I left out dotty-staging@00f01af on purpose because it is a binary incompatible change. Apart from that
scalacheck
cross compiles with Dotty