scala/scala — pull request #4021 by retronym (2014-09-30 23:00:29+00:00)
Title: SI-8869 Prevent ill-kindedness in type lambdas

When type checking an type application, the arguments are allowed
to be of kinds other than *. This leniency is controlled by the
`ContextMode` bit `TypeConstructorAllowed`.

(More fine grained checking of matching arity a bounds of type
constructors is deferred until the refchecks phase to avoid
cycles during typechecking.)

However, this bit is propagated to child contexts, which means
that we fail to report this error in the lexical context marked
here:

T[({type x = Option}#x)]
`-------------'

This commit resets this bit to false in any child context
relates to a different tree from its parent.

Review by @adriaanm