File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -193,14 +193,20 @@ final class ProperGadtConstraint private(
193193 case null =>
194194 val res = {
195195 import NameKinds .DepParamName
196+ // For symbols standing for HK types, we need to preserve the kind information
197+ // (see also usage of adaptHKvariances above)
198+ // Ideally we'd always preserve the bounds,
199+ // but first we need an equivalent of ConstraintHandling#addConstraint
200+ // TODO: implement the above
201+ val initialBounds = sym.info match {
202+ case tb @ TypeBounds (_, hi) if hi.isLambdaSub => tb
203+ case _ => TypeBounds .empty
204+ }
196205 // avoid registering the TypeVar with TyperState / TyperState#constraint
197206 // - we don't want TyperState instantiating these TypeVars
198207 // - we don't want TypeComparer constraining these TypeVars
199208 val poly = PolyType (DepParamName .fresh(sym.name.toTypeName) :: Nil )(
200- pt => (sym.info match {
201- case tb @ TypeBounds (_, hi) if hi.isLambdaSub => tb
202- case _ => TypeBounds .empty
203- }) :: Nil ,
209+ pt => initialBounds :: Nil ,
204210 pt => defn.AnyType )
205211 new TypeVar (poly.paramRefs.head, creatorState = null )
206212 }
You can’t perform that action at this time.
0 commit comments