SI-7598 Make erasure of isInstanceOf[X.type] $outer-aware

Type tests against Singleton-, This- and, Super- types are translated
into reference equality checks in erasure.

For instance:

    class C { object X; X.isInstanceOf[X.type] }

Results in:

    class C { object X; X eq X }

But, the term tree created to refer to the object behind the
SingleType was constructed without being explicit about outer
pointers.

After typer:

    class C { object X; class Inner { X.isInstanceOf[X.type] } }

After explicitouter:

    class C { object X; class Inner($outer: C) { $outer().X().isInstanceOf[X.type] } }

After erasure:

    class C { object X; class Inner($outer: C) { $outer().X() eq Outer.this.X() } }

That leads to a crash in icode.

This commit changes the explicit outer tree transformer to transform
the types of TypeTrees:

After exlicitouter:

    Inner.this.$outer().X().isInstanceOf[Inner.this.$outer.X.type](

Review by @gkossakowski / @odersky

Do to this, we need versions of outerValue, outerSelect, and outerPath
that operate on types. I also refactored the term-level versions of
these to help emphasise the similarities and differences with the new
versions.

Some robustness is needed in the face of ill-scoped references left
in the trees after extension methods and tail call elimination have
left a mess in pos/t6891.scala.