Skip to content

Commit 19e4423

Browse files
committed
Adapt type assignment for AppliedTypeTrees to new named params
1 parent 7feb0f2 commit 19e4423

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ trait TypeAssigner {
9696
}
9797
case tp @ AppliedType(tycon, args) if toAvoid(tycon) =>
9898
val base = apply(tycon)
99-
apply(base.appliedTo(tp.baseArgInfos(base.typeSymbol)))
99+
val args = tp.baseArgInfos(base.typeSymbol)
100+
if (base.typeParams.length == args.length) base.appliedTo(args) else base
100101
case tp @ RefinedType(parent, name) if variance > 0 =>
101102
val parent1 = apply(tp.parent)
102103
val refinedInfo1 = apply(tp.refinedInfo)
@@ -404,16 +405,13 @@ trait TypeAssigner {
404405

405406
def assignType(tree: untpd.AppliedTypeTree, tycon: Tree, args: List[Tree])(implicit ctx: Context) = {
406407
val tparams = tycon.tpe.typeParams
408+
lazy val ntparams = tycon.tpe.namedTypeParams
407409
def refineNamed(tycon: Type, arg: Tree) = arg match {
408410
case ast.Trees.NamedArg(name, argtpt) =>
409411
// Dotty deviation: importing ast.Trees._ and matching on NamedArg gives a cyclic ref error
410412
val tparam = tparams.find(_.name == name) match {
411413
case Some(tparam) => tparam
412-
case none =>
413-
val sym = tycon.member(name).symbol
414-
if (sym.isAbstractType) sym
415-
else if (sym.is(ParamAccessor)) sym.info.dealias.typeSymbol
416-
else NoSymbol
414+
case none => ntparams.find(_.name == name).getOrElse(NoSymbol)
417415
}
418416
if (tparam.exists) RefinedType(tycon, name, argtpt.tpe.toBounds(tparam))
419417
else errorType(i"$tycon does not have a parameter or abstract type member named $name", arg.pos)

0 commit comments

Comments
 (0)