Browse files

SI-7180 Fix regression in implicit scope of HK type alias.

We actually need to call normalize here, otherwise we don't
progress through #1 below.

    [infer implicit] scala.this.Predef.implicitly[Higher[Foo.Bar]] with pt=Higher[Foo.Bar] in object Foo
    1. tp=Foo.Bar tp.normalize=[A <: <?>]Foo.Bar[A] tp.dealias=Foo.Bar
    2. tp=Foo.Bar[A] tp.normalize=Box[A] tp.dealias=Box[A]
  • Loading branch information...
1 parent 9a2455a commit de1f74990aa5321a47dd1366a1e283f2ca8a4e6f @retronym retronym committed Feb 25, 2013
Showing with 14 additions and 1 deletion.
  1. +1 −1 src/compiler/scala/tools/nsc/typechecker/Implicits.scala
  2. +13 −0 test/files/pos/t7180.scala
View
2 src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -1015,7 +1015,7 @@ trait Implicits {
args foreach (getParts(_))
}
} else if (sym.isAliasType) {
- getParts(tp.dealias)
+ getParts(tp.normalize) // SI-7180 Normalize needed to expand HK type refs
} else if (sym.isAbstractType) {
getParts(tp.bounds.hi)
}
View
13 test/files/pos/t7180.scala
@@ -0,0 +1,13 @@
+trait Higher[F[_]]
+
+trait Box[A]
+object Box {
+ implicit def HigherBox = new Higher[Box] {}
+}
+
+object Foo {
+ val box = implicitly[Higher[Box]] // compiles fine !!!
+
+ type Bar[A] = Box[A]
+ val bar = implicitly[Higher[Bar]] // <-- this doesn't compile in 2.10.1-RC1, but does in 2.10.0 !!!
+}

0 comments on commit de1f749

Please sign in to comment.