@@ -1343,7 +1343,7 @@ object Types {
13431343 case tp : AndType =>
13441344 tp.derivedAndType(tp.tp1.widenUnionWithoutNull, tp.tp2.widenUnionWithoutNull)
13451345 case tp : RefinedType =>
1346- tp.derivedRefinedType(tp. parent.widenUnion, tp.refinedName, tp.refinedInfo )
1346+ tp.derivedRefinedType(parent = tp.parent.widenUnion )
13471347 case tp : RecType =>
13481348 tp.rebind(tp.parent.widenUnion)
13491349 case tp : HKTypeLambda =>
@@ -3192,7 +3192,9 @@ object Types {
31923192
31933193 def checkInst (using Context ): this .type = this // debug hook
31943194
3195- def derivedRefinedType (parent : Type , refinedName : Name , refinedInfo : Type )(using Context ): Type =
3195+ final def derivedRefinedType
3196+ (parent : Type = this .parent, refinedName : Name = this .refinedName, refinedInfo : Type = this .refinedInfo)
3197+ (using Context ): Type =
31963198 if ((parent eq this .parent) && (refinedName eq this .refinedName) && (refinedInfo eq this .refinedInfo)) this
31973199 else RefinedType (parent, refinedName, refinedInfo)
31983200
@@ -4098,7 +4100,7 @@ object Types {
40984100 case tp @ AppliedType (tycon, args) if defn.isFunctionNType(tp) =>
40994101 wrapConvertible(tp.derivedAppliedType(tycon, args.init :+ addInto(args.last)))
41004102 case tp @ defn.RefinedFunctionOf (rinfo) =>
4101- wrapConvertible(tp.derivedRefinedType(tp.parent, tp.refinedName, addInto(rinfo)))
4103+ wrapConvertible(tp.derivedRefinedType(refinedInfo = addInto(rinfo)))
41024104 case tp : MethodOrPoly =>
41034105 tp.derivedLambdaType(resType = addInto(tp.resType))
41044106 case ExprType (resType) =>
@@ -5609,8 +5611,8 @@ object Types {
56095611 else hi
56105612 case (arg, _) => arg
56115613 tp.derivedAppliedType(tycon, args1)
5612- case tp @ RefinedType (parent, name, info) =>
5613- tp.derivedRefinedType(approxWildcardArgs(parent), name, info )
5614+ case tp : RefinedType =>
5615+ tp.derivedRefinedType(approxWildcardArgs(tp. parent))
56145616 case _ =>
56155617 tp
56165618 approxWildcardArgs(tp)
0 commit comments