Skip to content

Commit 83e90dc

Browse files
committed
Fix generic signatures for nested and types
1 parent 0b97046 commit 83e90dc

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ object Erasure {
739739
}
740740

741741
private def hiBounds(bounds: TypeBounds)(implicit ctx: Context): List[Type] = bounds.hi.widenDealias match {
742-
case AndType(tp1, tp2) => tp1 :: tp2 :: Nil
742+
case AndType(tp1, tp2) => hiBounds(tp1.bounds) ::: hiBounds(tp2.bounds)
743743
case tp => tp :: Nil
744744
}
745745

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
T <: C1, T1, T2
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class C1
2+
trait T1
3+
trait T2
4+
5+
class Foo {
6+
def foo[T <: (C1 & T1) & T2] = ()
7+
}
8+
9+
object Test {
10+
def main(args: Array[String]): Unit = {
11+
val tParams = classOf[Foo].getDeclaredMethod("foo").getTypeParameters
12+
tParams.foreach { tp =>
13+
println(tp.getName + " <: " + tp.getBounds.map(_.getTypeName).mkString(", "))
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)