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
18 changes: 18 additions & 0 deletions tests/neg/i24460.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Error: tests/neg/i24460.scala:12:20 ---------------------------------------------------------------------------------
12 | val _ = singletons[A, (A.A1.type, A.A2.type, A.A3.type)] // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| cannot reduce summonFrom with
| patterns : case given ev @ _:ValueOf[(test.A.A1 : test.A) & test.A]
|-------------------------------------------------------------------------------------------------------------------
|Inline stack trace
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|This location contains code that was inlined from Predef.scala:156
156 | inline def valueOf[T]: T = summonFrom {
| ^
157 | case ev: ValueOf[T] => ev.value
158 | }
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|This location contains code that was inlined from Predef.scala:156
7 | case _: (h *: t) => valueOf[`h` & T] +: singletons[T, t]
| ^^^^^^^^^^^^^^^^
-------------------------------------------------------------------------------------------------------------------
13 changes: 13 additions & 0 deletions tests/neg/i24460.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import scala.compiletime.{erasedValue, summonFrom}

object test {
private inline def singletons[T, Elem <: Tuple]: Seq[T] =
inline erasedValue[Elem] match {
case _: EmptyTuple => Seq.empty
case _: (h *: t) => valueOf[`h` & T] +: singletons[T, t]
}

enum A { case A1, A2, A3 }

val _ = singletons[A, (A.A1.type, A.A2.type, A.A3.type)] // error
}