Skip to content

Fix pruning when adding a constraint #6204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ trait ConstraintHandling[AbstractContext] {
def pruneLambdaParams(tp: Type) =
if (comparedTypeLambdas.nonEmpty) {
val approx = new ApproximatingTypeMap {
if (fromBelow) variance = -1
if (!fromBelow) variance = -1
def apply(t: Type): Type = t match {
case t @ TypeParamRef(tl: TypeLambda, n) if comparedTypeLambdas contains tl =>
val bounds = tl.paramInfos(n)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case OrType(tp1, tp2) =>
return toTextInfixType(tpnme.raw.BAR, tp1, tp2) { toText(tpnme.raw.BAR) }

case EtaExpansion(tycon) =>
case EtaExpansion(tycon) if !ctx.settings.YprintDebug.value =>
return toText(tycon)
case tp: RefinedType if defn.isFunctionType(tp) =>
return toTextDependentFunction(tp.refinedInfo.asInstanceOf[MethodType])
Expand Down
2 changes: 0 additions & 2 deletions tests/run/implicit-functors.check

This file was deleted.

12 changes: 6 additions & 6 deletions tests/run/implicit-functors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import Utils._

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

trait Functor[F[_]]
class Functor[F[_]](val kind: String)

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

case class Sm[A](value: A)
object Sm {
implicit def smInstances[F[_[_]]]: Instances[F, Sm] = { println("smInstances"); null }
implicit def smInstances[F[_[_]]]: Instances[F, Sm] = null
}

object Test extends App {
implicitly[Functor[Sm]]
assert(implicitly[Functor[Sm]].kind == "gen")
}