SI-8052 Disallow `macro` as an identifier

Note that the change could look a lot cleaner, at the cost of returning
more generic error messages. I decided that at least for 2.11 I'll keep
scalac remembering that macro was a standard identifier name once, so
that we can point out more precisely what's wrong with users' code.
typeCheck => typecheck

This method has always been slightly bothering me, so I was really glad
when Denys asked me to rename it. Let’s see how it pans out.
SI-7971 Handle static field initializers correctly

Before this fix, static fields where erroneously treated like instance
fields and the initialization was moved into the constructor.

With this fix, the static initializer statements go into the static
initializer of the class (called “<STATIC> def init” in Scala,
<clinit> in Java). The statements are added to an existing
static initializer method or, if no such method exists, a new static
initializer method is created and added to the class.
SI-8017 Value class awareness for -Ydelamdafy:method

The delambdafy creates a bridge method which requires adaptation
of the result type to the generic `Object`, which is the erased
return type of FunctionN.

This bridge building reused some code from erasure, now refactored
into TypeAdaptingTransformer.

But, it was running into problems with:

    class C(a: Int) extends AnyVal
    (x: Any) => new C(0)

It created (forgive the pseudo quasiquote syntax):

    class anonfun$ extends Function1[Any, C] {
       def apply#1(a: Object): Int = 0
       <bridge> def apply#2(a: Object): Object = {
         val result: Int = apply#1(a)
         ${adapt(Ident("result"), ObjectType)}
       }
    }

This resulted in primitive boxing, rather than value class boxing.

Instead, we need the call to the main apply method to be typed
as `ErasedValueClass(C, Int)`, which `adapt` takes as a trigger
to perform value class boxing.

Finally, we have to run the post-erasure transformer over the adapted
tree to eliminate remnants of `ErasedValueClass` from the types of
trees.
SI-6120 Suppress extra warnings

This is a mere polish for the fix to allow multiple warnings.

Sensibility checks in refchecks were shown to be redundant.

This commit includes a mild refactor to reduce tabbage, and
uses a local var to flag that a warning has already been emitted.

It would be better to have the checks return true if warned,
to facilitate `nonSensically || unrelatedly`, etc., but that's
a lot of `else false`.

The check files that were updated with the redundant warnings
are reverted.
duplicates macro arguments before expansion

As discussed with Jason, this is an important dimension of defenses that
we can build to ensure robustness of the macro engine.

This commit is important in the context of the upcoming patch to the
presentation compiler that will throw away expansions and keep original
macro applications (only when run in presentation compiler mode) so that
hyperlinking in macro arguments starts working in the IDE.

Duplication of macro arguments will make sure that macro arguments, which
are going to become exposed to the IDE, can’t become corrupted by possibly
misbehaving or misguided macros.
Merge pull request #3224 from soc/SI-7971

SI-7971 Handle static field initializers correctly
makes boxity of fast track macros configurable

Previously, all built-in macros were assumed to be whitebox, but that’s
actually not the case. Just quasiquote macros have to be whitebox, while
the rest can be blackbox.

This also fixes SI-8091, because blackbox macros are typechecked differently
and therefore the necessary implicit conversion kicks in. If `f”...”` were
to remain a whitebox macro, then due to the changes introduced in commit
https://github.com/scala/scala/commit/a3b33419b02cafb7e2c6fed6dd96151859fc7d77
we would have to explicitly ascribe its expansion as String to achieve the same effect.

After I made reify blackbox, several tests had to be changed, because
we now explicitly ascribe the expansion with `c.Expr[T]`, which changes `toString`.
Also, a number of less obvious corrections had to be applied, because
things like `reify(<constant>).splice` have stopped being optimized away
due to `reify(<constant>)` no longer having a narrow `c.Expr[<constant>.type]`,
making it ineligible for constant folding.

Moreover, this change forced me to adjust our approach to positioning
blackbox wrappings, because after being changed to blacbox and starting using
wrappings, f”...” interpolators used in the compiler started crashing
-Yrangepos builds. Now wrapping Typed nodes are assigned with transparent
positions.
SI-5508 Fix crasher with private[this] in nested traits

Currently, accessors for private local trait fields are added
very late in the game when the `Mixin` tree transformer treats the
trait. By contrast, fields with weaker access have accessors created
eagerly in `Namers`.

    // Mixin#addLateInterfaceMembers
    val getter = member.getter(clazz)
    if (getter == NoSymbol) addMember(clazz, newGetter(member))

`addMember` mutates the type of the interface to add the getter.
(This seems like a pretty poor design: usually if a phase changes
types, it should do in an `InfoTransformer`.)

However, if an inner class or anonymous function of the trait
has been flattened to a spot where it precedes the trait in the
enclosing packages info, this code hasn't had a chance to run,
and the lookup of the getter crashes as mixins `postTransform`
runs over a selection of the not-yet-materialized getter.

    // Mixin#postTransform
	case Select(qual, name) if sym.owner.isImplClass && !isStaticOnly(sym) =>
	  val iface  = toInterface(sym.owner.tpe).typeSymbol
	  val ifaceGetter = sym getter iface

This commit ensures that `Flatten` lifts inner classes to
a position *after* the enclosing class in the stats of the
enclosing package.

Bonus fix: SI-7012 (the followup ticket to SI-6231 / SI-2897)
Remove obsolete diagnostic error for SI-6231

The previous commit means we no longer have a test that
gets to this point.
Merge pull request #3257 from xeno-by/topic/duplicate-macro-args

(2.11.0-M8) duplicates macro arguments before expansion
Merge pull request #3234 from retronym/ticket/5508-3

 Fix crasher with private[this] in nested traits
Merge pull request #3274 from retronym/ticket/8017

SI-8017 Value class awareness for -Ydelamdafy:method
Merge pull request #3276 from som-snytt/issue/6120-spurious-check

SI-6120 Suppress extra warnings
duplicates arguments to macro typer APIs

This commit continues the tendency set by the parent commit to duplicate
as much as possible in order to avoid potential confusion that users
might run into when compiler internals start leaking.

Here we plumb another way that by-reference sharing of trees might bite
unsuspecting macro writers. Previously we have duplicated macro expansions,
macro arguments, c.macroApplication, and now it’s arguments to typeCheck
and resetAttrs.

There is still an unlikely situation when someone gets to c.enclosingXXX
and then starts typechecking around, but that’s left for future work,
as it’s yet unclear what to do with c.enclosingXXX APIs.
cosmetic changes to liftables

Namely:
1) Moved definitions of Liftable and Unliftable into a separate file.
2) Inlined internal names that were only used in StandardLiftables.
Merge pull request #3279 from xeno-by/topic/cosmetics

cosmetic changes to liftables
SI-7406 crasher with specialized lazy val

This reverts a tiny bit of f7d5f45aa7 where the crasher was
introduced. The enclosed test case compiles and runs under 2.9,
but prints the wrong answer. It crashes in 2.10 and until this
patch. Now it compiles and prints the right answer.
Fix Ant uptodate checking in OSGI JAR creation

Changes to the compiler or library were not triggering recreation
of the OSGI JARs, which are used in the local maven deployment tasks.

Reason: this Ant-ipattern:

    <fileset base="/foo">
       <include name="/foo/bar.baz"/>
    </fileset>

Instead, we should use a <filelist/>, which doesn't require
a base directory. This can be composed into a <srcresources/>
element in the <uptodate/>.

Phew!
Invalidate <uptodate> checks on edits to build-ant-macros.xml

This was recently refactored from build.xml. Changing either file
should invalidate caches.