Skip to content

Commit af7b341

Browse files
Don't normalize in VarianceChecker
1 parent 44477ac commit af7b341

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class VarianceChecker(using Context) {
133133
def apply(status: Option[VarianceError], tp: Type): Option[VarianceError] = trace(s"variance checking $tp of $base at $variance", variances) {
134134
try
135135
if (status.isDefined) status
136-
else tp.normalized match {
136+
else tp match {
137137
case tp: TypeRef =>
138138
val sym = tp.symbol
139139
if (sym.isOneOf(VarianceFlags) && base.isContainedIn(sym.owner)) checkVarianceOfSymbol(sym)

tests/pos/10747-onnxmin.scala

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import scala.compiletime.ops.string.+
2+
import scala.compiletime.ops.int
3+
import scala.compiletime.ops.int.{S, +, <, <=, *}
4+
import scala.compiletime.ops.boolean.&&
5+
6+
object OnnxMin {
7+
type Index = Int & Singleton
8+
9+
sealed trait Indices
10+
final case class :::[+H <: Index, +T <: Indices](head: H, tail: T) extends Indices
11+
12+
sealed trait INil extends Indices
13+
case object INil extends INil
14+
15+
16+
type Dimension = Int & Singleton
17+
18+
sealed trait Shape extends Product with Serializable
19+
20+
final case class #:[+H <: Dimension, +T <: Shape](head: H, tail: T) extends Shape
21+
22+
sealed trait SNil extends Shape
23+
case object SNil extends SNil
24+
25+
type CContains[Haystack <: Indices, Needle <: Index] <: Boolean = Haystack match {
26+
case head ::: tail => head match {
27+
case Needle => true
28+
case _ => CContains[tail, Needle]
29+
}
30+
case INil => false
31+
}
32+
33+
type AddGivenAxisSizeLoop[First <: Shape, Second <: Shape, AxisIndex <: Indices, I <: Index] <: Shape = First match {
34+
case head #: tail => CContains[AxisIndex, I] match {
35+
case true => Second match {
36+
case secondHead #: secondTail => head #: tail
37+
case SNil => AxisIndex match{
38+
case INil => SNil
39+
}
40+
}
41+
}
42+
}
43+
44+
def ConcatV13: AddGivenAxisSizeLoop[Dimension #: Shape, Dimension #: Shape, Index ::: INil, 0] = ???
45+
}

0 commit comments

Comments
 (0)