diff --git a/community-build/community-projects/onnx-scala b/community-build/community-projects/onnx-scala index 8f05c7fd0a4c..87600b3d4234 160000 --- a/community-build/community-projects/onnx-scala +++ b/community-build/community-projects/onnx-scala @@ -1 +1 @@ -Subproject commit 8f05c7fd0a4c6f1f60a5fccf90f5d88935e7de01 +Subproject commit 87600b3d4234517d44e1549de5d8015afc8801fb diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 36967e049b86..1f959dd18908 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -2834,7 +2834,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) { caseLambda match { case caseLambda: HKTypeLambda => val instances = paramInstances(new Array(caseLambda.paramNames.length), pat) - instantiateParams(instances)(body) + instantiateParams(instances)(body).simplified case _ => body } diff --git a/compiler/test-resources/repl/i5218 b/compiler/test-resources/repl/i5218 index 143619bb1e1d..abe63009ef74 100644 --- a/compiler/test-resources/repl/i5218 +++ b/compiler/test-resources/repl/i5218 @@ -3,5 +3,4 @@ val tuple: (Int, String, Long) = (1,2,3) scala> 0.0 *: tuple val res0: (Double, Int, String, Long) = (0.0,1,2,3) scala> tuple ++ tuple -val res1: Int *: String *: Long *: - scala.Tuple.Concat[EmptyTuple.type, tuple.type] = (1,2,3,1,2,3) +val res1: Int *: String *: Long *: tuple.type = (1,2,3,1,2,3) diff --git a/compiler/test/dotc/pos-test-pickling.blacklist b/compiler/test/dotc/pos-test-pickling.blacklist index a9028e2bc25c..1dd003f380f6 100644 --- a/compiler/test/dotc/pos-test-pickling.blacklist +++ b/compiler/test/dotc/pos-test-pickling.blacklist @@ -24,20 +24,13 @@ seqtype-cycle i939.scala # Match types -typelevel0.scala -matchtype.scala -6322.scala -i7087.scala -i7868.scala i7872.scala -6709.scala -6687.scala i11236.scala i11247.scala i11250 i9999.scala -i12127.scala 8649.scala +12093.scala # Opaque type i5720.scala diff --git a/tests/run/i12194.scala b/tests/pending/i12194.scala similarity index 100% rename from tests/run/i12194.scala rename to tests/pending/i12194.scala diff --git a/tests/pos/12093.scala b/tests/pos/12093.scala new file mode 100644 index 000000000000..3bf762abb1c9 --- /dev/null +++ b/tests/pos/12093.scala @@ -0,0 +1,47 @@ +import scala.compiletime.ops.int.{`*`, +} + +// HList +sealed trait Shape +final case class #:[H <: Int & Singleton, T <: Shape](head: H, tail: T) extends Shape +case object Ø extends Shape +type Ø = Ø.type + +// Reduce +def reduce[T, S <: Shape, A <: Shape](shape: S, axes: A): Reduce[S, A, 0] = ??? +type Reduce[S, Axes <: Shape, I <: Int] <: Shape = S match { + case head #: tail => Contains[Axes, I] match { + case true => Reduce[tail, Remove[Axes, I], I + 1] + case false => head #: Reduce[tail, Axes, I + 1] + } + case Ø => Axes match { + case Ø => Ø + // otherwise, do not reduce further + } +} +type Contains[Haystack <: Shape, Needle <: Int] <: Boolean = Haystack match { + case Ø => false + case head #: tail => head match { + case Needle => true + case _ => Contains[tail, Needle] + } +} +type Remove[From <: Shape, Value <: Int] <: Shape = From match { + case Ø => Ø + case head #: tail => head match { + case Value => Remove[tail, Value] + case _ => head #: Remove[tail, Value] + } +} + +// Reshape +def reshape[From <: Shape, To <: Shape](from: From, to: To) + (using ev: NumElements[From] =:= NumElements[To]): To = ??? +type NumElements[X <: Shape] <: Int = X match { + case Ø => 1 + case head #: tail => head * NumElements[tail] +} + +// Test cases +val input = #:(25, #:(256, #:(256, #:(3, Ø)))) +val reduced = reduce(input, #:(3, #:(1, #:(2, Ø)))) +val reshaped: 5 #: 5 #: Ø = reshape(reduced, #:(5, #:(5, Ø))) diff --git a/tests/run/tuple-drop.scala b/tests/run-deep-subtype/tuple-drop.scala similarity index 100% rename from tests/run/tuple-drop.scala rename to tests/run-deep-subtype/tuple-drop.scala diff --git a/tests/run/tuple-take.scala b/tests/run-deep-subtype/tuple-take.scala similarity index 100% rename from tests/run/tuple-take.scala rename to tests/run-deep-subtype/tuple-take.scala