Skip to content

Commit 86e8779

Browse files
committed
Fix generic signatures for nested and types
1 parent 3f6af19 commit 86e8779

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
@@ -740,7 +740,7 @@ object Erasure {
740740
}
741741

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

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)