Skip to content

Commit 93be92c

Browse files
committed
chore: add regression test for #24460
1 parent 96849c4 commit 93be92c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/neg/i24460.check

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Error: tests/neg/i24460.scala:12:20 ---------------------------------------------------------------------------------
2+
12 | val _ = singletons[A, (A.A1.type, A.A2.type, A.A3.type)] // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| cannot reduce summonFrom with
5+
| patterns : case given ev @ _:ValueOf[(test.A.A1 : test.A) & test.A]
6+
|-------------------------------------------------------------------------------------------------------------------
7+
|Inline stack trace
8+
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9+
|This location contains code that was inlined from Predef.scala:156
10+
156 | inline def valueOf[T]: T = summonFrom {
11+
| ^
12+
157 | case ev: ValueOf[T] => ev.value
13+
158 | }
14+
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15+
|This location contains code that was inlined from Predef.scala:156
16+
7 | case _: (h *: t) => valueOf[`h` & T] +: singletons[T, t]
17+
| ^^^^^^^^^^^^^^^^
18+
-------------------------------------------------------------------------------------------------------------------

tests/neg/i24460.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import scala.compiletime.{erasedValue, summonFrom}
2+
3+
object test {
4+
private inline def singletons[T, Elem <: Tuple]: Seq[T] =
5+
inline erasedValue[Elem] match {
6+
case _: EmptyTuple => Seq.empty
7+
case _: (h *: t) => valueOf[`h` & T] +: singletons[T, t]
8+
}
9+
10+
enum A { case A1, A2, A3 }
11+
12+
val _ = singletons[A, (A.A1.type, A.A2.type, A.A3.type)] // error
13+
}

0 commit comments

Comments
 (0)