sane semantics for Symbols.companionSymbol

While playing with tests for Type.companionType, I figured out that
companionSymbol isn’t what it seems to be:

scala> ScalaPackage.companionSymbol
res5: $r.intp.global.Symbol = <none>

scala> ScalaPackageClass.companionSymbol
res6: $r.intp.global.Symbol = package scala

Or even funnier observation:

scala> class C; object C
defined class C
defined object C

scala> val classC = typeOf[C].typeSymbol
classC: $r.intp.global.Symbol = class C

scala> val moduleC = classC.companionSymbol
moduleC: $r.intp.global.Symbol = object C

scala> classC.companionSymbol == moduleC
res0: Boolean = true

scala> moduleC.companionSymbol == classC
res1: Boolean = true

scala> moduleC.moduleClass.companionSymbol == moduleC
res2: Boolean = true

Of course, I rushed to clean this up, so that `companionSymbol` only
returns something other than NoSymbol if the target has a companion in
the common sense, not wrt the internal “class with the same name in the
same package” convention of scalac, and that `companionSymbol` for
module classes is a class, not a source module.

Unfortunately it’s not that easy, because api.Symbol#companionSymbol
has the same name as internal.Symbol#companionSymbol, so we can’t change
the behavior of the former without changing the behavior of the latter.

Therefore I deprecated api.Symbol#companionSymbol and introduced a replacement
called api.Symbol#companion with sane semantics.
ValOrDefDef.name is now TermName

Back then when we planned to introduce type macros, we relaxed the type
of DefDef.name from TermName to Name in order to potentially be able to
accommodate type names for type macros.

Since then, type macros have been cancelled (and, for the record, my
implementation of type macros in paradise 1.0 didn’t involve DefDefs
with TypeNames), and we’ve rolled back the change to DefDef.name.

What we forgot to do, however, was to change the type of ValOrDefDef.name,
which is taken care of in this commit.
SI-8118 simplifies Annotation down to a plain Tree

As per https://groups.google.com/forum/#!topic/scala-internals/8v2UL-LR9yY,
annotations don’t have to be represented as AnnotationInfos and can be
reduced to plain Trees.

Due to compatibility reasons and because of the limitations of the cake
pattern used in implementing current version of Reflection, we can’t
just say `type Annotation = Tree`, however what we can definitely do is
to deprecate all the methods on Annotation and expose `tree: Tree` instead.
SI-6814 adds typechecker modes to c.typecheck

As per multiple user requests, this commit introduces a shortcut
to typecheck trees under multiple different modes: terms (EXPRmode,
was exposed in Scala 2.10) and types (TYPEmode).

Looking into the rest of a dozen of internal typechecker modes, to the
best of my knowledge, I can’t find other modes that we could expose.
FUNmode is useful, but very situational. PATTERNmode is useful, but
also situational, because we don’t expand macros inside patterns
except for whitebox extractor macros. The rest (e.g. POLYmode or TAPPmode)
are too low-level.
SI-6931 cleans up the position API

I have finally overcome my fear of positions and got to cleaning up its
public interface.

Apparently it isn’t so bad, since there’s a sane core of methods (thanks
to whoever wrote the comments to internal#Position):
  1) Checks to distinguish offsets, opaque ranges and transparent ranges
  2) Essentials that inclide start, point, end and source
  3) Factories that create new positions based on existing ones

It looks like methods from the 3rd group are exactly what we’ve been looking
for in SI-6931, so we have nothing to add in this commit.
SI-8086 addresses problem with calling Symbol.getter

Due to an unintended clash between `def getter: Symbol` (public reflection)
and `def getter(base: Symbol): Symbol` (internal reflection), the former
is uncallable from compiler internals and/or REPL’s power mode.

While both methods are guarded by compatibility constraints, we can’t
solve this problem radically and will have to live with it for some time
Thankfully, a replacement for `sym.getter` is quite approachable, namely:
`sym.getter(sym.owner)`.

In the meanwhile, I’ve deprecated the internal `getter` method by
renaming it to `getterIn`, also touching a nearby `superSymbol`. In the next
release we’ll be able to fix the name clash for good.
SI-6441 removes Symbol.isOverride

`Symbol.isOverride` joins `Symbol.isLocal` in the unfortunate family
of methods for which we had to break source compatibility because of
their utter brokenness.

Apparently, `isOverride` only returns true for those symbols that have
the OVERRIDE flag set (i.e. the ones that are derived from source definitions
that have the `override` modifier specified next to them). Of course,
this is very confusing, and that’s exacerbated by the fact that we can’t
fix this behavior, because there’s `internal#Symbol.isOverride` that someone
might rely on.

Given that there’s perfectly working `Symbol.allOverriddenSymbols`,
this commit removes the `Symbol.isOverride` API altogether.
SI-6732 deprecates internal#Symbol.isPackage

This is the first step in disentangling api#Symbol.isPackage, which is
supposed to return false for package classes, and internal#Symbol.isPackage,
which has traditionally being used as a synonym for hasPackageFlag and
hence returned true for package classes (unlike isModule which is false
for module classes).