scala/scala — pull request #951 by adriaanm (2012-07-19 21:07:16+00:00)
Title: SI-4440 phase constructors cannot drop outer accessors

review by @odersky, as this affects the constructors phase

before, we would drop outer accessors from nested final classes if the outer-accessor wasn't accessed anywhere (for some limited definition of "accessed")
however, for the sake of separate compilation and the outer checks inserted by the pattern matcher,
we need to assume they might be accessed anywhere

the alternative would be to omit the outer checks when the outer accessors aren't available
this is what the old pattern matcher did

part 2:
don't check super-type args after erasure (parentTypes)
this is mostly to appease pos/z1730 (which runs with -Ycheck:all)
after fixing SI-4440, running parentTypes after constructors would fail
not running this check after erasure doesn't lose any precision
since all constructors will be type checked for real in typedTemplate anyway

more precisely, after constructors, can't type check primary ctor body in the ad-hoc context used in parentTypes, since it will have inserted assignments to the private[this] outer accessor,
which will only type check when the ctor is type checked in the proper context
here, it's type checked in a context outside the class to avoid circular dependency errors