From 48f6cdda26d23c563511caaf6842691b2cf5d23e Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 11 Feb 2014 11:31:01 -0800 Subject: Revert "SI-1786 incorporate defined bounds in inference" Have to revert because the stricter bounds that it inferred break e.g., slick. (Backstop for that added as pos/t1786-counter.scala, as minimized by Jason) Worse, the fix was compilation order-dependent. There's a less invasive fix (SI-6169) that could be generalized in `sharpenQuantifierBounds` (used in `skolemizeExistential`), but I'd rather not mess with existentials at this point. This reverts commit e28c3edda4dd405ed382227d2a688b799bf33c72. Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala test/files/pos/t1786.scala --- .../scala/tools/nsc/typechecker/Typers.scala | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 088aa5216a..1a53fef4aa 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4891,23 +4891,13 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper asym setInfo logResult(s"Updating bounds of ${asym.fullLocationString} in $tree from '$abounds' to")(TypeBounds(lo, hi)) } if (asym != null && asym.isAbstractType) { - // See pos/t1786 to follow what's happening here. - def canEnhanceIdent = ( - asym.hasCompleteInfo - && tparam.exists /* sometimes it is NoSymbol */ - && tparam.hasCompleteInfo /* SI-2940 */ - && !tparam.isFBounded /* SI-2251 */ - && !tparam.isHigherOrderTypeParameter - && !(abounds.hi <:< tbounds.hi) - && asym.isSynthetic /* this limits us to placeholder tparams, excluding named ones */ - ) arg match { - case Bind(_, _) => enhanceBounds() - // TODO: consolidate fixes for SI-6169 and SI-1786 by dropping the Ident case, - // in favor of doing sharpenQuantifierBounds for all ExistentialTypes, not just java-defined ones - // (need to figure out how to sharpen the bounds on creation without running into cycles) - case Ident(name) if canEnhanceIdent => enhanceBounds() - case _ => + // I removed the Ident() case that partially fixed SI-1786, + // because the stricter bounds being inferred broke e.g., slick + // worse, the fix was compilation order-dependent + // sharpenQuantifierBounds (used in skolemizeExistential) has an alternative fix (SI-6169) that's less invasive + case Bind(_, _) => enhanceBounds() + case _ => } } } -- cgit v1.2.3