SI-7509 Avoid crasher as erronous args flow through NamesDefaults

The fix for SI-7238 caused this regression.

This commit marks taints whole Apply with an ErrorType if it
has an erroneous argument, so as to stop a later crash trying
to further process the tree.
SI-7486 Regressions in implicit search.

Revert e86832d7e8 and dd33e280e2.
Merge pull request #2588 from retronym/ticket/7509

SI-7509 Avoid crasher as erronous args flow through NamesDefaults
Merge pull request #2590 from paulp/issue/7486

SI-7486 Regressions in implicit search.
SI-7516 Revert "SI-7234 Make named args play nice w. depmet types"

This reverts commit 83c9c764b528a7a1c1d39c480d22c8e3a71d5a58.

The tests are shunted to 'pending'.

Why revert this seemingly innocous commit? 83c9c764 generates a ValDef whose
tpt TypeTree has no original; this contains a reference to the symbol for `d`.
resetAttrs and the retypecheck assigns a new symbol for d and leaves a the
reference to the prior symbol dangling. The real bug is the resetAttrs concept.
Merge pull request #2601 from retronym/ticket/7516

SI-7516 Revert "SI-7234 Make named args play nice w. depmet types"
SI-7517 Fix higher kinded type inference regression

 - Discovered in 2.10.2-RC1
 - Ostensibly regressed in 7e52fb910b, which conceptually reverted
   part of 0cde930b so that (mutable) TypeVars don't use structural equality.
 - But, does *not* fail if 7e52fb910b is cherry-picked directly after 0cde930b,
   suggesting that it shone a light on a behaviour change in some other commit
   in between the two.
 - Indeed, the true regression came in https://github.com/scala/scala/commit/e5da30b843#L5L3176
 - A targeted revert of e5da30b843 is undesirable, as we'd like SI-6846 to stay fixed

What's happening here? In the enclosed test case, higher kinded type
inference explores two possibilities:

    Composed.this.Split[A]
    K[[T]A[B[T]]]           // `Split[A]` dealiased

The difference in the flow of type inference can be seen from the diff
below. Notice how now we no longer register `?K.addBound(Composed.this.Split)`,
we instead only register `?K.addBound(K)`

```patch
--- sandbox/old.log 2013-05-30 00:27:34.000000000 +0200
+++ sandbox/new.log 2013-05-30 00:28:28.000000000 +0200
@@ -1,55 +1,114 @@
 ?K.unifyFull(Composed.this.Split[A])
   ?K.unifySpecific(Composed.this.Split[A])
-  ?K.addBound(Composed.this.Split)
     ?B.unifyFull(T)
       ?B.unifySpecific(T)
       `-> false
     ?B.unifyFull(Any)
       ?B.unifySpecific(Any)
       `-> false
   `-> false
   ?K.unifySpecific(L[[T]A[B[T]]])
-  ?K.addBound(L)
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
+  ?K.addBound(L)
   `-> true
 ?K.unifyFull(Composed.this.Split[A])
   ?K.unifySpecific(Composed.this.Split[A])
-  ?K.addBound(Composed.this.Split)
     ?B.unifyFull(x)
       ?B.unifySpecific(x)
       `-> false
   `-> false
   ?K.unifySpecific(L[[T]A[B[T]]])
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
   ?K.addBound(L)
+  `-> true
+?K.unifyFull(Composed.this.Split[A])
+  ?K.unifySpecific(Composed.this.Split[A])
+    ?B.unifyFull(T)
+      ?B.unifySpecific(T)
+      `-> false
+    ?B.unifyFull(Any)
+      ?B.unifySpecific(Any)
+      `-> false
+  `-> false
+  ?K.unifySpecific(L[[T]A[B[T]]])
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
     ?B.unifyFull(B[T])
       ?B.unifySpecific(B[T])
       ?B.addBound(B)
       `-> true
+  ?K.addBound(L)
+  `-> true
+?K.unifyFull(Composed.this.Split[A])
+  ?K.unifySpecific(Composed.this.Split[A])
+    ?B.unifyFull(x)
+      ?B.unifySpecific(x)
+      `-> false
+  `-> false
+  ?K.unifySpecific(L[[T]A[B[T]]])
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+    ?B.unifyFull(B[T])
+      ?B.unifySpecific(B[T])
+      ?B.addBound(B)
+      `-> true
+  ?K.addBound(L)
+  `-> true
+?K.unifyFull(L[A])
+  ?K.unifySpecific(L[A])
+  ?K.addBound(L)
+  `-> true
+?K.unifyFull(L[A])
+  ?K.unifySpecific(L[A])
+  ?K.addBound(L)
   `-> true
```
Merge pull request #2607 from retronym/ticket/7517

SI-7517 Fix higher kinded type inference regression
SI-7532 Fix regression in Java inner classfile reader

395e90a modified the detection of top-level classes in
ClassfileParser in two ways:
  1. used `Name#containsChar` rather than `toString.indexOf ...` (good!)
  2. decoded the name before doing this check (bad!)

That code is actually only run for non-Scala classfiles, whose
names don't need decoding. Attempting to do so converted `R$attr`
to `R@tr`, which no longer contains a '$', and was wrongly treated
as a top level class.

This commit reverts the use of `decodedName`, and inlines the method
to its only call site for clarity.
Merge pull request #2608 from retronym/ticket/7532

SI-7532 Fix regression in Java inner classfile reader
[backport] relax time constraint in duration-tck.scala (for Windows VMs)
(cherry picked from commit 3e0fbc0193f0b6f58dc16dae3824677e9902dc7b)
Removed redundant `retypedMethod` in `Duplicators`

It was never used since its introduction in 3ee6b3653 by @dragos.

Review by @dragos or @axel22 or @paulp.
SI-7343 Fixed phase ordering in specialization

Specialization rewires class parents during info transformation, and
the new info then guides the tree changes. But if a symbol is created
during duplication, which runs after specialization, its info is not
visited and thus the corresponding tree is not specialized.

One manifestation is the following:
```
object Test {

  class Parent[@specialized(Int) T]

  def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = {
     class X extends Parent[T]()
     // even in the specialized variant, the local X class
     // doesn't extend Parent$mcI$sp, since its symbol has
     // been created after specialization and was not seen
     // by specialzation's info transformer.
     ...
  }
}
```
We can fix this by forcing duplication to take place before specialization.

Review by @dragos, @paulp or @axel22.
Add support for JUnit tests

Add `test.junit` ant target that compiles and runs JUnit tests
found in `test/junit` directory.

Add `scala.tools.nsc.SampleTest` that demonstrates working
testing infrastructure.
Add Eclipse project for JUnit tests.
Merge pull request #2656 from gkossakowski/junit

Add JUnit support
Merge pull request #2646 from retronym/topic/duration-relax-2.10.x

[backport] relax time constraint in duration-tck.scala (for Windows VMs)
Merge pull request #2651 from VladUreche/issue/7343-2

SI-7343 Fixed phase ordering in specialization
SI-7571 Allow nesting of anonymous classes in value classes

5d9cde105e added deep prohibition of nested classes within
a value class. This has the undesirable side effect of
prohibiting partial functions literals in method bodies
of a value class.

The intention of that prohibition was to avoid problems
in code using Type Tests, such as:

    class C(val inner: A) extends AnyVal {
      class D
    }
    def foo(a: Any, other: C) = a match { case _ : other.D }

Here, the pattern usually checks that `a.$outer == other`.
But that is incongruent with the way that `other` is erased
to `A`.

However, not all nested classes could lead us into this trap.
This commit slightly relaxes the restriction to allow anonymous
classes, which can't appear in a type test.

The test shows that the translation generates working code.
Cleaning up method implementations in Future
    Optimizations:
    1) Avoiding isDefinedAt + apply and using applyOrElse to allow for optimizations later
    2) Reducing method sizes to be more JIT + inliner friendly
    3) Reusing core combinators to reuse inliner/JIT optimizations and be more code-cache friendly