diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index 64d825ca7c26..a6047e3325a3 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -14,6 +14,7 @@ import Variances.varianceSign import util.SourcePosition import scala.util.control.NonFatal import scala.annotation.switch +import Decorators._ class PlainPrinter(_ctx: Context) extends Printer { /** The context of all public methods in Printer and subclasses. @@ -355,8 +356,10 @@ class PlainPrinter(_ctx: Context) extends Printer { if lam.isDeclaredVarianceLambda then lam.paramNames.lazyZip(lam.declaredVariances).map((name, v) => varianceSign(v) + name) - else lam.paramNames - (names.mkString("[", ", ", "]"), lam.resType) + else lam.paramNames.map(_.toString) + val infos = lam.paramInfos.map(_.show) + val tparamStr = names.zip(infos).map(_ + _).mkString("[", ", ", "]") + (tparamStr, lam.resType) case _ => ("", tp) bounds match diff --git a/tests/printing/i13306.check b/tests/printing/i13306.check new file mode 100644 index 000000000000..053d2f861cf3 --- /dev/null +++ b/tests/printing/i13306.check @@ -0,0 +1,14 @@ +[[syntax trees at end of typer]] // tests/printing/i13306.scala +package example { + class MyClass() extends Object() {} + class MembersContainer() extends Object() { + type MyType[T >: Nothing <: example.MyClass] = Comparable[T] + } + final lazy module val Exports: example.Exports = new example.Exports() + final module class Exports() extends Object() { this: example.Exports.type => + val instance: example.MembersContainer = new example.MembersContainer() + export example.Exports.instance.* + final type MyType[T <: example.MyClass] = Comparable[T] + } +} + diff --git a/tests/printing/i13306.scala b/tests/printing/i13306.scala new file mode 100644 index 000000000000..790f55018404 --- /dev/null +++ b/tests/printing/i13306.scala @@ -0,0 +1,12 @@ +package example + +class MyClass + +class MembersContainer { + type MyType[T <: MyClass] = Comparable[T] +} + +object Exports { + val instance = new MembersContainer + export instance.* +}