@@ -1504,7 +1504,6 @@ class Namer { typer: Typer =>
1504
1504
if ptype.typeParams.isEmpty
1505
1505
// && !ptype.dealias.typeSymbol.primaryConstructor.info.finalResultType.isInstanceOf[RefinedType]
1506
1506
&& ! ptype.dealias.typeSymbol.is(Dependent )
1507
- || ctx.erasedTypes
1508
1507
then
1509
1508
ptype
1510
1509
else
@@ -1613,46 +1612,12 @@ class Namer { typer: Typer =>
1613
1612
/** The refinements coming from all parent class constructor applications */
1614
1613
val parentRefinements = mutable.LinkedHashMap [Name , Type ]()
1615
1614
1616
- /** Split refinements off parent type and add them to `parentRefinements` */
1617
- def separateRefinements (tp : Type ): Type = tp match
1618
- case RefinedType (tp1, rname, rinfo) =>
1619
- try separateRefinements(tp1)
1620
- finally
1621
- parentRefinements(rname) = parentRefinements.get(rname) match
1622
- case Some (tp) => tp & rinfo
1623
- case None => rinfo
1624
- case tp => tp
1625
-
1626
- /** Add all parent refinements to the result type of the `info` of
1627
- * the class constructor. Parent refinements refer to parameter accessors
1628
- * in the current class. These have to be mapped to the paramRefs of the
1629
- * constructor info.
1630
- * @param info The (remaining part) of the constructor info
1631
- * @param nameToParamRef The map from parameter names to paramRefs of
1632
- * previously encountered parts of `info`.
1633
- */
1634
- def integrateParentRefinements (info : Type , nameToParamRef : Map [Name , Type ]): Type = info match
1635
- case info : MethodOrPoly =>
1636
- info.derivedLambdaType(resType =
1637
- integrateParentRefinements(info.resType,
1638
- nameToParamRef ++ info.paramNames.zip(info.paramRefs)))
1639
- case _ =>
1640
- val mapParams = new TypeMap :
1641
- def apply (t : Type ) = t match
1642
- case t : TermRef if t.symbol.is(ParamAccessor ) && t.symbol.owner == cls =>
1643
- nameToParamRef(t.name)
1644
- case _ =>
1645
- mapOver(t)
1646
- parentRefinements.foldLeft(info): (info, refinement) =>
1647
- val (rname, rinfo) = refinement
1648
- RefinedType (info, rname, mapParams(rinfo))
1649
-
1650
1615
val parentTypes =
1651
1616
defn.adjustForTuple(cls, cls.typeParams,
1652
1617
defn.adjustForBoxedUnit(cls,
1653
1618
addUsingTraits(
1654
1619
ensureFirstIsClass(cls, parents.map(checkedParentType(_)))
1655
- ))).map(separateRefinements)
1620
+ ))).map(_. separateRefinements(parentRefinements) )
1656
1621
1657
1622
typr.println(i " completing $denot, parents = $parents%, %, stripped parent types = $parentTypes%, % " )
1658
1623
typr.println(i " constr type = ${cls.primaryConstructor.infoOrCompleter}, refinements = ${parentRefinements.toList}" )
@@ -1671,8 +1636,7 @@ class Namer { typer: Typer =>
1671
1636
tempInfo = null // The temporary info can now be garbage-collected
1672
1637
1673
1638
if parentRefinements.nonEmpty then
1674
- val constr = cls.primaryConstructor
1675
- constr.info = integrateParentRefinements(constr.info, Map ())
1639
+ integrateParentRefinements(cls.primaryConstructor, parentRefinements)
1676
1640
cls.setFlag(Dependent )
1677
1641
Checking .checkWellFormed(cls)
1678
1642
if (isDerivedValueClass(cls)) cls.setFlag(Final )
0 commit comments