Skip to content

Commit 8158279

Browse files
committed
Simplify logic in matchNamed
1 parent 8441de7 commit 8158279

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ object Checking {
5656
case AppliedTypeTree(tycon, args) =>
5757
// If `args` is a list of named arguments, return corresponding type parameters,
5858
// otherwise return type parameters unchanged
59-
def matchNamed(tparams: List[TypeSymbol], args: List[Tree]): List[Symbol] = args match {
60-
case (_: NamedArg) :: _ =>
59+
def matchNamed(tparams: List[TypeSymbol], args: List[Tree]): List[Symbol] =
60+
if (hasNamedArg(args))
6161
for (NamedArg(name, _) <- args) yield tycon.tpe.member(name).symbol
62-
case _ =>
62+
else
6363
tparams
64-
}
6564
val tparams = matchNamed(tycon.tpe.typeSymbol.typeParams, args)
6665
val bounds = tparams.map(tparam =>
6766
tparam.info.asSeenFrom(tycon.tpe.normalizedPrefix, tparam.owner.owner).bounds)

0 commit comments

Comments
 (0)