Skip to content

Commit 578d400

Browse files
authored
Merge pull request #6204 from dotty-staging/fix-constraint-prune
Fix pruning when adding a constraint
2 parents b07cf89 + ee907d0 commit 578d400

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ trait ConstraintHandling[AbstractContext] {
413413
def pruneLambdaParams(tp: Type) =
414414
if (comparedTypeLambdas.nonEmpty) {
415415
val approx = new ApproximatingTypeMap {
416-
if (fromBelow) variance = -1
416+
if (!fromBelow) variance = -1
417417
def apply(t: Type): Type = t match {
418418
case t @ TypeParamRef(tl: TypeLambda, n) if comparedTypeLambdas contains tl =>
419419
val bounds = tl.paramInfos(n)

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
194194
case OrType(tp1, tp2) =>
195195
return toTextInfixType(tpnme.raw.BAR, tp1, tp2) { toText(tpnme.raw.BAR) }
196196

197-
case EtaExpansion(tycon) =>
197+
case EtaExpansion(tycon) if !ctx.settings.YprintDebug.value =>
198198
return toText(tycon)
199199
case tp: RefinedType if defn.isFunctionType(tp) =>
200200
return toTextDependentFunction(tp.refinedInfo.asInstanceOf[MethodType])

tests/run/implicit-functors.check

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/run/implicit-functors.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import Utils._
77

88
class Instances[F[_[_]], T[_]]
99

10-
trait Functor[F[_]]
10+
class Functor[F[_]](val kind: String)
1111

1212
object Functor {
13-
implicit val functorId: Functor[Id] = { println("functorId"); null }
14-
implicit def functorGen[F[_]](implicit inst: Instances[Functor, F]): Functor[F] = { println("funcorGen"); null }
15-
implicit def functorConst[T]: Functor[Const[T]] = { println("funcorConst"); null }
13+
implicit val functorId: Functor[Id] = new Functor[Id]("id")
14+
implicit def functorGen[F[_]](implicit inst: Instances[Functor, F]): Functor[F] = new Functor[F]("gen")
15+
implicit def functorConst[T]: Functor[Const[T]] = new Functor[Const[T]]("const")
1616
}
1717

1818
case class Sm[A](value: A)
1919
object Sm {
20-
implicit def smInstances[F[_[_]]]: Instances[F, Sm] = { println("smInstances"); null }
20+
implicit def smInstances[F[_[_]]]: Instances[F, Sm] = null
2121
}
2222

2323
object Test extends App {
24-
implicitly[Functor[Sm]]
24+
assert(implicitly[Functor[Sm]].kind == "gen")
2525
}

0 commit comments

Comments
 (0)