@@ -600,38 +600,28 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
600
600
def instantiate (tp1 : NamedType , tp2 : Type )(implicit ctx : Context ): Type = {
601
601
// expose abstract type references to their bounds or tvars according to variance
602
602
class AbstractTypeMap (maximize : Boolean )(implicit ctx : Context ) extends TypeMap {
603
- def expose (tp : TypeRef ): Type = {
604
- val lo = this (tp.info.loBound)
605
- val hi = this (tp.info.hiBound)
606
- val exposed =
607
- if (variance == 0 )
608
- newTypeVar(TypeBounds (lo, hi))
609
- else if (variance == 1 )
610
- if (maximize) hi else lo
611
- else
612
- if (maximize) lo else hi
613
-
614
- debug.println(s " $tp exposed to =====> $exposed" )
615
- exposed
616
- }
603
+ def expose (lo : Type , hi : Type ): Type =
604
+ if (variance == 0 )
605
+ newTypeVar(TypeBounds (lo, hi))
606
+ else if (variance == 1 )
607
+ if (maximize) hi else lo
608
+ else
609
+ if (maximize) lo else hi
617
610
618
611
def apply (tp : Type ): Type = tp match {
619
612
case tp : TypeRef if tp.underlying.isInstanceOf [TypeBounds ] =>
613
+ val lo = this (tp.info.loBound)
614
+ val hi = this (tp.info.hiBound)
620
615
// See tests/patmat/gadt.scala tests/patmat/exhausting.scala tests/patmat/t9657.scala
621
- expose(tp)
616
+ val exposed = expose(lo, hi)
617
+ debug.println(s " $tp exposed to =====> $exposed" )
618
+ exposed
622
619
623
620
case AppliedType (tycon : TypeRef , args) if tycon.underlying.isInstanceOf [TypeBounds ] =>
624
621
val args2 = args.map(this )
625
622
val lo = this (tycon.info.loBound).applyIfParameterized(args2)
626
623
val hi = this (tycon.info.hiBound).applyIfParameterized(args2)
627
- val exposed =
628
- if (variance == 0 )
629
- newTypeVar(TypeBounds (lo, hi))
630
- else if (variance == 1 )
631
- if (maximize) hi else lo
632
- else
633
- if (maximize) lo else hi
634
-
624
+ val exposed = expose(lo, hi)
635
625
debug.println(s " $tp exposed to =====> $exposed" )
636
626
exposed
637
627
0 commit comments