Skip to content

Commit f9d65f8

Browse files
committed
get rid of asInstanceOf
1 parent 0387869 commit f9d65f8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

library/src/scala/NamedTuple.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,8 @@ object NamedTupleDecomposition:
214214
* Keys are the names of the elements.
215215
*/
216216
inline def toMap: collection.immutable.Map[String, Tuple.Union[V]] =
217-
summonAll[Tuple.Map[N, ValueOf]].toList
218-
.map(_.asInstanceOf[ValueOf[? <: String]].value)
219-
.lazyZip(x.toList)
220-
.toMap
217+
inline compiletime.constValueTuple[N].toList match
218+
case names: List[String] => names.lazyZip(x.toList).toMap
221219
end extension
222220

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

0 commit comments

Comments
 (0)