Skip to content

Commit c89ac35

Browse files
committed
feat: review fixes
1 parent 37b4759 commit c89ac35

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

library/src/scala/NamedTuple.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ object NamedTupleDecomposition:
216216
*/
217217
inline def toListMap: ListMap[String, Tuple.Union[V]] =
218218
inline compiletime.constValueTuple[N].toList match
219-
case names: List[String] => ListMap.from(names.zip(x.toList))
219+
case names: List[String] =>
220+
ListMap.from(names.iterator.zip(
221+
x.toTuple.productIterator.asInstanceOf[Iterator[Tuple.Union[V]]]
222+
))
220223
end extension
221224

222225
/** The names of a named tuple, represented as a tuple of literal string values. */

tests/run/named-tuple-ops.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ type Labels = (x: String, y: String)
8484
assert(cityFields == List("Lausanne", 1000, 140000))
8585

8686
val cityArr = city.toArray
87-
val _: Array[Object] = cityArr
8887
assert(cityArr.sameElements(Array("Lausanne", 1000, 140000)))
8988

9089
val cityMap = city.toListMap

0 commit comments

Comments
 (0)