aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-01-12 10:39:37 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-19 14:00:00 +0100
commit5ac739eb65694457ac21800404641a693648a55c (patch)
tree77e5716c1414fe0bf29dee3de7f729abd0bce911 /src/dotty
parent9757adc43f3b608974c418a7b8ddf68d355f6c48 (diff)
downloaddotty-5ac739eb65694457ac21800404641a693648a55c.tar.gz
dotty-5ac739eb65694457ac21800404641a693648a55c.tar.bz2
dotty-5ac739eb65694457ac21800404641a693648a55c.zip
Fix PostTyper normalization for named args
Needs to work also if named arg refers to an abstract type, not a parameter.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/typer/Checking.scala10
1 files changed, 4 insertions, 6 deletions
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
}