Commits on Oct 9, 2013
  1. Simplify logic regarding missing parameter types

    When we're typing the result of eta-expansion and fail
    because of missing parameter types, we try again.
    Whether we're in that case doesn't change between arguments,
    so hoist that out of the loop.
    Eventually, we should get rid of the retry and just immediately
    type check the un-eta-expanded method call -- if possible...
    committed Oct 9, 2013
  2. Remove stray debug comment

    committed Oct 9, 2013
  3. Single Abstract Method support: java8 test

    Inspired by test/files/run/t7398.scala and sammy_poly.
    Added some notes to original tests.
    Elaborating on that note: we don't yet desugar `f(a)` to `f.sam(a)`,
    like we do for regular functions: `f(a)` becomes `f.apply(a)`.
    It seems pleasingly symmetrical and is easy to implement,
    but not sure it's a good idea...
    committed Oct 9, 2013
  4. Extract SerialVersionUIDAnnotation. Make SAM body synthetic.

    Addressing review feedback.
    committed Oct 7, 2013
Commits on Oct 8, 2013
  1. Don't pursue SAM translation after an arity mismatch.

    Before this change:
        scala> trait T { def apply(a: Int): Int }
        defined trait T
        scala> ((x: Int, y: Int) => 0): T
        <console>:9: error: object creation impossible, since method apply in trait T of type (a: Int)Int is not defined
                      ((x: Int, y: Int) => 0): T
    After the change, these cases report the same errors as they do
    *without* -Xexperimental.
    retronym committed Oct 8, 2013
Commits on Oct 4, 2013
  1. Single Abstract Method support: synthesize SAMs

    Under `-Xexperimental`, `typedFunction` invokes `synthesizeSAMFunction`
    when the expected type for the function literal (`pt`) is not the built-in
    `FunctionN` type of the expected arity, but `pt` does have a SAM
    with the expected number of arguments.
    PS: We'll require `import language.sam` instead of `-Xexperimental`,
    as soon as the SIP is ready and there are more tests.
    committed Oct 4, 2013
  2. Single Abstract Method support: synthesis helpers

    `synthesizeSAMFunction` will be used to expand the following tree:
    { (p1: T1, ..., pN: TN) => body } : S
     def apply$body(p1: T1, ..., pN: TN): T = body
     new S { def apply(p1: T1, ..., pN: TN): T = apply$body(p1,..., pN) }
    The expansion assumes `S` (the expected type) defines a single abstract method
    (let's call that method `apply` for simplicity).
    1. If 'T' is not fully defined, it is inferred by type checking
    `def apply$body` without a result type before type checking the block.
    The method's inferred result type is used instead of T`.
    [See test/files/pos/sammy_poly.scala]
    2. To more easily enforce S's members are not in scope in `body`, that tree
    goes to the `apply$body` method that's outside the anonymous subclass of S.
    (The separate `apply$body` method simplifies the implementation of 1&2.)
    3. The following restrictions apply to S:
      1. Its primary constructor (if any) must be public, no-args, not overloaded.
      2. S must have exactly one abstract member, its SAM
      3. SAM must take exactly one argument list
      4. SAM must be monomorphic
    We may later relax these requirements to allow an implicit argument list,
    both on the constructor and the SAM. Could also let the SAM be polymorphic.
    committed Oct 4, 2013
  3. Clarify findMembers, add reverse engineered docs

    When looking for deferred members, it only makes sense
    to retry when deferred members aren't excluded.
    committed Oct 4, 2013
Commits on Oct 3, 2013
  1. Merge pull request #3005 from paulp/pr/7886

    SI-7886 unsoundness in pattern matcher.
    paulp committed Oct 3, 2013
  2. Merge pull request #3015 from sschaef/eclipse-update

    Correct build command for scala-ide
    committed Oct 3, 2013
  3. Merge pull request #3013 from retronym/topic/unspec-fix-windows

    Rework cff8b56 to heal the windows build.
    committed Oct 3, 2013
  4. Merge pull request #2973 from sschaef/eclipse-update3

    Update of Eclipse project files
    committed Oct 3, 2013
  5. Rework cff8b56 to heal the windows build.

     - change newTermName to fix negative length names
       rather than reject them
     - restore the old logic in unspecializedName for names that
       result from AnyRef specialized type parameters.
    Why does fix the windows build? I remain none the wiser.
    retronym committed Oct 3, 2013
  6. Merge pull request #2965 from retronym/ticket/7859

    SI-7859 Value classes may wrap a non-public member
    gkossakowski committed Oct 3, 2013
  7. Merge pull request #2994 from xeno-by/topic/bundles

    assorted fixes for bundles
    retronym committed Oct 3, 2013
  8. Merge pull request #2977 from sjrd/topic/remove-classpath-logic-depen…

    Don't avoid to load trait impl .class without inliner.
    retronym committed Oct 3, 2013
Commits on Oct 2, 2013
  1. macro bundles are now usable in repl

    One of the previous commits relaxed the top-level restriction for bundles,
    turning it into a requirement of staticness (i.e. bundles nested in static
    objects are also okay now).
    This means that we can now define bundles in repl. Almost.
    There's still a little problem remaining that arises from the fact that
    when compiling a line of input, repl doesn't automatically import all
    previously defined symbols, but rather uses an heuristic to scan the
    input and guess what symbols need to be imported.
    Unfortunately for bundles, this heuristic fails, because when scanning
    a macro definition that looks like `def foo = macro`, it thinks
    that it's only necessary to import a term symbol called Macros (a vanilla
    way of defining macro impls), but not a type symbol called Macros (a new
    way of writing macro impls in bundles).
    This commit fixes the problem by making the repl look for both term and
    type symbols corresponding to the identifiers used in macro definitions.
    xeno-by committed Oct 2, 2013
  2. gets rid of randomness in virtual filenames for bundles

    Bundles are emitted in compilation units that wrap virtual source files.
    Previously we had those virtual files named randomly to ensure freshness,
    but that led to infinite compilation loops in SBT (see the commit message
    for more details and a link to a scala-user discussion).
    Now the names are generated deterministically from full names of bundles,
    which fixes the problems with SBT.
    xeno-by committed Oct 2, 2013
  3. clearly establishes what macro bundles are

    Previously it was enough to just extend scala.reflect.macros.Macro, which
    created some loopholes, but now scalac enforces that bundles:
      1) Are static (not necessarily top-level, but just static)
      2) Are traits (objects shouldn't be bundles anyway, and classes bring
         complications with their ctors which require special treatment in
         generated classes, so why support them if they don't bring anything
         new to the table?)
      3) Are monomorphic (again, this brings unnecessary complications wrt
         auxiliary code generation, so I don't see merit in supporting
         polymorphic bundles, whatever that a polymorphic bundle could mean)
      4) Don't provide concrete implementation for Macro.c (if they do then
         what is the point?)
    xeno-by committed Oct 2, 2013
  4. Merge pull request #3004 from paulp/pr/remove-unused

    Remove unused code.
    paulp committed Oct 2, 2013
  5. Removing unused code.

    Most of this was revealed via -Xlint with a flag which assumes
    closed world. I can't see how to check the assumes-closed-world
    code in without it being an ordeal. I'll leave it in a branch in
    case anyone wants to finish the long slog to the merge.
    paulp committed Sep 27, 2013
  6. Remove 'hasDefaultFlag'.

    This is the change which broke the compiler until I made the
    changes found in 693ecff.
    paulp committed Sep 27, 2013
  7. SI-6680 unsoundness in gadt typing.

    Introduces -Xstrict-inference to deal with the significant
    gap between soundness and what presently compiles. I'm hopeful
    that it's TOO strict, because it finds e.g. 75 errors compiling
    immutable/IntMap.scala, but it might be that bad.
    paulp committed Oct 2, 2013
  8. SI-7886 unsoundness in pattern matcher.

    I tracked down what was behind the issue described here:
      // TODO: fix the illegal type bound in pos/t602 -- type inference
      // messes up before we get here:
      /*override def equals(x$1: Any): Boolean = ...
             // Span[Any] --> Any is not a legal type argument for Span!
             val o5: Option[[Any]] =
    ...which led straight to the unsoundness seen in neg/t7886.
    It is dangerous to have an expected type of "Any" because
    the type system will blithely ignore kind errors, since "Any"
    can absorb anything. The consequence in this instance was
    that inferring the case constructor for a type like
      Foo[T <: Bound]
    if done with expected type Any, this would come up with Foo[Any].
    I altered it to use expected type Foo[T], which lets the dummy
    type parameter survive to carry the bound forward and restores
    sense to the inference. The before/after output for -Xprint:patmat
    on pos/t602.scala is:
    <         if (x1.isInstanceOf[[Any]])
    >         if (x1.isInstanceOf[[K]])
    <             <synthetic> val x2:[Any] = \
    >             <synthetic> val x2:[K] = \
    <               val low$0: Option[Any] = x2.low;
    <               val high$0: Option[Any] = x2.high;
    >               val low$0: Option[K] = x2.low;
    >               val high$0: Option[K] = x2.high;
    A file in the library depended (needlessly) on the unsoundness.
    It was easy to fix but reminds us this may affect existing code.
    paulp committed Sep 30, 2013
Commits on Oct 1, 2013
  1. Merge pull request #3003 from paulp/pr/position-catchup

    Updating Position call sites.
    paulp committed Oct 1, 2013
Commits on Sep 30, 2013
  1. Merge pull request #2991 from xeno-by/topic/unapply-copier

    transformers no longer ignore
    xeno-by committed Sep 30, 2013
Commits on Sep 29, 2013
  1. SI-7859 Value classes may wrap a non-public member

    We allow value class constructors to be non-public, so to be regular,
    we should also allow the same for the param accessor.
    This commit uses the 'makeNotPrivate' machinery to ensure that
    the backend can generate the requisite unboxing calls.
    This commit:
      - refactors the code that enforced the restrictions, improving
        a few error messages and positions. The remaining restrictions
        needed some rewording in light of this change.
      - allows value classes to have non-public, val parameters.
        private[this] / protected[this] are still disallowed as value
        classes don't have a concept of `this`, and because trying to
        accomdate then would complicate the implementation.
        This means that `class C(x: Int) extends AnyVal` is not allowed,
        the user still must write `private val x: Int` or `val x: Int`.
      - Outlaw `class C()()(val x: Int) extends AnyVal` to curtail any
        bugs that might lurk in such a formulation.
    The tests:
      - Show that the privacy is respected in the typer phase, under
        joint and separate compilation. We don't want a repeat performance
        of SI-6601.
      - Show that code that needs compiler-generated unboxes works under
        both compilation scenarios
      - Checks that the remaining restrictions are enforced and well
    retronym committed Sep 19, 2013
Commits on Sep 28, 2013
  1. Merge pull request #3000 from paulp/pr/xlint

    Some refinement of -Xlint interpolation warning.
    paulp committed Sep 28, 2013
Commits on Sep 27, 2013
  1. Updating Position call sites.

    Calling position factories rather than instantiating these
    particular classes. Not calling deprecated methods. Added a few
    position combinator methods.
    paulp committed Sep 27, 2013
  2. Some refinement of -Xlint interpolation warning.

    I had covered a few more cases working on this recently.
    The warnings in several more cases involving polymorphism,
    currying, and selects vs. idents receive more refined
    paulp committed Sep 27, 2013
  3. Merge pull request #2909 from soc/SI-7629-deprecate-view-bounds

    SI-7629 Deprecate view bounds
    retronym committed Sep 27, 2013
  4. Merge pull request #2992 from retronym/ticket/7877

     Only look for unapplies in term trees
    retronym committed Sep 27, 2013
  5. Merge pull request #2978 from som-snytt/issue/7848-forgotten-interp-m…

    SI-7848 Xlint no warn on $sym with params
    paulp committed Sep 27, 2013