Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions library/src/scala/NamedTuple.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ object NamedTupleDecomposition:
extension [N <: Tuple, V <: Tuple](x: NamedTuple[N, V])
/** The value (without the name) at index `n` of this tuple */
inline def apply(n: Int): Elem[NamedTuple[N, V], n.type] =
inline x.toTuple match
case tup: NonEmptyTuple => tup(n).asInstanceOf[Elem[NamedTuple[N, V], n.type]]
case tup => tup.productElement(n).asInstanceOf[Elem[NamedTuple[N, V], n.type]]
x.toTuple.apply(n).asInstanceOf[Elem[NamedTuple[N, V], n.type]]

/** The number of elements in this tuple */
inline def size: Size[NamedTuple[N, V]] = x.toTuple.size
Expand Down
10 changes: 10 additions & 0 deletions tests/pos/i22324.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import scala.language.experimental.namedTuples

opaque type System = (wires: Any)

extension (system: System)
inline def foo = system.wires
end extension

val simulation: System = ???
val _ = simulation.foo // was error
Loading