SI-6701 add SYNTHETIC flag to the reflection api
SI-7304 improve deprecation warnings for tree factory methods
SI-1909 Move tests from pos to run

When we're in the neighbourhood of VerifyErrors, it's better to run
the code.

This change is leading up to a fix for SI-3832, which regressed
with fix for SI-1909.
SI-3832 Extract tracking of under-construction classes to a mixin

In order to reduce the noise in OuterPathTransformer.
SI-3832 Don't lift methods in aux constructor trailing stats as STATIC

SI-1909 modified LambdaLift to lift in auxiliary constructors methods as STATIC
so they could be called before the self-constructor was called.

That allowed for:

     class Foo (x: Int) {
       def this() = this( {
         def bar() = 5
         bar
       })
    }

However, if the method is in a statement that trails the self constructor call,
this is unnecessary and in fact incorrect as it robs the lifted method of `this`.

This commit uses the machinery established in SI-6666 to limit the STATIC-ness
of lifted methods to those used in arguments for self-constructor calls.

This is used exclusively; the `isAuxillaryConstructor` check wasn't the right
way to solve this, as was seen by the regression it caused in SI-3832.
A new test case shows that we can statically lift methods in super-constructor
calls, rather than just self-constructor calls.

We also have to avoid statically lifting objects in these positions. For now,
I just emit a dev warning that a VerifyError is in your future. With some more
thought we could escalate that to a implementation restriction and emit an error.
SI-7007 Test case shows we disallow premature `this` access

Rather than the old behaviour, which compiled successfully
but led us into the jaws of a LinkageError.

Related to SI-6666.
SI-7223 More finesse in setting INCONSTRUCTOR

It's a clunky flag used to determine very early on whether
we're in the self-call, super-call or early-init section.

In SI-6666 / fd6125428, the check was improved to consider nesting.
But, that caused this regression, as Function's haven't been
translated to classes yet, so our check for enclosing non-term
owners failed wrongly flagged definitins body of a anonymous function
as INCONSTRUCTOR.

With this patch, we correctly flag:

    class C extends D {
      // INCONSTRUCTOR
      () => {
        !INCONSTRUCTOR
      }
      // INCONSTRUCTOR
    }
SI-6489 parsing in macros should provide proper positions

1. macro parsing doesn't use toolbox any more but calls parser directly

2. in order for this to work parser has to be refactored to limit
   usage of currentUnit and rewire it into parser's local unit
   method which might use currentUnit for some parsers but will
   user proper unit for UnitParser

3. similar change has to be done to make compilation unit's
   reporter overridable
refactor variable arity definitions

Transform current arrays of symbols into function-like objects
that return NoSymbol at all places where corresponding arity isn't
available.
Consolidate Position classes.

Having now been burned several times thinking I had a chunk
of positions under my belt only to find my pants had vanished
when I forged ahead, I am carving out some intermediate stages
for positions.

This one only reshuffles the internals. It consolidates almost
all the behavior into one class, leaving little stub subclasses
to mimic the classes which came before - since nothing is final
or has access anything less than public, there's no way to touch
any constructor without breakage, so they all have to stay.

I removed redundant/incorrect documentation and rewrote the
rest of it, although I don't expect the lifespan of any of it
to be enormous.

The overall thinking behind the existing design was a bit elusive.
Concrete exception-throwing implementations were provided in the base
class for every method, with less exceptional overrides defined
in selected subclasses. If you're going to define every method
in the base class, concretely no less, then there is little
advantage and lots of disadvantage to spreading out over a bunch
of subclasses.

Note that now Position contains no state and has no constructor,
characteristics which behoove its possibly distant ambition
toward AnyValhood. Though that does ignore the "api" class it
inherits which brims with implementation detail, api.Position.
It is a burden which will likely prove heavy.
Removed deprecated calls.

And changed the implementation internal traits to private[util]
rather than sealed because that's closer to the point. I would
make them "private" except that this incurs "private type escapes
scope" errors where private[util] does not.

Also improved file organization.
Corrects behavior of finalResultType.

The implementation had come to depend on finalResultType
accidentally doing things beyond its charter - in particular,
widening types. After hunting down and fixing the call sites
depending on the bugs, I was able to rewrite the method to do
only what it's supposed to do.

I threw in a different way of writing it entirely to suggest how
some correctness might be obtained in the future. It's a lot
harder for a method written like this to break.
SI-7839 Final val breaks checkinit build

Scalac does not care to initialize the unused field it emits
for a `final val`.  Users of the accessor method, which supplies
the constant definition inline, will find that -Xcheckinit will
throw.

Therefore, we don't use `final` for the `val phaseName`.
Merge pull request #2943 from som-snytt/issue/7839-phase-ass-chkinit

SI-7839 Final val breaks checkinit build
Widen type of outer accessor.

This is the key ingredient so TypeTree(sym) can resist
widening the type.
Reducing variation of tree creation methods.

TreeDSL has no future - it was always a temporary measure
waiting for something like quasiquotes to come along. In this
commit I cull as much of it as I can, especially the delicate
matter of creating new DefDefs and ValDefs, which I completely
turn over to the old style creators.

I unified all the symbol-based DefDef and ValDef creators under
a single method, since it was yet another place where ctrl-C and
ctrl-V were being punched with glee. Was beaten to the punch on
adding copyTypeDef to fill out the *Def creators.

Eliminated as many redundant positioning calls as I could find.
If you are creating a DefTree tree based on a symbol, it will
always have an atPos(sym.pos) { ... } wrapped around it. You
don't need another one.

All of this is motivated by positions work: positions are
assigned in so many places and in such an ad hoc fashion that
it is impossible to bring consistency to that without first
bringing some consistency to tree creation.
Merge pull request #2936 from paulp/pr/one-team-one-position

Consolidate Position classes.
SI-7843 Restore JSR 223 service entry

The 2.10 fix to remove the ScriptEngine service entry
was inadvertently forwarded to 2.11.

This commit reverts and adds a test.

This situation was entirely foreseen by retronym,
proving beyond doubt that he is in fact a time traveler,
as hinted by his name. He brings bugs forward into the
future and returns into the past with fixes and other
alien technology like scalaz.
Merge pull request #2945 from som-snytt/test/jsr223-service

SI-7843 Restore JSR 223 service entry
Merge pull request #2931 from paulp/pr/TreeDSL

Reducing variation of tree creation methods.