Skip to content

Commit 84ca54c

Browse files
Merge pull request #4690 from dotty-staging/fix-parameter-twice-in-constructors
Do not print type parameter twice in constructors
2 parents 1f523ea + aea47f0 commit 84ca54c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,15 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
272272

273273
case Term.TypeApply(fn, args) =>
274274
printTree(fn)
275-
this += "["
276-
printTypeOrBoundsTrees(args, ", ")
277-
this += "]"
275+
fn match {
276+
case Term.Select(Term.New(TypeTree.Applied(_, _)), "<init>", _) =>
277+
// type bounds already printed in `fn`
278+
this
279+
case _ =>
280+
this += "["
281+
printTypeOrBoundsTrees(args, ", ")
282+
this += "]"
283+
}
278284

279285
case Term.Super(qual, tptOpt) =>
280286
printTree(qual)

tests/run-with-compiler/i3847-b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
new scala.Array[scala.List[scala.Int]][collection.immutable.List[scala.Int]](1)
2+
new scala.Array[scala.List[scala.Int]](1)
33
}

0 commit comments

Comments
 (0)