SI-7969 REPL -C columnar output

Let `ConsoleReaderHelper.printColumns` print in a vertical
orientation (similar to `ls -C`) instead of horizontally (`ls -x`).

To support the old behavior, add a property `-Dscala.repl.format=across`
where "across" is the presumptive mnemonic for `-x`.

The format property also takes value `paged` to turn on pagination,
which currently forces single-column output (as does `ls | more`)
for simplicity.
SI-7969 Refactor to trait with test

Make REPL classes testable in junit. Test the Tabulator.
Tidy up the Uncurry component of delambdafy

 - Use tree factories that accept symbols and encapsulate ValDef
   creation
 - Use `gen.mkForwarder` to handle the conditional addition of
   `: _*` for varargs functions. We don't need to predicate this
   on `etaExpandKeepsStar`; the only place that need to do that
   is EtaExpansion.
SI-7969 REPL variable columnar output

Extend column formatting to make columns only as wide as
their widest element.  This is similar to what `ls` does.

Given the longest and shortest string, which bound the
min and max column count, compute the layout for those
possible column counts, and choose the minimal row count
and minimal column count.

The junit test is under pending because it uses expecty.
(Edit: updated without expectytations.)

Example that really benefits, witness the skinny columns:

```
scala> math.

BigDecimal                     PartiallyOrdered             cosh      rint
BigInt                         Pi                           exp       round
E                              ScalaNumber                  expm1     signum
Equiv                          ScalaNumericAnyConversions   floor     sin
Fractional                     ScalaNumericConversions      hypot     sinh
IEEEremainder                  abs                          log       sqrt
Integral                       acos                         log10     tan
LowPriorityEquiv               asin                         log1p     tanh
LowPriorityOrderingImplicits   atan                         max       toDegrees
Numeric                        atan2                        min       toRadians
Ordered                        cbrt                         package   ulp
Ordering                       ceil                         pow
PartialOrdering                cos                          random

```

more
SI-7915 Corrected range positions created during default args expansion

The tree created during expansion of default arguments contained trees with the
wrong type of positions. Let's discuss this with an example. Below is the tree
generated for the `foo` method in the test class included in this commit.

Before this commit:

```
[54:94]def foo(): [58]Unit = <70:90>{
  [70:79]<artifact> val qual$1: [70]Bar = [70:79][70:79][70:79]new [74:77]Bar();
  [80]<artifact> val x$1: [80]Int = [80]qual$1.bar$default$1;
  <70:90><70:83>qual$1.bar([80]x$1)
}
```

Now:

```
[54:99]def foo(): [58]Unit = <70:95>{
  <70:84><artifact> val qual$1: [70]Bar = [70:84][70:84][70:84]new [74:77]Bar();
  [85]<artifact> val x$1: [85]Int = [85]qual$1.bar$default$1;
  <70:95>[84:88]qual$1.bar([85]x$1)
}
```

Here are the list of changes:

* The synthetic `qual$1` has a transparent position, instead of a range position.
* The new Select tree (i.e., `qual$1.bar`) should always have a range position,
  because `selected` (i.e., the called method) is always visible in the source
  (in fact, this is the whole point of the fix, we need a range position or
  hyperlinking request from the Scala IDE won't work).
* The Block that contains the expanded default arguments is forced to have a
  transparent position, as it never exist in the original source.

The tricky part of the fix is the position assigned to the new Select tree,
which needs to respect the range position's invariants. In the specific case,
we ought to make sure that range positions don't overlap. Therefore, the position
assigned to the new Select tree is computed by intersecting the original Select
position (i.e., `baseFun`'s position) and the original qualifier's position
(i.e., `qual`'s position).

If you take a closer look at the range positions assigned in the tree after this
commit, you'll notice that the range position of the `qual$1`'s rhs (i.e.,
[70:84]), and `qual$1.bar` (i.e., [84:88]) might seem to overlap, because the
former ends where the latter begins. However, this not the case because of the
range position's invariant 2, which states:

> Invariant 2: in a range position,  start <= point <  end

Hence, the above two positions aren't overlapping as far as the compiler is
concerned.

One additional aspect (that may look like a detail) is that we make sure to
never generate a position such that its start is after its end. This is why we
take the position with the smallest end point.

Furthermore, calling `withStart` would turn any position in a range position,
which isn't desiderable in general (and, even worse, this can lead to
generation of invalid positions - bad offsets - if the computation is performed
on offset positions). Hence, the position's computation is only performed when
both `baseFun` and `qual` positions are range positions. Indeed, I expect this to
be always the case if the compiler is started with -Yrangepos.

(cherry picked from commit 3009a525b58a4c7865ff524899b85518884ee5f7)
[nomaster] Test infrastructure for scope completion

Adds a new marker /*_*/ to trigger scope completion test.
Original type completion test oracles update for the tweaked output
(cherry picked from commit 9c7c66ff7907e3ab814f0f4375eeaf6cdd230d5e)
[nomaster] Adds test cases for scope completion

(cherry picked from commit 3d55fe723f1af91f4d2db421f0e0965c583346dc)
[nomaster] SI-7280 Scope completion not returning members provided by imports

Updates localeContext() to return the best context possible when there are none directly
associated with the given position. It happens when an expression cannot be
successfully typed, as no precise ContextTree covers the expression location, or if the
position is not inside any expression.
Adds corresponding tests
(cherry picked from commit 3028327e2a2b553b12ee45519413515c8aa0865f)
Merge pull request #3157 from dotta/backport/2.10.x/si-7915

Backport of SI-7915
Merge pull request #3166 from skyluc/issue/completion-import-object-7280-210

Backport of
SI-7967 Account for type aliases in self-type checks

These eluded the check for "illegal inheritance; self-type does not
conform" as AliasTypeRef doesn't forward `typeOfThis`.

This commit dealiases before calling `typeOfThis`. That seems to be
the most localised change.

Without the dealias, we had:

    parent.tpe            = TypeRef(pre, sym = AliasTypeSymbol("CC"), Nil)
    parent.tpe.typeOfThis = parent.tpe.transform(sym.typeOfThis) = CC

After:

    parent.tpe.dealias            = TypeRef(pre, sym = ClassSymbol("C"), Nil)
    parent.tpe.dealias.typeOfThis = C with B
[nomaster] teaches toolbox about -Yrangepos

Unlike in master, in 2.10.x enabling -Yrangepos requires instantiating
Global with mixed in RangePositions trait.

Same story for toolboxes. Just setting Yrangepos is not enough - one
needs to mix in RangePositions into ToolboxGlobal. I didn’t know that
back then, so now I’m fixing the oversight.

The commit is marked as [nomaster], because -Yrangepos doesn’t need
special treatment in master.
Test in quick mode for ant build

Add a target `test.suite.quick`.

Let test.quick depend only on init and quick.done,
and load the task using the quick path (with non-core deps).
SI-7872 Plug a variance exploit in refinement types

Refinement types are collapsed to a TypeTree with an original
during type checking; this was enough to evade variance validation
in refchecks.

This commit:

  - validates the original of `TypeTree`s in refchecks
  - changes VarianceValidator to recurse into:
    - the originals of `TypeTree`s
    - `TypTree` (to cover, e.g. `CompoundTypeTree` / `SelectFromTypeTree`)

It also finds an unreported variance violation in an existing
test case, variances.scala. This looks to be legitimate.
Symbol substutition must consider ClassInfoType#parents

An upcoming change to uncurry, in which I plan to make substitution of
`lambda params -> apply method params` requires that I first to fix a
problem in symbol substition.

This situation can arise when the body of this definition:

    def owner1(a: A) = {
        class C extends M[a.B]
    }

is transplanted into a new owner that has a different symbol for `a`.

I speculated that value classes might also be prone to the
fact that symbol substitution neglected `ClassInfoType#parents`.

We can test change with Value Classes:  Partial Functions that are
dependent on value class param type used to fail with a spurious
overriding error, now they work correctly.
Substitute new parameter symbols into lambda body

Previously, new synthetic parameter symbols were created for the
apply method parameters, but only used in its `MethodType`. The
`ValDef` trees of the function, along with their symbols, were
used directly as the parameter trees of the apply method.

    % cat sandbox/test.scala
    object Test {
      (x: Int) => {
        (y: Int) => ???
      }
    }

    % scalac-hash v2.10.3 -Xprint:typer,uncurry -uniqid ../scala2/sandbox/test.scala  | egrep 'syntax|\bx'
    [info] v2.10.3 => /Users/jason/usr/scala-v2.10.3-0-g88b5d19
    [[syntax trees at end of                     typer]] // test.scala
        ((x#12152: Int#351) => x#12152)#12151
    [[syntax trees at end of                   uncurry]] // test.scala
            final def apply#15952(x#12152: Int#351): Int#351 = x#12152

This approach dates back a long way: c64152bc3. @odersky tells me it
was most likely due to insufficent substitution/cloning machinery
at the time.

    % qbin/scalac -Xprint:typer,uncurry -uniqid ../scala2/sandbox/test.scala  | egrep 'syntax|\bx'
    [[syntax trees at end of                     typer]] // test.scala
        ((x#13685: Int#1760) => x#13685)#13671
    [[syntax trees at end of                   uncurry]] // test.scala
            final def apply#13959(x#13960: Int#1760): Int#1760 = x#13960

To make this work, I had to fix a problem in symbol substition; this
was commited in the previous commit. In the enclosed test, at Uncurry,
the symbol of the nested class `N` had a `ClassInfoType`, which listed
as a parent `M[a.C]`. When we substituted the new method parameter
symbol `a` for the eponymous function parameter symbol, this was not
touched.
Refactor away duplication between -Ydelambdafy:{inline,method}
Special treatment for local symbols in TypeTreeMemberType

Avoids calling `thisType` on the owner if it is a term symbol,
which doesn't make much sense.

This method is used internally in tree factory methods that
create, e.g, a `DefDef` based on the info of a `Symbol`.
SI-8001 spurious "pure expression does nothing" warning

`isPureExprForWarningPurposes` doesn’t warn on `()`, but `(): Unit`
leaves it confused. This patch fixes the problem.

The fix is important in the context of the recent split between blackbox
and whitebox macros. Macro engines wrap expansions of blackbox macros
in type ascriptions, so a macro that expands into `()` would actually
produce `(): Unit`, which would trigger a spurious warning. Thanks
@milessabin for spotting this problem!
SI-8002 private access for local companions

We go through similar gymnastics to make companion implicits
work for local class/object pairings, so we ought to be consistent
when it comes to access