scala-js/scala-js — pull request #1365 by gzm0 (2014-12-08 06:16:18+00:00)
Title: Fix #1021: IR-check assignment to val fields

Assignment to immutable val fields is only allowed in constructors.

Note that scalac generates code in which vals in traits are
initialized through a synthesized setter. These setters are
indistinguishable from normal setters at the IR level. Therefore, IR
emitted by scalac only emits mutable fields. This restriction might
not apply to other tools generating IR.

This commit allows the optimizer to optimize things based on the
immutability of a field.