Skip to content

Commit 5bc9fcb

Browse files
committed
performance tuning: only do GADT if a type param ref T is invariant
1 parent 013149c commit 5bc9fcb

File tree

1 file changed

+1
-1
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
814814
def checkGADT(tp: Type): Boolean = {
815815
new TypeAccumulator[Boolean] {
816816
override def apply(b: Boolean, tp: Type): Boolean = tp match {
817-
case tref: TypeRef if tref.symbol.is(TypeParam) => true
817+
case tref: TypeRef if tref.symbol.is(TypeParam) && variance == 0 => true
818818
case tp => b || foldOver(b, tp)
819819
}
820820
}.apply(false, tp)

0 commit comments

Comments
 (0)