Permalink
Commits on Feb 26, 2017
  1. Add partest paths to the list of watched sources.

    paulp committed Feb 26, 2017
    This allows running partest continuously (e.g. ~partest a/b/test)
    with it triggering on changes to the test source.
Commits on Mar 12, 2014
  1. SI-8265 Restore 2.10 variance behavior under -Xsource:2.10

    paulp committed Mar 12, 2014
    Issue deprecation warning under -Xsource:2.10 so time
    travelers can have an authentic deprecation experience before
    finding that their unsound code no longer compiles in 2.11.
    The relevant ticket to the soundness issue is SI-6566.
Commits on Feb 13, 2014
  1. SI-8280 regression in implicit selection.

    paulp committed Feb 13, 2014
    In 2fa2db7 I fixed a bug where applicable implicit conversions
    would not be found for numeric types if one introduced any aliasing
    or singleton types, for the usual reasons involving the absence of
    uniform type normalization. See pos/t7228 for examples - that test
    case has 20 errors in 2.10.3 but compiles in master.
    
    An unintended side effect was making implicit search less oblivious.
    It turns out that in so doing I had created ambiguity where there was
    none before. Not because it was any more ambiguous, but because the
    compiler now had the wits to notice the ambiguity at an earlier time.
    
    The fix for this is not intuitive. The way the internal logic is,
    we need to keep the wool over implicit search's eyes, which leads
    to those unrecognized types being passed to adapt, where they are
    recognized and weak subtyping suffices to be more specific. It is
    sufficient for SI-7228 that weak subtyping be done correctly - the
    other change, which is reverted here, was exposing the type arguments
    of Function1 when a view exists as a subtype of Function1.
    
    It is also possible this could be remedied by calling weak_<:<
    somewhere which is presently <:<, but I don't know where and it
    has a far greater chance of affecting something else than does
    this, which is a straight reversion of a post-2.10.3 change.
Commits on Feb 11, 2014
  1. Add a great test case.

    paulp committed Feb 11, 2014
    Created to convince moors that certain code should compile, it
    wound up flushing out some quite nutty behavior. Some day this
    will compile rather than having an 11-failure checkfile.
Commits on Feb 6, 2014
  1. SI-6948 Make the Abstract* classes public.

    paulp committed Feb 6, 2014
    Several weaknesses in the implementation converge and force multiply.
    
    1) Type constructor inference is not persistent. During implicit search
    it will give up after the first seen parent even if some deeper base type
    (even another direct parent) would satisfy the search.
    
    2) Type inference is not aware of access restrictions. Inferred types are
    calculated with disregard for whether the inferred type is visible at
    the point of inference. That means that package-private types - which may be
    private for any number of good reasons, such as not wanting them to appear in
    bytecode thus creating binary compatibility obligations - are not private.
    There is no such thing as a qualified private type.
    
      package p {
        trait PublicInterface[T] { def foo(): Int }
        private[p] trait ImplementationOnly[T] extends PublicInterface[T] { def foo(): Int = 1 }
        class PublicClass extends ImplementationOnly[PublicClass]
      }
      package q {
        object Test {
          def f[A, CC[X]](xs: CC[A]): CC[A] = xs
          def g = f(new p.PublicClass) // inferred type: p.ImplementationOnly[p.PublicClass]
          def h = g.foo()
          // Bytecode contains:
          // public p.ImplementationOnly<p.PublicClass> g();
          // public int h();
          //    0: aload_0
          //    1: invokevirtual #30                 // Method g:()Lp/ImplementationOnly;
          //    4: invokeinterface #33,  1           // InterfaceMethod p/ImplementationOnly.foo:()I
          //    9: ireturn
        }
      }
    
    3) The trait encoding leads to a proliferation of forwarder methods, so much so that
    1.5 Mb of bytecode was taken off of the standard library size by creating abstract classes
    which act as central mixin points so that leaf classes can inherit some methods the
    old fashioned way rather than each receiving their own copy of every trait defined method.
    This was done for 2.10 through the creation of the Abstract* classes, all of which were
    given reduced visibility to keep them out of the API.
    
      private[collection] class AbstractSeq extends ...
    
    This achieved its intended goal very nicely, but also some unintended ones.
    
    In combination with 1) above:
    
      scala> val rand = new scala.util.Random()
      rand: scala.util.Random = scala.util.Random@7f85a53b
    
      // this works
      scala> rand.shuffle(0 to 5)
      res1: scala.collection.immutable.IndexedSeq[Int] = Vector(4, 0, 1, 2, 5, 3)
    
      // and this doesn't! good luck reasoning that one out
      scala> rand.shuffle(0 until 5)
      <console>:9: error: Cannot construct a collection of type scala.collection.AbstractSeq[Int]
        with elements of type Int based on a collection of type scala.collection.AbstractSeq[Int].
                    rand.shuffle(0 until 5)
                                ^
    
      // Somewhat comically, in scala 2.9 it was flipped: to failed (differently), until worked.
      scala> scala.util.Random.shuffle(0 to 5)
      <console>:8: error: type mismatch;
       found   : scala.collection.immutable.Range.Inclusive
       required: ?CC[?T]
    
      scala> scala.util.Random.shuffle(0 until 5)
      res2: scala.collection.immutable.IndexedSeq[Int] = Vector(4, 3, 1, 2, 0)
    
    In combination with 2) above:
    
      scala> def f[A, CC[X]](xs: CC[A]): CC[A] = xs
      f: [A, CC[X]](xs: CC[A])CC[A]
    
      scala> var x = f(1 until 10)
      x: scala.collection.AbstractSeq[Int] = Range(1, 2, 3, 4, 5, 6, 7, 8, 9)
    
      // It has inferred a type for our value which it will not allow us to use or even to reference.
      scala> var y: scala.collection.AbstractSeq[Int] = x
      <console>:10: error: class AbstractSeq in package collection cannot be accessed in package collection
             var y: scala.collection.AbstractSeq[Int] = x
                                     ^
      // This one is a straight regression - in scala 2.9,
      scala> var x = f(1 until 10)
      x: scala.collection.immutable.IndexedSeq[Int] = Range(1, 2, 3, 4, 5, 6, 7, 8, 9)
    
    Since 1) and 2) are essentially unfixable - at least by me - I propose
    to ameliorate these regressions by attacking the symptoms at the leaves.
    That means making all the Abstract* classes public - keeping in mind that
    they must already be assumed to be in the binary compatibility footprint,
    since they have been leaking throughout their existence. This only impacts
    the inference of inaccessible collections types - it doesn't help with the
    more serious issue with type inference.
Commits on Jan 26, 2014
  1. Fix misuse of underscores.

    paulp committed Jan 26, 2014
    It's a language bug, but M[_] <: Foo[_] does not mean what
    anyone who writes it believes that it means. You have to give
    the type parameter a name, like M[X] <: Foo[X].
Commits on Jan 9, 2014
  1. Fix infinite recursion in name-based patmat.

    paulp committed Jan 9, 2014
    I discovered on erroneous code it could fall into a loop looking
    for product selectors, because ErrorType always claims to have
    whatever member you're asking about.
  2. Merge pull request #13 from retronym/ticket/8128

    paulp committed Jan 9, 2014
    SI-8128 Fix regression in extractors returning existentials
Commits on Dec 31, 2013
Commits on Dec 27, 2013
  1. Added .ant-targets-build.xml to .gitignore.

    paulp committed Dec 27, 2013
    Something generates this repo-dirtying file during ant replacestarr.
Commits on Dec 23, 2013
  1. SI-8045 type inference of extracted value

    paulp committed Dec 23, 2013
    Test case for SI-8045, fixed by the preceding commits.
Commits on Dec 21, 2013
  1. SI-7406 crasher with specialized lazy val

    paulp committed Dec 21, 2013
    This reverts a tiny bit of f7d5f45 where the crasher was
    introduced. The enclosed test case compiles and runs under 2.9,
    but prints the wrong answer. It crashes in 2.10 and until this
    patch. Now it compiles and prints the right answer.
Commits on Dec 17, 2013
  1. Dotless type application for infix operators.

    paulp committed Dec 17, 2013
    When you have an aesthetic expresion like
    
      def f(xs: Iterator[Int]) = (
        xs takeWhile (_ < 1000)
                 map (_ * -1)
              filter (_ % 2 == 0)
             flatMap (x => List(x, x))
        reduceOption (_ + _)
               maxBy (_.toString)
      )
    
    And then for whatever reason you have to perform explicit
    type application in the midst of that expression, it's
    aggravating in the extreme that it has (had) to be rewritten
    in its entirety to accommodate that change.
    
    So now you can perform type application in the middle of it.
    
    For reasons not entirely clear to me postfix operators are
    excluded. The discussion as well as the approval for the infix
    variation of it can be found at:
      https://groups.google.com/forum/#!msg/scala-language/eJl1wnkEz9M/hR984-lqC5EJ
Commits on Dec 16, 2013
  1. SI-7850 CCE in patmat with invalid isEmpty.

    paulp committed Dec 16, 2013
    Name-based pattern matcher needed some hardening against
    unapply methods with the right name but wrong types. Only
    isEmpty methods which return Boolean are acceptable.
    Catching it directly rather than indirectly also allowed
    for better error messages.
  2. SI-7897, SI-6675 improves name-based patmat

    paulp committed Dec 16, 2013
    This emerges from a recent attempt to eliminate pattern matcher
    related duplication and to bake the scalac-independent logic
    out of it. I had in mind something a lot cleaner, but it was
    a whole lot of work to get it here and I can take it no further.
    
    Key file to admire is PatternExpander.scala, which should
    provide a basis for some separation of concerns.
    
    The bugs addressed are a CCE involving Tuple1 and an imprecise
    warning regarding multiple pattern crushing.
    
    Editorial: auto-tupling unapply results was a terrible idea which
    should never have escaped from the crib. It is tantamount to
    purposely throwing type safety down the toilet in the very place
    where people need type safety the most. See SI-6111 and SI-6675 for
    some other comments.
Commits on Dec 15, 2013
  1. Improvements to partest-ack, plus partest-paths.

    paulp committed Dec 15, 2013
    I noticed partest-ack was not finding all matching tests, and
    fixed that. Also cleaned up the ack options so they're understood
    by the latest version of ack.
    
    Along the way I broke the canonicalization functionality out into its
    own script so it can easily be used from other places.
Commits on Nov 18, 2013
  1. Removing deprecated code.

    paulp committed Nov 18, 2013
    Code which has been deprecated since 2.10.0 and which allowed
    for straightforward removal.
Commits on Nov 10, 2013
  1. [backport] Add buildcharacter.properties to .gitignore.

    paulp authored and retronym committed Nov 10, 2013
    (cherry picked from commit 693e55e)
Commits on Nov 8, 2013
  1. Rewrites the parser stack reduction logic.

    paulp authored and som-snytt committed Oct 13, 2013
    Centralizes the scattered logic surrounding erroneous
    pattern syntax. Consolidates the redundant lookahead
    implementations. Eliminates var manipulation in favor
    of recursion.
  2. A value class for Precedence.

    paulp authored and som-snytt committed Oct 13, 2013
    One fewer Int to be whizzing around the parser hoping to
    be confused with other Ints.
Commits on Nov 5, 2013
  1. SI-6546 InnerClasses attribute refers to absent class

    paulp committed Nov 5, 2013
    At issue is that the optimizer would eliminate closure classes
    completely, then neglect to eliminate those classes from the
    container's InnerClasses attribute. This breaks tooling which
    expects those entries to correspond to real classes.
    
    The code change is essentially mgarcia's - I minimized it and
    put the caches in perRunCaches, and added the test case which
    verifies that after being compiled under -optimise, there are
    no inner classes. Before/after:
    
      7,8d6
      <   InnerClasses:
      <        public final #22; //class A_1$$anonfun$f$1
      37,45c35,40
      <   #21 = Utf8               A_1$$anonfun$f$1
      <   #22 = Class              #21            //  A_1$$anonfun$f$1
      <   #23 = Utf8               Code
      ---
      >   #21 = Utf8               Code
Commits on Oct 13, 2013
  1. Merge pull request #3036 from paulp/pr/aesthetics

    paulp committed Oct 13, 2013
    Improvement in code aesthetics.
  2. Aesthetics in Trees.

    paulp committed Oct 13, 2013
    As long as it's a block of pure boilerplate we have to
    navigate around all the time, it may as well be the most
    beautiful boilerplate it knows how to be.
  3. Aesthetics in GenTrees.

    paulp committed Oct 13, 2013
    A nominee for "worst textual shape" might be
    
      \\\\\
      /////
      \\\\\
      /////
      \\\\\
      /////
    
    where the zigzagging wall of text is confined to the
    first forty columns. In this commit we halve the vertical
    space usage and double the readability.
Commits on Oct 12, 2013
  1. Eliminate redundant pickling code.

    paulp committed Oct 12, 2013
    This commit drops about 700 lines of redundant traversal logic.
    
    There had been ad hoc adjustments to the pickling scheme here and
    there, probably in pursuit of tiny performance improvements.
    For instance, a Block was pickled expr/stats instead of stats/expr,
    a TypeDef was pickled rhs/tparams instead of tparams/rhs.
    The benefits derived are invisible compared to the cost of having
    several hundred lines of tree traversal code duplicated in half a
    dozen or more places.
    
    After making Traverser consistent/complete, it was a straightforward
    matter to use it for pickling. It is ALSO now possible to write a
    vastly cleaner tree printer than the ones presently in trunk, but I
    leave this as an exercise for Dear Reviewer.
  2. Tree traversal: more uniform and granular.

    paulp committed Oct 12, 2013
    There's a huge amount of tree traversal related duplication
    which is hard to eliminate only because trees aren't properly
    traversed. The not-quite-tree bits of key trees are ignored
    during traversals, making it impossible to write e.g. a
    pretty printer without duplicating almost the entire traversal
    logic (as indeed is done for printing purposes in more than one
    place.) And almost the entire pickler logic is redundant with
    Traverser, except since it's all duplicated of course it diverged.
    The pickler issue is remedied in the commit to follow.
    
    The not-quite-trees not quite being traversed were Modifiers, Name,
    ImportSelector, and Constant. Now every case field of every tree is
    traversed, with classes which aren't trees traversed via the following
    methods, default implementations as shown:
    
      def traverseName(name: Name): Unit                    = ()
      def traverseConstant(c: Constant): Unit               = ()
      def traverseImportSelector(sel: ImportSelector): Unit = ()
      def traverseModifiers(mods: Modifiers): Unit          = traverseAnnotations(mods.annotations)
  3. Mappings between classes and pickler tags.

    paulp committed Oct 12, 2013
    This enables a measure of "command/query separation", which is
    to say: the same method shouldn't go on a side effecting binge
    and also return a value.
  4. Merge pull request #3031 from retronym/topic/skip-doc

    paulp committed Oct 12, 2013
    An ant property to skip building docs
  5. Merge pull request #3032 from retronym/ticket/7239-test

    paulp committed Oct 12, 2013
    SI-7239 A bonus test case from [scala-user]
  6. Merge pull request #3024 from retronym/ticket/7895

    paulp committed Oct 12, 2013
    SI-7895 Error reporting: avoid cascading, truncation
  7. Merge pull request #3025 from retronym/ticket/7902

    paulp committed Oct 12, 2013
    SI-7902 Fix spurious kind error due to an unitialized symbol