-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Switch to the 2.13 standard library #7019
Conversation
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Add" instead of "Added")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
3a317ae
to
40c9fee
Compare
@bishabosha I'll look into the failing test cases, meanwhile, feel free to help with any of the other items in the todo list above. |
On the CI the community build fails to build every project with:
But I can't reproduce that locally. Weird, but this doesn't prevent us from working on it locally at least. |
@milessabin There's (at least) one compilation error for shapeless on 2.13: [error] -- [E007] Type Mismatch Error: /home/smarter/opt/dotty/community-build/community-projects/shapeless/core/src/main/scala/shapeless/shapeless.scala:64:51
[error] 64 | WrappedArray.make[String](summonValuesAsArray[mirror.MirroredElemLabels])
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] | Found: Array[Any]
[error] | Required: Array[String]
[error] one error found If you have the time, it'd be great if you could take a look at it. |
40c9fee
to
f8f8a18
Compare
now I see why there is 😱 for deprecation |
@milessabin There's still an error [error] -- [E007] Type Mismatch Error: /home/smarter/opt/dotty/community-build/community-projects/shapeless/core/src/main/scala/shapeless/shapeless.scala:65:31
[error] 65 | WrappedArray.make[String](summonValuesAsArray[mirror.MirroredElemLabels, String])
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] | Found: scala.collection.mutable.ArraySeq[String]
[error] | Required: Seq[String] This can be solved by adding a .toSeq to get an immutable Seq, but there might be a nicer way. Note that you don't necessarily need to keep compiling against both the 2.12 and 2.13 stdlib, I'm happy with a 2.13-only git branch. |
@smarter I'll add the |
Done in #7021. |
5cc7de5
to
0099330
Compare
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.
@bishabosha Would be good to add some test cases for the hashcode changes.
Actually we already have a related test that should be updated: https://github.com/lampepfl/dotty/blob/master/tests/run/caseClassHash.scala https://github.com/lampepfl/dotty/blob/master/tests/run/caseClassHash.check |
with the new update ## and MurmurHash produce the same value |
1ded229
to
abb75a0
Compare
@bishabosha what's with the shapeless bump? That's already merged on master ... wouldn't it be easier to rebase? |
88dfe50
to
44c1a98
Compare
490fc95
to
4762d30
Compare
@milessabin Rebased with your patch in. |
@liufengyun Unfortunately, https://github.com/liufengyun/bench/tree/master/tests/scala-library does not compile anymore now that the compiler runs using the 2.13 stdlib. I tried to hack it to make it compile, but it seems pretty hard, so I think we'll have to remove it from the benchmarks, and replace it by the new stdlib. |
45c46d2
to
fffc3c4
Compare
e0a6fab
to
be5e67d
Compare
The value of type Unit is `()`, using `Unit` usually also works because it refers to the companion object of the class Unit, and because of automatic `()` insertion when the expected type is `Unit`, but it's still wrong. 2.13 marked it as `@compileTimeOnly` which is how I noticed.
This is easier to reason about, in particular because it avoids having to think about what kind of classloader sbt decided to inflict upon us. This fixes running the community-build test after switching to the 2.13 stdlib in the bootstrapped build.
This matches the behavior of Scala 2, this is necessary when using the 2.13 stdlib where scala.Serializable is a type alias of java.lang.Serializable, otherwise the compiler will disallow extending both Serializable and AnyVal.
This required some surgery in Build.scala: when compiling the non-bootstrapped compiler, we need the 2.12 stdlib on the JVM and compiler classpaths, because the current reference compiler cannot be run using the 2.13 stdlib, on the other hand when _running_ the non-bootstrapped compiler we need to the 2.13 stdlib on the compiler classpath to produce a bootstrapped compiler that links against 2.13. Upgrade the Scala 2 PickleFormat version to 5.2 (which is in fact identical to 5.0). Remove no longer needed -Ynew-collections flag and update the related test files.
Replace getExternalDep and findLib by findArtifact, which is safer than getLib was (it doesn't use `contains` to find the name which might yield false positives).
productElementName is no longer generated in Desugar after the previous commit.
It doesn't output an error anymore for some reason, but that's fine: we only care about it not crashing the compiler, which is what fuzzy tests check.
This fixes a pickling/unpickling difference in sip23-valueof.scala and makes sense in general.
Needs to be replaced by something that doesn't use the parallel collections, I attempted to do so in b9ba16e but the result caused deadlocks, don't have time to investigate right now.
I accidentally replaced `"` by `'` in the generated .dotty-ide.json file in 2ae438d which broke everything.
We now need to dealias deeply to get tests/run/Course-2002-13.scala and tests/run/enrich-gentraversable.scala to pass.
`membersBasedOnFlags` internally uses `memberNames` which returns a Set, so the order of its elements is unstable. We were using it when generating static forwarder methods which lead to some idempotency tests failing (no idea why this didn't manifest itself before). Fixed by adding a new `sortedMembersBasedOnFlags` which sorts members by names and signatures (this required adding a somewhat arbitrary lexicographic ordering to Signature).
dfbb87a
to
1ba7e75
Compare
So far, Jar was defined as an Iterable implementation that overrides `foreach` and then define `override def iterator = this.toList.iterator` That was OK with the 2.12 stdlib, but stackoverflows with the 2.13 one due to `toList` now being implemented in terms of `iterator`. Any way, it turns out that we don't really need Jar to be an Iterable, so the simplest fix was to just remove these methods, and add back a `toList` for the one usesite that needed it (not very efficient, but not any worse than before).
Not needed with 2.13 where CanBuildFrom is mostly gone.
To pick up the improvements since the previous one.
823254e
to
6960f8d
Compare
And the revert the CI changes from the previous commit which are no longer needed.
🔥🔥🔥 |
Still to do:
As soon as this PR is merged we should publish a new nightly and use it as the reference compiler, so that we don't spend too much time with a build that uses both the 2.12 and 2.13 stdlib (it works, but it can be confusing and cumbersome).