Skip to content

Commit 6be2091

Browse files
adpi2bishaboshamlachkar
committed
[Fix #13306] Print paramInfo of HKTypeLambda
Co-authored-by: Jamie Thompson <[email protected]> Co-authored-by: Meriam Lachkar <[email protected]>
1 parent ea63740 commit 6be2091

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Variances.varianceSign
1414
import util.SourcePosition
1515
import scala.util.control.NonFatal
1616
import scala.annotation.switch
17+
import Decorators._
1718

1819
class PlainPrinter(_ctx: Context) extends Printer {
1920
/** The context of all public methods in Printer and subclasses.
@@ -354,9 +355,12 @@ class PlainPrinter(_ctx: Context) extends Printer {
354355
val names =
355356
if lam.isDeclaredVarianceLambda then
356357
lam.paramNames.lazyZip(lam.declaredVariances).map((name, v) =>
357-
varianceSign(v) + name)
358-
else lam.paramNames
359-
(names.mkString("[", ", ", "]"), lam.resType)
358+
varianceSign(v) ~ name.toString)
359+
else lam.paramNames.map(toTextGlobal)
360+
val infos = lam.paramInfos.map(toTextGlobal)
361+
val tparamStr = names.zip(infos).map((n, i) => (n ~ i).show)
362+
.mkString("[", ", ", "]")
363+
(tparamStr, lam.resType)
360364
case _ =>
361365
("", tp)
362366
bounds match

tests/printing/i13306.check

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[[syntax trees at end of typer]] // tests/printing/i13306.scala
2+
package example {
3+
class MyClass() extends Object() {}
4+
class MembersContainer() extends Object() {
5+
type MyType[T >: Nothing <: example.MyClass] = Comparable[T]
6+
}
7+
final lazy module val Exports: example.Exports = new example.Exports()
8+
final module class Exports() extends Object() { this: example.Exports.type =>
9+
val instance: example.MembersContainer = new example.MembersContainer()
10+
export example.Exports.instance.*
11+
final type MyType[T <: example.MyClass] = Comparable[T]
12+
}
13+
}
14+

tests/printing/i13306.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package example
2+
3+
class MyClass
4+
5+
class MembersContainer {
6+
type MyType[T <: MyClass] = Comparable[T]
7+
}
8+
9+
object Exports {
10+
val instance = new MembersContainer
11+
export instance.*
12+
}

0 commit comments

Comments
 (0)