From 5ac739eb65694457ac21800404641a693648a55c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 12 Jan 2016 10:39:37 +0100 Subject: Fix PostTyper normalization for named args Needs to work also if named arg refers to an abstract type, not a parameter. --- src/dotty/tools/dotc/typer/Checking.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/dotty') diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index 0baf48fa3..f18c5bf7c 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -54,13 +54,11 @@ object Checking { def traverse(tree: Tree)(implicit ctx: Context) = { tree match { case AppliedTypeTree(tycon, args) => - // If `args` is a list of named argiments, return corresponding type parameters, + // If `args` is a list of named arguments, return corresponding type parameters, // otherwise return type parameters unchanged - def matchNamed(tparams: List[TypeSymbol], args: List[Tree]): List[TypeSymbol] = args match { - case Nil => Nil - case NamedArg(name, arg) :: args1 => - val (matchingParam :: Nil, others) = tparams.partition(_.name == name) - matchingParam :: matchNamed(others, args1) + def matchNamed(tparams: List[TypeSymbol], args: List[Tree]): List[Symbol] = args match { + case (arg: NamedArg) :: _ => + for (NamedArg(name, arg) <- args) yield tycon.tpe.member(name).symbol case _ => tparams } -- cgit v1.2.3