@@ -153,16 +153,18 @@ object Applications {
153153
154154 def tupleComponentTypes (tp : Type )(using Context ): List [Type ] =
155155 tp.widenExpr.dealias.normalized match
156- case tp : AppliedType =>
157- if defn.isTupleClass(tp.tycon.typeSymbol) then
158- tp.args
159- else if tp.tycon.derivesFrom(defn.PairClass ) then
160- val List (head, tail) = tp.args
161- head :: tupleComponentTypes(tail)
162- else
156+ case defn.NamedTuple (_, vals) =>
157+ tupleComponentTypes(vals)
158+ case tp : AppliedType =>
159+ if defn.isTupleClass(tp.tycon.typeSymbol) then
160+ tp.args
161+ else if tp.tycon.derivesFrom(defn.PairClass ) then
162+ val List (head, tail) = tp.args
163+ head :: tupleComponentTypes(tail)
164+ else
165+ Nil
166+ case _ =>
163167 Nil
164- case _ =>
165- Nil
166168
167169 def productArity (tp : Type , errorPos : SrcPos = NoSourcePosition )(using Context ): Int =
168170 if (defn.isProductSubType(tp)) productSelectorTypes(tp, errorPos).size else - 1
@@ -2585,7 +2587,7 @@ trait Applications extends Compatibility {
25852587 /** Is `formal` a product type which is elementwise compatible with `params`? */
25862588 def ptIsCorrectProduct (formal : Type , params : List [untpd.ValDef ])(using Context ): Boolean =
25872589 isFullyDefined(formal, ForceDegree .flipBottom)
2588- && defn.isProductSubType(formal)
2590+ && ( defn.isProductSubType(formal) || formal.isNamedTupleType )
25892591 && tupleComponentTypes(formal).corresponds(params): (argType, param) =>
25902592 param.tpt.isEmpty || argType.widenExpr <:< typedAheadType(param.tpt).tpe
25912593
0 commit comments