SI-7200 Test case for fixed type inference error.

Broken in 2.9.2 and 2.10.0, but working in 2.10.1

--- sandbox/2.10.0.log
+++ sandbox/2.10.1.log
       def coflatMap[A >: Nothing <: Any, B >: Nothing <: Any](f: Test.Nel[A] => B): Test.Nel[A] => Test.Nel[B] = ((l: Test.Nel[A]) => Test.this.Nel.apply[B](f.apply(l), l.tail match {
         case immutable.this.Nil => immutable.this.Nil
-        case (hd: A, tl: List[A])scala.collection.immutable.::[A]((h @ _), (t @ _)) => {
-          val r: Test.Nel[Nothing] = NelFoo.this.coflatMap[A, Nothing](f).apply(Test.this.Nel.apply[A](h, t));
+        case (hd: A, tl: List[A])scala.collection.immutable.::[?A1]((h @ _), (t @ _)) => {
+          val r: Test.Nel[B] = NelFoo.this.coflatMap[A, B](f).apply(Test.this.Nel.apply[A](h, t));
           {
-            <synthetic> val x$1: Nothing = r.head;
-            r.tail.::[Nothing](x$1)
+            <synthetic> val x$1: B = r.head;
+            r.tail.::[B](x$1)
           }
         }
       }))

b74c33eb86 represents the exact moment of progression. Comments
in pos/t7200b.scala, a minimal test that demonstrates the problem
without type constructors or code execution, pinpoint the line of
code responsible for the fix.

Incidentally, I'm currently on a train somewhere between Solothurn
and Biel, and am consequently without the power of scala-bisector.
Undeterred, and inspired by a line I saw in Skyfall last night
("sometimes the olds ways are better"), I just pulled off a two-hop
bisection. Take that, O(log N)!

The one remaining worry is the appearance of the type variable
?A1 in the output of -Xprint:typer for run/t7200.scala.
Add counters to File#{exists, isFile, isDirectory}.

Due to limitations in the Statistics machinery, these are only
reported if this patch is applied.

        --- a/src/reflect/scala/reflect/internal/util/Statistics.scala
        +++ b/src/reflect/scala/reflect/internal/util/Statistics.scala
        @@ -109,7 +109,7 @@ quant)
            *  Quantities with non-empty prefix are printed in the statistics info.
            */
           trait Quantity {
        -    if (enabled && prefix.nonEmpty) {
        +    if (prefix.nonEmpty) {
               val key = s"${if (underlying != this) underlying.prefix else ""}/$prefix"
               qs(key) = this
             }
        @@ -243,7 +243,7 @@ quant)
            *
            *  to remove all Statistics code from build
            */
        -  final val canEnable = _enabled
        +  final val canEnable = true // _enabled
Optimization: avoid isDirectory call in DirectoryClassPath traversal

If we just established that the given path is a File or a Directory,
we don't need to go straight back to disk to re-check.

Background: When profiling an application that was using the interpreter
to compile a script, a lot of time was reported in exists / isDirectory
/ isFile. For the record, I happened to be profiling on Windows.

Turns out some of these calls are redundant, this commit and the
subsequent eliminate two sources thereof.

Here's an example of how it helps:

Taking a Hello, Akka! application, and compiling it with the compiler
and library on a directory classpath (ie, using build/quick):

    class HelloActor extends Actor {
      def receive = {
        case "hello" => println("hello back at you")
        case _       => println("huh?")
      }
    }

    object Main extends App {
      val system = ActorSystem("HelloSystem")
      // default Actor constructor
      val helloActor = system.actorOf(Props[HelloActor], name = "helloactor")
      helloActor ! "hello"
      helloActor ! "buenos dias"
    }

    % qbin/scalac -Ystatistics -classpath ~/.ivy2/cache/com.typesafe.akka/akka-actor_2.10/jars/akka-actor_2.10-2.1.1.jar:/Users/jason/.ivy2/cache/com.typesafe/config/bundles/config-1.0.0.jar sandbox/test.scala 2>&1 | grep File

Before
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 8348
File.exists calls           : 5770

After
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 2319
File.exists calls           : 5770
Optimization: avoid call to exists in PlainFile#iterator

If we just established that the given path is a File or a Directory,
we can assume it continues to exist.

Before
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 2319
File.exists calls           : 5770

After
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 2319
File.exists calls           : 345
SI-7312 @deprecatedInheritance now ignores same-file subclasses

This allows us to deprecate external inheritances as a prelude
to sealing a class, without enduring the warnings ourselved in
interlude.
SI-7315 Test @deprecatedInheritance / @specialized interplay

Don't warn about the specialized subclass.

Fixed in the previous commit for a similar issue SI-7312.
SI-7337 Error out on missing -d directory.

This check was removed without comment in 3a30af154, the addition
of JSR-223 support for the interpreter.

After this commit, I manually tested that JSR-223 support works.

    scala> import javax.script._, collection.JavaConverters._; val manager = new ScriptEngineManager; manager.getEngineByName("scala").eval("List(1)")
    import javax.script._
    import collection.JavaConverters._
    manager: javax.script.ScriptEngineManager = javax.script.ScriptEngineManager@4418f61b
    res1: Object = List(1)

3a30af154 did not include a test case, so I don't know whether I've
broken some other aspect of it. I tried the above as a `run` test,
but hit two problems, one of them seemingly our fault, and the other
a MacOS JDK wrinkle.

  1. scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.
  2. java.lang.UnsatisfiedLinkError: no AppleScriptEngine in java.library.path

I can't find my way to fix these, so JSR-223 remains untested. I don't
think that commit was really up to standard; it could handle additional
review, documentation, and testing. It might even be modularized so as
not to pollute the REPL itself.
SI-7080 improve boundary value checking for BitSet

When BitSet accepts a very large integer such as Int.MaxValue,
integer overflow possibly occurs in the calculation of boundary
value "nwords * WordLength". This faulty boundary condition
causes empty-iterator problem like following:

scala> import collection.mutable.BitSet
import collection.mutable.BitSet

scala> val x = BitSet(Int.MaxValue)
x: scala.collection.mutable.BitSet = BitSet()

scala> x.iterator
res0: Iterator[Int] = empty iterator
SI-7329 duplicate default getters for specialized parameters.

The default getter is generated with @specialized annotation if the
type parameter corresponding to the type of the parameter is
specialized. Consequently specialize pass tries to generate overloads.

Rather than pruning overloads to exclude duplicates, let's notice
that default getter specialization is not needed at all:
  - The dynamic scope of default getter doesn't include specialized
    method or class constructor.
  - generic default getter is called even when calling specialized
    method:
    object V {
      @specialized def foo[@specialized B](b: B = (??? : B)) = {}
      foo[Int]()
    }
    gives:
      invokevirtual Method V$.foo$default$1:()Ljava/lang/Object;
      invokestatic (unboxToInt)
      invokevirtual Method V$.foo$mIc$sp:(I)V
SI-7335 Mandate that parents of Predef must be defined in Predef.scala

This avoids thorny issues of cyclic references and/or missing symbol errors
due to the way Predef is completed earlier than user classes, and due to the
addition of `import Predef._` to LowPriorityImplicits.scala. More details in
Lukas's comments in [2].

How did we bootstrap originally? Manually ordering source files,
either in the Ant Build [1], or later in Global [2]. But neither mechanism
remains in place (due, I suppose, to the difficulty in defending them
with a test case.) The reordering in Global was removed in [3].

After the change, we can compile the standard library without the
results of a prior compilation run on the classpath.

    rm -rf target/locker/library/classes/scala && export LIB=build/pack/lib; java -Xmx1G -cp $LIB/scala-library.jar:$LIB/scala-reflect.jar:$LIB/scala-compiler.jar:$LIB/forkjoin.jar scala.tools.nsc.Main @args.txt
    src/library/scala/SerialVersionUID.scala:15: warning: Implementation restriction: subclassing Classfile does not
    make your annotation visible at runtime.  If that is what
    you want, you must write the annotation class in Java.
    class SerialVersionUID(value: Long) extends scala.annotation.ClassfileAnnotation
          ^
    warning: there were 75 deprecation warning(s); re-run with -deprecation for details
    warning: there were 1 unchecked warning(s); re-run with -unchecked for details
    warning: there were 5 feature warning(s); re-run with -feature for details
    four warnings found

 Where @args.txt contains:

     -classpath
     lib/forkjoin.jar:target/locker/library/classes
     -sourcepath
     src/library
     -d
     target/locker/library/classes
     src/library/scala/Function3.scala
     src/library/scala/Console.scala
     <more of src/library/**, unsorted>

This change will break scala-virtualized, which will need to move
the contents of StandardEmbeddings.scala into Predef.scala.

[1] https://github.com/scala/scala/commit/c5441dc
[2] https://github.com/scala/scala/commit/e72f0c7
[3] https://github.com/scala/scala/pull/968
SI-7335 Don't import Predef._ in Predef.scala

The check for this was foiled by the introduction of
DeprecatedPredef in c26a8db0. This didn't cause any
harm, but in any case this commit restores the intended
state of affairs.

The change is visible only through logging; no test case
is included.

    qbin/scalac -Ydebug -Ylog:all src/library/scala/Predef.scala -Ystop-after:typer 2>&1 | grep -i "Omitted import of Predef"
    [log namer] Omitted import of Predef._ for Predef.scala
    [log typer] Omitted import of Predef._ for Predef.scala

A redundant override of `firstDefinesClassOrObject` is also
removed.

Maybe we can remove the special case altogether?
SI-7335 Add logging for a now-impossible* case in Symbol#exists.

* Impossible (to the best of my knowledge) because LowPriorityImplicits
is now defined in Predef.scala. Were I more sure, we could trip an
assertion here, rather than the devWarning.
SI-7335 Sharpen up comment about implicit prioritization.
Reifier -> AST Node test.

It's a Node-by-Node tour of the reifier's abilities and
occasional foibles.

That is one spectacularly attractive checkfile.
Remove scaladoc deprecated option.

Remove -external-urls that had been previously deprecated in 2.10.
Merge pull request #2335 from retronym/topic/opt-file-access

Optimize file metadata access
SI-7335 Remove special case for import of Predef._ in Predef.scala

Perhaps this once was problematic, but in our modern age we can
bootstrap perfectly well with this import.
Merge remote-tracking branch 'origin/2.10.x' into merge/v2.10.1-235-g4525e92-to-master

Conflicts:
	bincompat-backward.whitelist.conf
	bincompat-forward.whitelist.conf
	src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
	src/compiler/scala/tools/nsc/typechecker/Typers.scala
	src/reflect/scala/reflect/internal/Types.scala
SI-7319 Clear error buffer during Typer reset.

Contexts share error/warning buffers with their
children, and this also applies ot the shared
`startContext`.

That context flushes the buffers in `startContext`
in `resetContexts`.

It also removes `typerReportAnyContextErrors`, which
appears to be an elaborate no-op. It is only ever passed
a context `c` which is a direct child of `this.context`.
So taking a buffered error out of `c` and reissuing it
into `this.context` merely re-inserts into into the same
error buffer. Consrast this with `silent`, which uses
a child context with a fresh error buffer.

SI-7319 Flush error buffer in typerReportAnyContextErrors.

After this change, we no longer rely on the backstop in resetContexts
introduced in the previous commit.
SI-7376 Scaladoc warns when discarding local doc comments with API tags

Double-star doc comments in non-dockable positions at the end of a block
will emit a warning only if API tags like @author are present, or under
-Xlint.

A real comment parser is applied early to probe for tags, to minimize
ad hoc testing or duplication, but warnings are suppressed. Residual
ad hockiness lies in precisely which tags to warn on.  Ad hoc or ad doc.

This fix is a stop gap; a richer solution would also report about other
doc locations that won't be processed.