@@ -14,6 +14,7 @@ import NameOps._
1414import collection .mutable
1515import reporting .diagnostic .Message
1616import reporting .diagnostic .messages ._
17+ import Checking .{preCheckKind , preCheckKinds , checkNoPrivateLeaks }
1718
1819trait TypeAssigner {
1920 import tpd ._
@@ -134,8 +135,7 @@ trait TypeAssigner {
134135 avoid(expr.tpe, localSyms(bindings).filter(_.isTerm))
135136
136137 def avoidPrivateLeaks (sym : Symbol , pos : Position )(implicit ctx : Context ): Type =
137- if (! sym.is(SyntheticOrPrivate ) && sym.owner.isClass)
138- Checking .checkNoPrivateLeaks(sym, pos)
138+ if (! sym.is(SyntheticOrPrivate ) && sym.owner.isClass) checkNoPrivateLeaks(sym, pos)
139139 else sym.info
140140
141141 def seqToRepeated (tree : Tree )(implicit ctx : Context ): Tree =
@@ -348,6 +348,8 @@ trait TypeAssigner {
348348 case pt : TypeLambda =>
349349 val paramNames = pt.paramNames
350350 if (hasNamedArg(args)) {
351+ val paramBoundsByName = paramNames.zip(pt.paramInfos).toMap
352+
351353 // Type arguments which are specified by name (immutable after this first loop)
352354 val namedArgMap = new mutable.HashMap [Name , Type ]
353355 for (NamedArg (name, arg) <- args)
@@ -356,7 +358,7 @@ trait TypeAssigner {
356358 else if (! paramNames.contains(name))
357359 ctx.error(s " undefined parameter name, required: ${paramNames.mkString(" or " )}" , arg.pos)
358360 else
359- namedArgMap(name) = arg.tpe
361+ namedArgMap(name) = preCheckKind( arg, paramBoundsByName(name.asTypeName)) .tpe
360362
361363 // Holds indexes of non-named typed arguments in paramNames
362364 val gapBuf = new mutable.ListBuffer [Int ]
@@ -389,7 +391,7 @@ trait TypeAssigner {
389391 }
390392 }
391393 else {
392- val argTypes = args.tpes
394+ val argTypes = preCheckKinds( args, pt.paramInfos) .tpes
393395 if (sameLength(argTypes, paramNames) || ctx.phase.prev.relaxedTyping) pt.instantiate(argTypes)
394396 else wrongNumberOfTypeArgs(fn.tpe, pt.typeParams, args, tree.pos)
395397 }
0 commit comments