Skip to content

Commit 4cb6ee6

Browse files
test: add in a regression test for #10242 (#17488)
Closes #10242
2 parents 8ad520f + c779c26 commit 4cb6ee6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/pos/i10242.scala

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// https://github.com/lampepfl/dotty/issues/10242
2+
type Foo[A, B <: A] = A
3+
4+
type Bar[A] = A match {
5+
case Foo[String, x] => Unit
6+
}
7+
8+
import scala.compiletime.ops.int.*
9+
10+
sealed trait HList
11+
final case class HCons[H <: Int & Singleton, T <: HList](head: H, tail: T)
12+
extends HList
13+
sealed trait HNil extends HList
14+
case object HNil extends HNil
15+
16+
sealed trait Tensor[T, S <: HList]
17+
18+
object tf:
19+
def zeros[S <: HList](shape: S): Tensor[Float, S] = ???
20+
21+
type NumElements[X <: HList] <: Int = X match
22+
case HNil => 1
23+
case HCons[head, tail] => head * NumElements[tail]
24+
25+
def reshape[T, From <: HList, To <: HList](
26+
tensor: Tensor[T, From],
27+
shape: To
28+
)(using NumElements[From] =:= NumElements[To]): Tensor[T, To] = ???
29+
30+
object test:
31+
val x = HCons(1, HCons(2, HNil))
32+
val y = tf.reshape(tf.zeros(x), HCons(2, HCons(1, HNil)))

0 commit comments

Comments
 (0)