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

Allow toplevel definitions #5754

Merged
merged 48 commits into from
Feb 4, 2019
Merged

Allow toplevel definitions #5754

merged 48 commits into from
Feb 4, 2019

Commits on Feb 1, 2019

  1. Configuration menu
    Copy the full SHA
    e17ded1 View commit details
    Browse the repository at this point in the history
  2. Disallow empty implicit parameter sections

    Previously, `given ()`  was legal, but it serves no purpose and only complicates things.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    8201ae1 View commit details
    Browse the repository at this point in the history
  3. Avoid spurious error spans

    Parser.syntaxError contains a tweak that underlines the whole span
    of the current token, if it has a name. Tho make this work reliably
    we need to reset the name to null when reading a new token, since not every
    token sets a name.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    5dd0a11 View commit details
    Browse the repository at this point in the history
  4. Change syntax of implicit function types and closures

    It's `given A => B` instead of `A |=> B`.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    2baba5b View commit details
    Browse the repository at this point in the history
  5. Fix new tests after merge

    # Conflicts:
    #	tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala
    #	tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    f324ea5 View commit details
    Browse the repository at this point in the history
  6. Fix new tests after changes

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    319d874 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1c90ec2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    af796f7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    1e47e5c View commit details
    Browse the repository at this point in the history
  10. Cleanups

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    e792c88 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3bc0547 View commit details
    Browse the repository at this point in the history
  12. Tweaks to wordings in docs

    Also: drop some doc pages that are no longer used.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    e2f1299 View commit details
    Browse the repository at this point in the history
  13. Implied Conversion -> Implicit Conversion

    Implied felt forced in this context
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    53f00ae View commit details
    Browse the repository at this point in the history
  14. Rename internals to new terminologu

    Token: INSTANCE -> IMPLIED
    Flag: Contextual -> Given
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    a1ffafc View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    c04e041 View commit details
    Browse the repository at this point in the history
  16. Desugar toplevel definitions

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    031532d View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    61564ba View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    359b80f View commit details
    Browse the repository at this point in the history
  19. Docs

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    5b90688 View commit details
    Browse the repository at this point in the history
  20. Change scheme to name package object wrappers

    It's now src$package instead of src#object
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    b069f8d View commit details
    Browse the repository at this point in the history
  21. Allow toplevel implicits

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    ab0ea23 View commit details
    Browse the repository at this point in the history
  22. Disallow toplevel statements other than definitions

    Have tests for other sorts of definitions
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    a105398 View commit details
    Browse the repository at this point in the history
  23. Refine condition for printing package objects

    AN old-style package object of package `p` printed `package object p`.
    Since there are now several possible toplevel source files, we can't
    do the same for toplevel source file. I am not yet quite sure what to
    do instead. For the moment, we just print the name of the generated object.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    97f06e0 View commit details
    Browse the repository at this point in the history
  24. Detect and report double definitions between toplevel files

    Detect and report double definitions between members of different toplevel files.
    This required a fix in method `precedesIn` for the case where neither owner is
    part of the checked baseclass sequence. In that case the answer should be `false`
    but we reported `true`.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    160fe40 View commit details
    Browse the repository at this point in the history
  25. Test source compiled twice

    Test that an error message is issued for sources in different directories
    but with the same filename and package.
    
    Also: Drop out-of-date ErrorMessageTest
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    0aab6e4 View commit details
    Browse the repository at this point in the history
  26. Fix package object printing

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    e3a24d3 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    e9dd68e View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    a4950d0 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    be77747 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    560d608 View commit details
    Browse the repository at this point in the history
  31. Allow toplevel opaque types

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    f9aff3e View commit details
    Browse the repository at this point in the history
  32. Update docs

    and fix test comment
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    280744e View commit details
    Browse the repository at this point in the history
  33. Be more careful where we fill in missing companion objects

     - There might be several overloaded variants
     - There might be members with the same name that are not modules.
       These should be left alone.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    444cffa View commit details
    Browse the repository at this point in the history
  34. Generalize member computation for package members

    Previously, package-object local definitions won over global
    ones. It's more systematic to form the union of both.
    
    Also, absent dummy modules or classes have to be ignored in order
    not to poison the union.
    
    These changes would have made sense also for old-style package objects, btw.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    e946936 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    67bcab2 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    1cb7cb1 View commit details
    Browse the repository at this point in the history
  37. Update docs

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    205972c View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    44877bd View commit details
    Browse the repository at this point in the history
  39. Make toplevel privates package private

    This is the only way that avoids tricky special cases.
    
    Also: Fix desugaring of toplevel definitions so that imports are
    visible in wrapper objects.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    8278568 View commit details
    Browse the repository at this point in the history
  40. Change scheme to widen toplevel private

    Doing it while desugaring does not always work since definitions
    might already have been indexed before desugaring happens, in which
    case the symbol gets duplicated. We do the widening in Namer instead.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    572471f View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    a789cdd View commit details
    Browse the repository at this point in the history
  42. Revert scala#3735: Allow accesses to private package members from nested

    Test case is i3339. In
    ```
    package outer {
      private class A() {
        override def toString = "A"
      }
    
      package inner {
        object Test {
          def main(args: Array[String]): Unit = {
            println(new A()) // allow access?
          }
        }
      }
    }
    ```
    should the access to private class `A` from a nested package be allowed?
    The usual rules for Scala say yes, since the access is from a nested scope.
    We changed this to in scala#3735 to "no", since we wanted to emulate Java's default
    package-private visibility. But this is unsystematic for two reasons:
    
     - it breaks the universal meaning of `private` in Scala
     - it uses a different name (i.e. private) for what is not named
       in Java at all, and is named `internal` in Kotlin.
     - it does not generalize to members of classes which could
       also profit from a Java-package-private visibility specifier.
    
    I believe it is better to leave `private` as it is, and, if we want to
    emulate `internal` (which might be a good idea), introduce a new modifier
    for it.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    e81f52d View commit details
    Browse the repository at this point in the history
  43. Fix test check file

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    7b018de View commit details
    Browse the repository at this point in the history
  44. Tweak to prefix printing

    Don't leave out package prefixes under homogenizedView. We want to see
    them to make sure they are inserted in the same way before and after pickling.
    
    This discovered a problem in unpickler where package object prefixes were not
    correctly inserted back. Test case is pickleAlias.scala.
    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    4ce52d0 View commit details
    Browse the repository at this point in the history
  45. Try with a final modifier

    odersky committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    d874964 View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2019

  1. Address review comments

    Change scheme how sourcenames are computed from filenames to account for filenames
    that have additional `.`s in them. Fix comments.
    odersky committed Feb 2, 2019
    Configuration menu
    Copy the full SHA
    ed5304e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    db36559 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    537f80d View commit details
    Browse the repository at this point in the history