Skip to content
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

Fix #6484: Properly unpickle some Scala 2 type lambdas #6494

Merged
merged 1 commit into from
May 11, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ object Scala2Unpickler {
/** Convert temp poly type to poly type and leave other types alone. */
def translateTempPoly(tp: Type)(implicit ctx: Context): Type = tp match {
case TempPolyType(tparams, restpe) =>
(if (tparams.head.owner.isTerm) PolyType else HKTypeLambda)
// This check used to read `owner.isTerm` but that wasn't always correct,
// I'm not sure `owner.is(Method)` is 100% correct either but it seems to
// work better. See the commit message where this change was introduced
// for more information.
(if (tparams.head.owner.is(Method)) PolyType else HKTypeLambda)
.fromParams(tparams, restpe)
case tp => tp
}
Expand Down
4 changes: 4 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/eff/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scalaVersion := sys.props("plugin.scalaVersion")

libraryDependencies +=
("org.atnos" %% "eff" % "5.4.1").withDottyCompat(scalaVersion.value)
13 changes: 13 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/eff/i6484.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import cats._
import cats.data._
import cats.implicits._
import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._

import scala.language.implicitConversions

object Test {
def resolve[T](e: Eff[Fx1[[X] => Kleisli[Id, String, X]], T], g: String): T =
e.runReader[String](g)(Member.Member1[[X] => Kleisli[Id, String, X]]).run
}
1 change: 1 addition & 0 deletions sbt-dotty/sbt-test/scala2-compat/eff/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
1 change: 1 addition & 0 deletions sbt-dotty/sbt-test/scala2-compat/eff/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> compile