@@ -6,17 +6,15 @@ import core._
6
6
import ast ._
7
7
import Contexts ._ , Types ._ , Flags ._ , Symbols ._
8
8
import ProtoTypes ._
9
- import NameKinds .{ AvoidNameKind , UniqueName }
9
+ import NameKinds .UniqueName
10
10
import util .Spans ._
11
- import util .{Stats , SimpleIdentityMap , SrcPos }
11
+ import util .{Stats , SimpleIdentityMap , SimpleIdentitySet , SrcPos }
12
12
import Decorators ._
13
13
import config .Printers .{gadts , typr }
14
14
import annotation .tailrec
15
15
import reporting ._
16
16
import collection .mutable
17
-
18
17
import scala .annotation .internal .sharable
19
- import dotty .tools .dotc .util .SimpleIdentitySet
20
18
21
19
object Inferencing {
22
20
@@ -629,22 +627,6 @@ trait Inferencing { this: Typer =>
629
627
// instantiated `tvar` through unification.
630
628
val v = vs(tvar)
631
629
if v == null then
632
- // Even though `tvar` is non-occurring in `v`, the specific
633
- // instantiation we pick still matters because `tvar` might appear
634
- // in the bounds of a non-`qualifying` type variable in the
635
- // constraint.
636
- // In particular, if `tvar` was created as the upper or lower
637
- // bound of an existing variable by `LevelAvoidMap`, we
638
- // instantiate it in the direction corresponding to the
639
- // original variable which might be further constrained later.
640
- // Otherwise, we simply rely on `hasLowerBound`.
641
- // val name = tvar.origin.paramName
642
- // val fromBelow =
643
- // if name.is(AvoidNameKind.UpperBound) then true
644
- // else if name.is(AvoidNameKind.LowerBound) then false
645
- // else if constraint.outerDependsCovariantlyOn(tvar) then true
646
- // else if constraint.outerDependsContravariantlyOn(tvar) then false
647
- // else tvar.hasLowerBound
648
630
toInstantiate += ((tvar, 0 ))
649
631
else if v.intValue != 0 then
650
632
toInstantiate += ((tvar, v.intValue))
@@ -699,23 +681,8 @@ trait Inferencing { this: Typer =>
699
681
if v == 0 then
700
682
val aboveOK = ! constraint.dependsOn(tvar, varsToInstantiate, co = true )
701
683
val belowOK = ! constraint.dependsOn(tvar, varsToInstantiate, co = false )
702
- val now =
703
- if aboveOK == belowOK then tvar.hasLowerBound
704
- else belowOK
705
- /*
706
- val was =
707
- val name = tvar.origin.paramName
708
- val depCo = constraint.outerDependsCovariantlyOn(tvar)
709
- val depContra = constraint.outerDependsContravariantlyOn(tvar)
710
- if name.is(AvoidNameKind.UpperBound) then true
711
- else if name.is(AvoidNameKind.LowerBound) then false
712
- else if constraint.outerDependsCovariantlyOn(tvar) then true
713
- else if constraint.outerDependsContravariantlyOn(tvar) then false
714
- else tvar.hasLowerBound
715
- if now != was then
716
- println(i"diff for $tvar, was $was, aboveOK = $aboveOK, belowOK = $belowOK, depCo = $depCo, depContra = $depContra")
717
- */
718
- now
684
+ if aboveOK == belowOK then tvar.hasLowerBound
685
+ else belowOK
719
686
else
720
687
v == 1
721
688
typr.println(
0 commit comments