@@ -674,7 +674,15 @@ class Namer { typer: Typer =>
674674
675675 def typeDefSig (tdef : TypeDef , sym : Symbol )(implicit ctx : Context ): Type = {
676676 completeParams(tdef.tparams)
677- sym.info = TypeBounds .empty
677+ val tparamSyms = tdef.tparams map symbolOfTree
678+ val isDerived = tdef.rhs.isInstanceOf [untpd.DerivedTypeTree ]
679+ val toParameterize = tparamSyms.nonEmpty && ! isDerived
680+ val needsLambda = sym.allOverriddenSymbols.exists(_ is HigherKinded ) && ! isDerived
681+ def abstracted (tp : Type ): Type =
682+ if (needsLambda) tp.LambdaAbstract (tparamSyms)
683+ else if (toParameterize) tp.parameterizeWith(tparamSyms)
684+ else tp
685+ sym.info = abstracted(TypeBounds .empty)
678686 // Temporarily set info of defined type T to ` >: Nothing <: Any.
679687 // This is done to avoid cyclic reference errors for F-bounds.
680688 // This is subtle: `sym` has now an empty TypeBounds, but is not automatically
@@ -685,18 +693,10 @@ class Namer { typer: Typer =>
685693 //
686694 // The scheme critically relies on an implementation detail of isRef, which
687695 // inspects a TypeRef's info, instead of simply dealiasing alias types.
688- val tparamSyms = tdef.tparams map symbolOfTree
689- val isDerived = tdef.rhs.isInstanceOf [untpd.DerivedTypeTree ]
690- val toParameterize = tparamSyms.nonEmpty && ! isDerived
691- val needsLambda = sym.allOverriddenSymbols.exists(_ is HigherKinded ) && ! isDerived
692696 val rhsType = typedAheadType(tdef.rhs).tpe
693- def abstractedRhsType =
694- if (needsLambda) rhsType.LambdaAbstract (tparamSyms)
695- else if (toParameterize) rhsType.parameterizeWith(tparamSyms)
696- else rhsType
697697 val unsafeInfo = rhsType match {
698- case _ : TypeBounds => abstractedRhsType .asInstanceOf [TypeBounds ]
699- case _ => TypeAlias (abstractedRhsType , if (sym is Local ) sym.variance else 0 )
698+ case _ : TypeBounds => abstracted(rhsType) .asInstanceOf [TypeBounds ]
699+ case _ => TypeAlias (abstracted(rhsType) , if (sym is Local ) sym.variance else 0 )
700700 }
701701 sym.info = NoCompleter
702702 checkNonCyclic(sym, unsafeInfo, reportErrors = true )
0 commit comments