Skip to content

Commit de1f749

Browse files
committed
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]
1 parent 9a2455a commit de1f749

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/compiler/scala/tools/nsc/typechecker/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ trait Implicits {
10151015
args foreach (getParts(_))
10161016
}
10171017
} else if (sym.isAliasType) {
1018-
getParts(tp.dealias)
1018+
getParts(tp.normalize) // SI-7180 Normalize needed to expand HK type refs
10191019
} else if (sym.isAbstractType) {
10201020
getParts(tp.bounds.hi)
10211021
}

test/files/pos/t7180.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait Higher[F[_]]
2+
3+
trait Box[A]
4+
object Box {
5+
implicit def HigherBox = new Higher[Box] {}
6+
}
7+
8+
object Foo {
9+
val box = implicitly[Higher[Box]] // compiles fine !!!
10+
11+
type Bar[A] = Box[A]
12+
val bar = implicitly[Higher[Bar]] // <-- this doesn't compile in 2.10.1-RC1, but does in 2.10.0 !!!
13+
}

0 commit comments

Comments
 (0)