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

Some small changes for Dotty compatibility #757

Merged
merged 9 commits into from
Jan 27, 2020

Conversation

travisbrown
Copy link

@travisbrown travisbrown commented Jan 22, 2020

This is a set of changes that prepare for Dotty cross-building but are reasonable to do now:

  • I've replaced kind-projector's ? with *, which will be supported in Dotty soon.
  • Dotty is pickier about parentheses (which also helps readability and consistency in my view).
  • Dotty doesn't support eta-expansion syntax for converting by-name parameters to Function0.
  • Dotty warns on final on case objects, and it doesn't do anything on Scala 2.
  • Dotty doesn't have do-while, and recommends the rewrite I've done here.
  • In a few places we rely on Scala 2 value discarding, which I've changed to either .void or ; ().
  • One test extends BeforeAndAfterAll but doesn't use any of its methods, and it was causing problems with my local Dotty build of ScalaTest, so I just removed it here.

After these changes (and #756) a few other things are necessary to get tests passing on Dotty (see my branch here for a complete list of the additional changes that are needed).

  • Right now you have to publish Dotty locally from my kind-projector branch.
  • You also still need to publish ScalaTest locally if you want to run the tests.
  • You have to use my Simulacrum Scalafix rules to expand @typeclass.
  • You have to use another of those Scalafix rules to expand kind-projector's polymorphic lambda value syntax, which isn't supported in my Dotty branch.
  • There's a bug with private constructors in Dotty that you have to work around.
  • There's a possible bug involving type aliases that also needs working around.
  • There are a few places where Dotty can't infer types that Scala 2, or where you need to cast to Any (see my topic/dotty-experiment branch for details).

The good news is that if you make all of those changes and publish Dotty and ScalaTest locally, all (core) tests pass on Dotty.

@neko-kai
Copy link

neko-kai commented Jan 22, 2020

Dotty warns on final on case classes and objects

Do you mean just on case objects? There's no reason to warn on final case classes, if there's a warning, it must be an upstream bug.

@travisbrown
Copy link
Author

@neko-kai Oh, right, I went past those warnings too quickly. I've added final back for Error.

Copy link
Member

@djspiewak djspiewak left a comment

Choose a reason for hiding this comment

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

Not gonna lie, that new encoding of do/while took me a second to decode… I like all of these changes, even on their own. Thanks for taking point on this!

@djspiewak djspiewak merged commit 80e6b15 into typelevel:master Jan 27, 2020
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.

3 participants