SI-7292 Deprecate octal escape literals
Cache the most recently created SubstTypeMap.

I discovered that a 1-element cache for SubstTypeMaps
gave a 75-90% hit rate.
SI-7519 Less brutal attribute resetting in adapt fallback

Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses
track of which enclosing class of the given name is referenced by
a `This` node which prefixes the an applied implicit view.

The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804
Test for reading JDK 8 (classfile format 52) class files.

This commit includes a test for reading JDK 8 (classfile format 52)
class files, in particular default (aka defender) methods. It uses ASM
to generate an interface with default methods then exercises that
interface from Scala.

Surprisingly no changes are necessary to the Scala code base to support
reading format 52 class files.

Because the test can only run under JDK 8, the JDK version is checked
and the expected output is synthesized for previous versions.
SI-7498 ParTrieMap.foreach no longer crashes

Previously, the `split` method of the `ParTrieMap` iterator threw
an exception when splitting a splitter that iterated over nodes
whose hash codes collide.
This was due to reusing the iterator of the list of colliding keys
rather than creating a new splitter.

This commit changes the `subdivide` method to create a new
iterator using the factory method of the current trie map
iterator rather than returning a `LinearSeqLike` iterator.
SI-6841 Fix bug at the intersection of DelayedInit and named args

The DelayedInit transformation analyses the constructor to partition
regular initialization from calls to super constructors / trait
initializers.

It failed to find such super calls if they were nested in a Block,
which can happens when using named or default arguments.

This commit makes that code peer into Blocks to correctly partition
the constructor statements.

This change doesn't affect the result of run/t4680.scala, which was
mentioned in nearby comments and which chronicles bugs with DelayedInit
when used in inheritance hierarchies.
an ICode InvokeStyle can now answer whether it isSuper
new bytecode emitter, GenBCode, for now under a flag

GenBCode is a drop-in replacement for GenASM with several advantages:

  - faster: ICode isn't necessary anymore.
    Instead, the ASTs delivered by CleanUp (an expression language)
    are translated directly into a stack-language (ASM Tree nodes)

  - future-proofing for Java 8 (MethodHandles, invokedynamic).

  - documentation included, shared mutable state kept to a minimum,
    all contributing to making GenBCode more maintainable
    than its counterpart (its counterpart being GenICode + GenASM).

A few tests are modified in this commit, for reasons given below.

(1) files/neg/case-collision

    Just like GenASM, GenBCode also detects output classfiles
    differing only in case. However the error message differs
    from that of GenASM (collisions may be show in different order).
    Thus the original test now has a flags file containing -neo:GenASM
    and a new test (files/neg/case-collision2) has been added
    for GenBCode. The .check files in each case show expected output.

(2) files/pos/t5031_3

    Currently the test above doesn't work with GenBCode
    (try with -neo:GenBCode in the flags file)
    The root cause lies in the fix to
    https://issues.scala-lang.org/browse/SI-5031
    which weakened an assertion in GenASM
    (GenBCode keeps the original assertion).
    Actually that ticket mentions the fix is a "workaround"

(3) files/run/t7008-scala-defined

    This test also passes only under GenASM and not GenBCode,
    thus the flags file. GenASM turns a bling eye to:

      An AbstractTypeSymbol (SI-7122) has reached the bytecode emitter,
      for which no JVM-level internal name can be found:
      ScalaClassWithCheckedExceptions_1.E1

    The error message above (shown by GenBCode) highlights
    there's no ScalaClassWithCheckedExceptions_1.E1 class,
    thus shouldn't show up in the emitted bytecode
    (GenASM emits bytecode that mentions the inexistent class).
two bytecode tests atune with bytecode by GenASM
cleans up 82f0925

Updates comments, implements accidentally forgotten IMPLPARAM_TREE,
creates a test to ensure that nothing else is overseen.
Refactor testing logic for only running under certain JDK versions

We had several tests designed to only run if the JDK version was at
least some specified version. This commit refactors that common logic
into DirectTest.
SI-6899, prohibit dangerous, useless implicit conversions.

Increase eligibility requirements for implicit conversions,
such that T => U is ineligible if

  T <: Null    <or>   AnyRef <: U

This has the salutary effect of allowing us to ditch 16
ridiculous implicits from Predef, since they existed solely
to work around the absence of this restriction.

There was one tiny impact on actual source code (one line
in one file) shown here, necessitated because the literal null
is not eligible to be implicitly converted to A via <:<.

  def f[A](implicit ev: Null <:< A): A = null     // before
  def f[A](implicit ev: Null <:< A): A = ev(null) // after

As impositions go it's on the tame side.
SI-7556 Fix runtime reflection involving ScalaLongSignature

Scala type information is stored in classfiles in encoded in a String
in the ScalaSignature annotation. When it is too big for a single
String, it is split into an array of Strings in a different annotation,
ScalaLongSignature.

The enclosed test, with a class containing 3000 methods, uses the latter.
It exposes a bug in the way runtime reflection decodes that data.

It must concatentate and *then* decode, rather that the other way around.
SI-7418 Avoid concurrent use of compiler in REPL startup

Enable the tab completer *after* we're finished binding
$intp and unleashing power mode on the asynchronous
REPL startup thread.

Tested manually:
 - run qbin/scala
 - Paste "".toUp
 - Hit <TAB> like a maniac

Before this patch, the crash was reproducible almost every time.
Afterwards, not the once.
SI-7264 Initialize owner when searching for companion.

From ClassSymbol:

    protected final def companionModule0: Symbol =
      flatOwnerInfo.decl(name.toTermName).suchThat(sym => sym.isModuleNotMethod && (sym isCoDefinedWith this))

    protected final def flatOwnerInfo: Type = {
      if (needsFlatClasses)
        info
      owner.rawInfo
    }

Note the call to `rawInfo`; in the enclosed test case, that gives
us back an uninitialized type for the module class of `Foo`, and
consequently we don't find the companion for `Foo.Values`.

This commit forces the initialization of the owning symbol if it
was compiled in a prior run.

In addition, it adds a special case to `Run#compiles` for early
initialized symbols, which start out in life with the wrong owner.
As best as I can see, that complexity stems from allowing early
initialized members *without* return types to be used as value arguments
to the super call, which in turn is needed to infer parent type arguments.
The situation is described a little further in existing comments of
`typedPrimaryConstrBody`.

This bug is essentially another case of SI-6976. See the comments in pull
request of that patch (https://github.com/scala/scala/pull/1910) for
commit archaeology that shows why we're reluctant to force the owner
info more broadly than is done in this commit.
SI-7558 Fix capture of free local vars in toolbox compiler

It was creating an `ObjectRef[<notype>]` because of a small
bug in `capturedVariableType`.
SI-6308 Specialize methods that have some unspecialized params

This is a continuation of 1591c14e50, which didn't go far enough
to handle method calls with a mix of specialized and unspecialized
type parameters.

This commit modifies `specSym` to calculate the residual type
of the original method after specialized type parameters have
been removed and the type environment of the candidate specialized
variant has been subsituted.

For example, here is trace of `specSym` when searcing for the
specialized variant of `f4` in the enclosed test:

    tree             = Main.this.f4[Nothing, Int]
    tree.tpe         = (a: Int, b: List[(Int, Nothing)])String
    fun.tpe          = [B, A](a: A, b: List[(A, B)])String
    residualTreeType = [B](a: Int, b: List[(Int, B)])String
    memberType       = [B](a: Int, b: List[(Int, B)])String
    env              = Map(type A -> Int)
    doesConform      = true

A few "todo" tests are included that highlight an endemic
issue with the current specialization implementation: type
parameters that show up after `uncurry` might be clones of
the original symbols from typer, if they have been through
a TypeMap (e.g. within a call to `uncurryTreeType`). So testing
them for existence with the `typeEnv` map is fruitless.

No amount of `atPhase` acrobatics can rescue us from this;
we need to transport this information in a symbol-cloning
resiliant manner. Maybe Symbol Attachments?
SI-5022 Retain precise existentials through pattern matching

From the dawn of scalac's existentials, the typer widens
existentials pt-s by substituting wildcard types in places
of existential quantifiers.

In this example:

    class ForSomeVsUnapply {
      def test {
        def makeWrap: Wrap = ???
        def useRep[e](rep: (e, X[e])) = ()

        val rep = makeWrap match {
          case Wrap(r) => r
        };

        useRep(rep) // error
      }
    }

the type of `r` is the result of typechecking:

    Apply(
     fun = TypeTree(
       tpe = (rep#12037: (e#12038, X#7041[e#12038]) forSome { type e#12038 })
     args = Bind(r @ _) :: Nil
    }

This descends to type the `Bind` with:

    pt = (e#12038, X#7041[e#12038]) forSome { type e#12038 }

`dropExistential` clobbers that type to `Tuple2#1540[?, X#7041[?]]`,
which doesn't express any relationship between the two instances
of the wildcard type. `typedIdent` sort of reverses this with a call
to `makeFullyDefined`, but only ends up with:

    pt = (Any#3330, X#7041[_1#12227]) forSome { type _1#12227; type e#12038 }

I suspect that this existential dropping only makes sense outside of
typechecking patterns. In pattern mode, type information flows from the
expected type onwards to the body of the case; we must not lose precision
in the types.

For SIP-18 friendly existentials, one `dropExistential` is invertable with
`makeFullyDefined`, so this hasn't been such a big problem.

The error message improvement conferred by SI-4515 took a hit.
That might be a good example to consider when reviewing this change:
Does it tell us anything interesting about this `dropExistential`
business?
SI-7479 Add avian option to partest's diff filter...

... so that the different results of the test on Avian
can be specified in the check file.
Merge pull request #2582 from paulp/pr/SubstTypeMap

Cache the most recently created SubstTypeMap.