Skip to content

Commit

Permalink
Merge pull request #6494 from dotty-staging/fix-eff
Browse files Browse the repository at this point in the history
Fix #6484: Properly unpickle some Scala 2 type lambdas
  • Loading branch information
smarter committed May 11, 2019
2 parents cdd844f + c70f6e5 commit 3aa217f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
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

0 comments on commit 3aa217f

Please sign in to comment.