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

Switch to the 2.13 standard library #7019

Merged
merged 88 commits into from
Aug 25, 2019

Commits on Aug 19, 2019

  1. Remove accidental uses of the companion object Unit

    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.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    c485603 View commit details
    Browse the repository at this point in the history
  2. Always fork when running stuff

    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.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    f3ab8b9 View commit details
    Browse the repository at this point in the history
  3. Treat some Java interfaces as universal traits

    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.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    f041b1d View commit details
    Browse the repository at this point in the history
  4. Start building Dotty against the 2.13 stdlib

    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.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    9953816 View commit details
    Browse the repository at this point in the history
  5. Slight build refactoring

    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).
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    a6efeb6 View commit details
    Browse the repository at this point in the history
  6. Change extension method naming scheme to match 2.13

    See scala/scala#7896 and follow-up
    scala/scala#7922, we can do both steps at once
    since we always run with a bootstrapped dotty-library on the classpath, even
    if the compiler itself is not bootstrapped.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    662b7e0 View commit details
    Browse the repository at this point in the history
  7. Handle s and raw interpolator with 2.13 stdlib

    These methods are now macros, so we always need to expand them.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    1168003 View commit details
    Browse the repository at this point in the history
  8. Cross-compile the compiler with the 2.13 stdlib

    We still need to support compiling it against the 2.12 stdlib until we
    release a new reference compiler because the current reference compiler
    cannot use the 2.13 stdlib. This is mostly not a problem, except that
    this forces us to keep two versions of WeakHashSet, the same source file
    cannot be used for both the 2.12 and 2.13 stdlib since `-=` and `+=` are
    final in 2.13.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    5acd4bf View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5053e03 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    1ac18ba View commit details
    Browse the repository at this point in the history
  11. Compile the language server with the 2.13 stdlib

    No cross-compilation needed since it's a bootstrapped-only project.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    2ae438d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    72a5b71 View commit details
    Browse the repository at this point in the history
  13. Update scala-xml for the 2.13 stdlib

    Also update it to master.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    3f53d57 View commit details
    Browse the repository at this point in the history
  14. Allow implementing unapplySeq using scala.collection.Seq

    Needed to compile scala-xml with the 2.13 stdlib.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    af63f66 View commit details
    Browse the repository at this point in the history
  15. Adapt/remove tests for the 2.13 stdlib.

    For the tests that were originally copied from scalac, I also copied the
    updated version if one existed, or removed it if they had removed it.
    
    Unfortunately, I also had to remove a bunch of Dotty tests that relied
    on details of the 2.12 stdlib that I couldn't easily port to the 2.13
    stdlib.
    
    i3518 has to be disabled because using scala.Unit is marked @compileTimeOnly
    and dotty crashes on @compileTimeOnly right now.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    b9ba16e View commit details
    Browse the repository at this point in the history
  16. fix some deprecations

    bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    a767979 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    88b9c26 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    8873694 View commit details
    Browse the repository at this point in the history
  19. refactor, fix caseClassHash test

    Static.mix(acc, this.productPrefix.hashCode()) in synthetic case class hash code updated to add parens.
    bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    73f20b5 View commit details
    Browse the repository at this point in the history
  20. refactor definitions

    bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    ab20515 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    c1ac8a9 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    832e0dd View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    a08d86b View commit details
    Browse the repository at this point in the history
  24. Unmangle external references unpickled from Scala 2

    This is necessary in particular to properly unpickle annotations with
    default arguments, since default arguments have mangled names, this is
    necessary to unpickle various parts of the 2.13 stdlib.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    a946a3c View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    94485c7 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    0eb4885 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    a60feb8 View commit details
    Browse the repository at this point in the history
  28. drop some tests in effpi

    bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    dd48d1c View commit details
    Browse the repository at this point in the history
  29. Say goodbye to the 2.12 stdlib

    It's too hard to maintain it on top of the 2.13 stdlib, too bad because
    it's proven to be a great torture test of the compiler.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    eaa10f1 View commit details
    Browse the repository at this point in the history
  30. Allow user-written productElementName

    Needed to get the productElementName.scala test to pass when using the
    2.13 stdlib
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    983dc85 View commit details
    Browse the repository at this point in the history
  31. Remove i966.scala test and corresponding code path

    We can't compile this test with the 2.13 stdlib, and the only codepath
    it's supposed to exerce is currently dead code, I assume that the raw
    Array that showed up there was due to some bug that has since been
    fixed.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    792d610 View commit details
    Browse the repository at this point in the history
  32. Properly unpickle Scala 2 refinements

    They're pickled with a class symbol, but we unpickled them as a type
    aliases, which meant that the logic in REFINEDtpe wasn't able to
    substitute `this` references correctly (there was even a comment
    expressing puzzlement about this). Instead, unpickle them as
    classes (TODO: add some logic in TreeChecker to make sure these symbols
    are never referenced anywhere).
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    0cb2a53 View commit details
    Browse the repository at this point in the history
  33. Fix classloader confusion in the REPL

    The REPL constructed a classloader containing the user classpath but
    having the classloader used to run the REPL as a parent, meaning that
    the scala-library we actually used came from the JVM classpath, so of
    course everything exploded when using a repl compiled with the 2.12
    stdlib and running with the 2.13 stdlib. Fixed by having
    Rendering#classpath be constructed without any parent, just based on the
    user classpath. This required some additional changes:
    
    - We called ScalaRuntime#replStringOf using the ScalaRunTime class from
    the scala-library used by the REPL, switch to calling it reflectively
    through
    - ReplDriver#withRedirectedOutput used `Console.withOut/Err` but that only
    affects the Console object in the current classloader, not the one in
    the user classloader, use `System.setOut/Err` instead (the class
    `System` comes from the system classloader so there's only one of it).
    - The macro tests now need to be run with the compiler on the user
    classpath, this required some refactoring (This would be simpler to
    handle if ReplTest didn't extend ReplDriver, but I'll let someone else
    do that refactoring)
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    44b4754 View commit details
    Browse the repository at this point in the history
  34. Adapt REPL tests for the 2.13 stdlib

    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    658eecf View commit details
    Browse the repository at this point in the history
  35. Fix typing of PartialFunction argument to overloaded method

    Applications#preTypeArgs can type arguments with an expected type like
    `PartialFunction[Int, WildcardType]`, before this commit this was
    rejected by `typedClosure` because it requires the expected type to be
    fully-defined. Fixed by replacing the underdefined expected type by a
    new one where the argument types come from the closure method type.
    
    This is useful in particular to type `Map#collect` in 2.13 which is
    overloaded.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    3c2583f View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    4cb144d View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    8778967 View commit details
    Browse the repository at this point in the history
  38. modify scalatest build

    bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    a7c6df2 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    a220ba1 View commit details
    Browse the repository at this point in the history
  40. Avoid loop in subtype checking of applied types

    `isMatchingApply(tp1)` compares the applied type `tp1` with `tp2`.
    Before this commit, we called it recursively incorrectly by passing it a
    type constructor instead of an applied type. The result was that it
    returned false when it shouldn't. This lead to infinite loops in some
    cases as demonstrated by tests/pos/factory-conversion.scala.
    
    Note: even before this commit, the added test case used to compile, but
    only when using a non-bootstrapped compiler. This puzzling behavior was
    due to the logic in `monitoredIsSubType` detecting the loop and breaking
    out of it before it lead to a stackoverflow. Of course this kind of
    detection is fragile since it depends on the stack size as well as the
    size of each stack frame, so we just happened to get lucky with the
    non-bootstrapped compiler but not with the bootstrapped one. As always,
    when debugging subtyping issues, it's a good idea to run the compiler
    with `-Yno-deep-subtypes` to replace the recovery logic in
    `monitoredIsSubType` by an immediate crash.
    smarter authored and bishabosha committed Aug 19, 2019
    2 Configuration menu
    Copy the full SHA
    145132a View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    0e2aff6 View commit details
    Browse the repository at this point in the history
  42. Move macro test in the correct directory

    Otherwise we'll run it with the non-bootstrapped compiler which can only
    work by chance.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    5f8b0bf View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    0cf8fd9 View commit details
    Browse the repository at this point in the history
  44. Fix exhaustiveness warnings on 2.13

    SeqFactory changed package, since we never actually complete the symbol,
    this did not lead to a runtime error since we ended up creating a stub
    symbol for it.
    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    494cb00 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    38a423d View commit details
    Browse the repository at this point in the history
  46. Adapt macro tests to the 2.13 stdlib

    smarter authored and bishabosha committed Aug 19, 2019
    Configuration menu
    Copy the full SHA
    02c5293 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    71a022c View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    b2f1eed View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    ea916ce View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    67052f1 View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    4d06960 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2019

  1. Configuration menu
    Copy the full SHA
    1cd41fe View commit details
    Browse the repository at this point in the history
  2. rebase sourcecode

    bishabosha committed Aug 21, 2019
    Configuration menu
    Copy the full SHA
    1fa8e91 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2019

  1. Take number of type parameters into account when choosing an overload

    In Tasty, pickling a selection will pickle its signature using the
    SIGNED tag to be able to distinguish overloads, this usually works but
    it turns out that some overloads have the same signature (see
    tests/pos/poly-signature.scala, but this also affects `Set#++` in the
    2.13 collections), resulting in ambiguous overload errors when
    unpickled.
    
    This commit solves this problem by also storing the number of type
    parameters in the signature. The obvious way to implement this would be
    to add a field of type Int to the `Signature` case class, but that
    wouldn't scale to a future where methods may have multiple type
    parameter lists, so instead we change the existing `paramsSig:
    List[TypeName]` field to take a list of `TypeName | Int`.
    smarter committed Aug 22, 2019
    3 Configuration menu
    Copy the full SHA
    f951534 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    335806a View commit details
    Browse the repository at this point in the history
  3. fix some tests

    tests/pos/javaReadsSigs/fromjava.java still imported old collections
    
    doc-tool/test/dotty/tools/dottydoc/WhitelistedStdLib.scala and GenCollections depended on the removed scala 2 library
    bishabosha committed Aug 22, 2019
    Configuration menu
    Copy the full SHA
    953b940 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9010a4b View commit details
    Browse the repository at this point in the history
  5. Make sure the community build runs with the correct ivy cache

    This is necessary for the community build to work on the CI now that we
    run the community build with fork in Test set to true.
    smarter committed Aug 22, 2019
    Configuration menu
    Copy the full SHA
    00d2bf0 View commit details
    Browse the repository at this point in the history
  6. Bump version to 0.18.1

    And use this version as an indicator of 2.13 support, to allow sbt-dotty
    to work with nightly builds of 0.18 from both before and after the
    switch to 2.13.
    smarter committed Aug 22, 2019
    Configuration menu
    Copy the full SHA
    f5459d0 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2019

  1. Force a nightly to be published

    To be used as a reference compiler in this PR so that we do not need to
    keep our codebase compatible with both the 2.12 and 2.13 stdlib which
    prevents us from fixing many deprecation warnings properly.
    smarter committed Aug 23, 2019
    Configuration menu
    Copy the full SHA
    8c856e9 View commit details
    Browse the repository at this point in the history
  2. Update reference compiler and remove final deprecations

    - also updated drone.yml to remove nightly publishing
    bishabosha committed Aug 23, 2019
    Configuration menu
    Copy the full SHA
    af66579 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a75c3f7 View commit details
    Browse the repository at this point in the history
  4. Reenable fatal warnings

    This is possible now that all deprecation warnings are fixed.
    smarter committed Aug 23, 2019
    Configuration menu
    Copy the full SHA
    e27eb9d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3d13696 View commit details
    Browse the repository at this point in the history
  6. ScriptEngine: Avoid classpath pollution

    If we don't set "-classpath" explicily the default will be "-classpath
    .", this resulted in test failures due to "." containing the output of
    previous tests.
    smarter committed Aug 23, 2019
    Configuration menu
    Copy the full SHA
    878db33 View commit details
    Browse the repository at this point in the history
  7. Adapt tasty-reflect for the changes in Signature

    Further work to present a nicer API for Signature might be needed.
    smarter committed Aug 23, 2019
    Configuration menu
    Copy the full SHA
    e8db9d5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6e32d39 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f82d9a3 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c5f9b2a View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2019

  1. Remove dead case and update checkfile

    productElementName is no longer generated in Desugar after the previous
    commit.
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    87416ea View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4fd550f View commit details
    Browse the repository at this point in the history
  3. Make i3187 a fuzzy test

    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.
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    acfe55c View commit details
    Browse the repository at this point in the history
  4. Inlining: Constant-fold select trees

    This fixes a pickling/unpickling difference in sip23-valueof.scala and
    makes sense in general.
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    a553078 View commit details
    Browse the repository at this point in the history
  5. Move original t5375 to pending

    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.
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    b4b9fe5 View commit details
    Browse the repository at this point in the history
  6. Fix language server tests

    I accidentally replaced `"` by `'` in the generated .dotty-ide.json file
    in 2ae438d which broke everything.
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    79bcc5c View commit details
    Browse the repository at this point in the history
  7. Fix -Ytest-pickler handling of aliases

    We now need to dealias deeply to get tests/run/Course-2002-13.scala and
    tests/run/enrich-gentraversable.scala to pass.
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    960498b View commit details
    Browse the repository at this point in the history
  8. Fix unstable compiler output due to using Set

    `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).
    smarter committed Aug 24, 2019
    Configuration menu
    Copy the full SHA
    b93d83c View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2019

  1. Configuration menu
    Copy the full SHA
    13e76a7 View commit details
    Browse the repository at this point in the history
  2. Fix infinite-loop when using Jar#iterator

    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).
    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    23f77c4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    64bcaad View commit details
    Browse the repository at this point in the history
  4. Remove hiding of CanBuildFrom params from the IDE/REPL

    Not needed with 2.13 where CanBuildFrom is mostly gone.
    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    3e4a9cc View commit details
    Browse the repository at this point in the history
  5. Make Scala.js happy

    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    a43efe3 View commit details
    Browse the repository at this point in the history
  6. Re-fix test failure on Java 11

    Originally fixed in f8a746e, lost in
    b9ba16e when tests were updated based
    on their version in scala/scala.
    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    9e77e21 View commit details
    Browse the repository at this point in the history
  7. Fix a typo in Signature

    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    ce05244 View commit details
    Browse the repository at this point in the history
  8. Delete obsolete comment

    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    cd56de3 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5a3ad0d View commit details
    Browse the repository at this point in the history
  10. Force another nightly to be published

    To pick up the improvements since the previous one.
    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    6960f8d View commit details
    Browse the repository at this point in the history
  11. Bump reference compiler to the previous commit

    And the revert the CI changes from the previous commit which are no
    longer needed.
    smarter committed Aug 25, 2019
    Configuration menu
    Copy the full SHA
    37fab22 View commit details
    Browse the repository at this point in the history