Skip to content

Commit 70e800a

Browse files
committed
Make NamedTuple.From work for named tuple arguments
NamedTyple.From should be the identity for named tuple arguments
1 parent 1e04416 commit 70e800a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/core/TypeEval.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ object TypeEval:
109109
Some:
110110
defn.NamedTupleTypeRef.appliedTo:
111111
nestedPairs(fieldLabels) :: nestedPairs(fieldTypes) :: Nil
112-
else
113-
None
112+
else arg.widenDealias match
113+
case arg @ defn.NamedTuple(_, _) => Some(arg)
114+
case _ => None
114115

115116
def constantFold1[T](extractor: Type => Option[T], op: T => Any): Option[Type] =
116117
expectArgsNum(1)

0 commit comments

Comments
 (0)