Fix #1021: IR-check assignment to val fields

Assignment to immutable val fields is only allowed in constructors.

Scalac handles immutable (val) fields that are mixed-in from a trait
adding a setter. The val is then initialized through this setter in
the trait initializer. This violates the IR contract that immutable
vals may only be assigned to in constructors.

Further, scalac sometimes unsets fields needed for by-name
parameters. Consider the following:

    class A(_x: => Int) {
      lazy val x = _x
    }

In the (lazy) initializer of `x`, `_x` is set to null, once
initialization is complete (unless `_x` is used otherwise).

Therefore, we verify the flags emitted by scalac and do a second pass
over the trees to fix the mutable flag if necessary.
Remove unnecessary vars in StringCharBuffer