scala/scala — pull request #4169 by retronym (2014-11-27 04:45:25+00:00)
Title: SI-9008 Fix regression with higher kinded existentials

Allow a naked type constructor in an existential type if
we are directly within a type application.

Recently, 84d4671 changed nested context creation to avoid passing
down the `TypeConstructorAllowed`, which led to missing kind errors
in code like `type T[({type M = List})#M]`.

However, when typechecking `T forSome { quantifiers }`, we create
a nested context to represent the nested scope introduced for the
quantifiers. But we need to propagate the `TypeConstructorAllowed`
bit to the nested context to allow for higher kinded existentials.

The enclosed tests show:
- pos/t9008 well kinded application of an hk existential
- neg/t9008 hk existential forbidden outside of type application
- neg/t9008b kind error reported for hk existential

Regressed in 84d4671.

Review by @adriaanm