@@ -14,6 +14,7 @@ import NameOps._
14
14
import collection .mutable
15
15
import reporting .diagnostic .Message
16
16
import reporting .diagnostic .messages ._
17
+ import Checking .{preCheckKind , preCheckKinds , checkNoPrivateLeaks }
17
18
18
19
trait TypeAssigner {
19
20
import tpd ._
@@ -134,8 +135,7 @@ trait TypeAssigner {
134
135
avoid(expr.tpe, localSyms(bindings).filter(_.isTerm))
135
136
136
137
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)
139
139
else sym.info
140
140
141
141
def seqToRepeated (tree : Tree )(implicit ctx : Context ): Tree =
@@ -348,6 +348,8 @@ trait TypeAssigner {
348
348
case pt : TypeLambda =>
349
349
val paramNames = pt.paramNames
350
350
if (hasNamedArg(args)) {
351
+ val paramBoundsByName = paramNames.zip(pt.paramInfos).toMap
352
+
351
353
// Type arguments which are specified by name (immutable after this first loop)
352
354
val namedArgMap = new mutable.HashMap [Name , Type ]
353
355
for (NamedArg (name, arg) <- args)
@@ -356,7 +358,7 @@ trait TypeAssigner {
356
358
else if (! paramNames.contains(name))
357
359
ctx.error(s " undefined parameter name, required: ${paramNames.mkString(" or " )}" , arg.pos)
358
360
else
359
- namedArgMap(name) = arg.tpe
361
+ namedArgMap(name) = preCheckKind( arg, paramBoundsByName(name.asTypeName)) .tpe
360
362
361
363
// Holds indexes of non-named typed arguments in paramNames
362
364
val gapBuf = new mutable.ListBuffer [Int ]
@@ -389,7 +391,7 @@ trait TypeAssigner {
389
391
}
390
392
}
391
393
else {
392
- val argTypes = args.tpes
394
+ val argTypes = preCheckKinds( args, pt.paramInfos) .tpes
393
395
if (sameLength(argTypes, paramNames) || ctx.phase.prev.relaxedTyping) pt.instantiate(argTypes)
394
396
else wrongNumberOfTypeArgs(fn.tpe, pt.typeParams, args, tree.pos)
395
397
}
0 commit comments