Skip to content

Commit 3aa217f

Browse files
authored
Merge pull request #6494 from dotty-staging/fix-eff
Fix #6484: Properly unpickle some Scala 2 type lambdas
2 parents cdd844f + c70f6e5 commit 3aa217f

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ object Scala2Unpickler {
4646
/** Convert temp poly type to poly type and leave other types alone. */
4747
def translateTempPoly(tp: Type)(implicit ctx: Context): Type = tp match {
4848
case TempPolyType(tparams, restpe) =>
49-
(if (tparams.head.owner.isTerm) PolyType else HKTypeLambda)
49+
// This check used to read `owner.isTerm` but that wasn't always correct,
50+
// I'm not sure `owner.is(Method)` is 100% correct either but it seems to
51+
// work better. See the commit message where this change was introduced
52+
// for more information.
53+
(if (tparams.head.owner.is(Method)) PolyType else HKTypeLambda)
5054
.fromParams(tparams, restpe)
5155
case tp => tp
5256
}

Diff for: sbt-dotty/sbt-test/scala2-compat/eff/build.sbt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
scalaVersion := sys.props("plugin.scalaVersion")
2+
3+
libraryDependencies +=
4+
("org.atnos" %% "eff" % "5.4.1").withDottyCompat(scalaVersion.value)

Diff for: sbt-dotty/sbt-test/scala2-compat/eff/i6484.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import cats._
2+
import cats.data._
3+
import cats.implicits._
4+
import org.atnos.eff._
5+
import org.atnos.eff.all._
6+
import org.atnos.eff.syntax.all._
7+
8+
import scala.language.implicitConversions
9+
10+
object Test {
11+
def resolve[T](e: Eff[Fx1[[X] => Kleisli[Id, String, X]], T], g: String): T =
12+
e.runReader[String](g)(Member.Member1[[X] => Kleisli[Id, String, X]]).run
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))

Diff for: sbt-dotty/sbt-test/scala2-compat/eff/test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> compile

0 commit comments

Comments
 (0)