Skip to content

test: add in a regression test for #10242 #17488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2023
Merged
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
32 changes: 32 additions & 0 deletions tests/pos/i10242.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// https://github.com/lampepfl/dotty/issues/10242
type Foo[A, B <: A] = A

type Bar[A] = A match {
case Foo[String, x] => Unit
}

import scala.compiletime.ops.int.*

sealed trait HList
final case class HCons[H <: Int & Singleton, T <: HList](head: H, tail: T)
extends HList
sealed trait HNil extends HList
case object HNil extends HNil

sealed trait Tensor[T, S <: HList]

object tf:
def zeros[S <: HList](shape: S): Tensor[Float, S] = ???

type NumElements[X <: HList] <: Int = X match
case HNil => 1
case HCons[head, tail] => head * NumElements[tail]

def reshape[T, From <: HList, To <: HList](
tensor: Tensor[T, From],
shape: To
)(using NumElements[From] =:= NumElements[To]): Tensor[T, To] = ???

object test:
val x = HCons(1, HCons(2, HNil))
val y = tf.reshape(tf.zeros(x), HCons(2, HCons(1, HNil)))