[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.
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
Refactoring to the scala-concurrent-tck.scala
  - there were numerous logical issues with the former implementation
    - failed assertions may not fail the build
  - there was a lot of ceremony and noise
SI-7603 Speculative fix for annotation binding error

Reports of:

    error: trait Test is abstract; cannot be instantiated
    11:09:50 [ant:scalac] @Test def testClientRequestNum = {
    11:09:50 [ant:scalac] ^

Suggest that the deferred processing of a LazyAnnotationInfo is binding
the identifier `Test` to the wrong symbol. Inspection of the code shows
that the closure also defers capture of the (mutable) field
`Namer#typer.context`.

This commit captures the context eagerly, and adds logging to let us
know if that eagerly captured context ever differs from the its value
at the point when the annotation info is forced.

I spent a few hours trying to craft a test to back this up, but to no
avail. Here's what the log output will look like:

    [log typer] The var `typer.context` in scala.tools.nsc.typechecker.Namers$NormalNamer@1f5ebb08 was mutated before the annotation new a() was forced.

    current value  = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false)
    original value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false)

    This confirms the hypothesis for the cause of SI-7603. If you see this message, please comment on that ticket.
Merge pull request #2511 from viktorklang/wip-cleaner-Future-method-implementations-2.10-√

General SIP-14 Future method implementation cleanup
SI-7344 Specialize methods in private scopes

This performs method specialization inside a scope other than a {class,
trait, object}: could be another method or a value. This specialization
is much simpler, since there is no need to record the new members in
the class signature, their signatures are only visible locally.
It works according to the usual logic:
 - we use normalizeMember to create the specialized symbols
 - we leave DefDef stubs in the tree that are later filled in by tree
duplication and adaptation

The solution is limited by SI-7579: since the duplicator loses the sym
annotations when duplicating, this expansion and rewiring can only take
place in code that has not been subject to duplication. You can see the
test case for an example.

Review by @dragos, @paulp or @axel22.
Merge pull request #2648 from retronym/ticket/7571

SI-7571 Allow nesting of anonymous classes in value classes
Merge pull request #2655 from VladUreche/issue/7344

 SI-7344 Specialize methods in private scopes
Less noise on a partest failure.

Throwing a BuildException is the polite way to fail the Ant build.

Before:

	BUILD FAILED
	/Users/jason/code/scala2/build.xml:1522: java.lang.RuntimeException: Test suite finished with 1 case failing:
	/Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED]
	        at scala.sys.package$.error(package.scala:27)
	        [20 lines elided]
	        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

	Total time: 2 minutes 35 seconds

After:

	BUILD FAILED
	/Users/jason/code/scala2/build.xml:1522: Test suite finished with 1 case failing:
	/Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED]

	Total time: 2 minutes 34 seconds
Merge pull request #2686 from retronym/topic/partest-task-no-stack-trace

Less noise on a partest failure.
Merge pull request #2680 from retronym/ticket/7603

SI-7603 Speculative fix for annotation binding error
SI-7336 - Link flatMapped promises to avoid memory leaks