@@ -140,16 +140,18 @@ object Applications {
140140
141141 def tupleComponentTypes (tp : Type )(using Context ): List [Type ] =
142142 tp.widenExpr.dealias.normalized match
143- case tp : AppliedType =>
144- if defn.isTupleClass(tp.tycon.typeSymbol) then
145- tp.args
146- else if tp.tycon.derivesFrom(defn.PairClass ) then
147- val List (head, tail) = tp.args
148- head :: tupleComponentTypes(tail)
149- else
143+ case defn.NamedTuple (_, vals) =>
144+ tupleComponentTypes(vals)
145+ case tp : AppliedType =>
146+ if defn.isTupleClass(tp.tycon.typeSymbol) then
147+ tp.args
148+ else if tp.tycon.derivesFrom(defn.PairClass ) then
149+ val List (head, tail) = tp.args
150+ head :: tupleComponentTypes(tail)
151+ else
152+ Nil
153+ case _ =>
150154 Nil
151- case _ =>
152- Nil
153155
154156 def productArity (tp : Type , errorPos : SrcPos = NoSourcePosition )(using Context ): Int =
155157 if (defn.isProductSubType(tp)) productSelectorTypes(tp, errorPos).size else - 1
@@ -2558,7 +2560,7 @@ trait Applications extends Compatibility {
25582560 /** Is `formal` a product type which is elementwise compatible with `params`? */
25592561 def ptIsCorrectProduct (formal : Type , params : List [untpd.ValDef ])(using Context ): Boolean =
25602562 isFullyDefined(formal, ForceDegree .flipBottom)
2561- && defn.isProductSubType(formal)
2563+ && ( defn.isProductSubType(formal) || formal.isNamedTupleType )
25622564 && tupleComponentTypes(formal).corresponds(params): (argType, param) =>
25632565 param.tpt.isEmpty || argType.widenExpr <:< typedAheadType(param.tpt).tpe
25642566
0 commit comments