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