Skip to content

Commit 388314f

Browse files
committed
More detailed debugging
1 parent 2235db0 commit 388314f

File tree

1 file changed

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

1 file changed

+20
-7
lines changed

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,18 +703,31 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
703703
parent.argInfos.nonEmpty && minTypeMap.apply(parent) <:< maxTypeMap.apply(tp2)
704704
}
705705

706-
if (protoTp1 <:< tp2) {
707-
if (isFullyDefined(protoTp1, force)) protoTp1
708-
else instUndetMap.apply(protoTp1)
706+
val sub1 = isSubType(protoTp1, tp2)
707+
debug.println(s"Space.instantiate: protoTp1($protoTp1 ${protoTp1.show}) <:< tp2($tp2 ${tp2.show}) = $sub1")
708+
def determine(comparer: Type, protoTp1: Type): Type = {
709+
debug.println(i"Space.instantiate: isFullyDefined($comparer) = ...")
710+
val determined = isFullyDefined(comparer, force)
711+
debug.println(i"Space.instantiate: isFullyDefined($comparer) = $determined")
712+
if (determined) protoTp1
713+
else {
714+
val res = instUndetMap.apply(protoTp1)
715+
debug.println(i"Space.instantiate: instUndetMap.apply(protoTp1($protoTp1)) -> $res")
716+
res
717+
}
718+
}
719+
720+
if (sub1) {
721+
determine(protoTp1, protoTp1)
709722
}
710723
else {
711724
val protoTp2 = maxTypeMap.apply(tp2)
712-
if (protoTp1 <:< protoTp2 || parentQualify) {
713-
if (isFullyDefined(AndType(protoTp1, protoTp2), force)) protoTp1
714-
else instUndetMap.apply(protoTp1)
725+
val sub2 = protoTp1 <:< protoTp2
726+
debug.println(s"Space.instantiate: protoTp1($protoTp1 ${protoTp1.show}) <:< protoTp2($protoTp2 ${protoTp2.show}) = $sub2")
727+
if (sub2 || parentQualify) {
728+
determine(AndType(protoTp1, protoTp2), protoTp1)
715729
}
716730
else {
717-
debug.println(s"$protoTp1 <:< $protoTp2 = false")
718731
NoType
719732
}
720733
}

0 commit comments

Comments
 (0)