Skip to content

Commit 2389564

Browse files
committed
Use _: T to print bounded wildcards in imports
The old `for T` syntax cfor given impiorts is no longer valid
1 parent 491e5f3 commit 2389564

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
323323
def selectorText(sel: Tree): Text = sel match {
324324
case Thicket(l :: r :: Nil) => toTextGlobal(l) ~ " => " ~ toTextGlobal(r)
325325
case _: Ident => toTextGlobal(sel)
326-
case TypeBoundsTree(_, tpt) => "for " ~ toTextGlobal(tpt)
326+
case TypeBoundsTree(_, tpt) => "_: " ~ toTextGlobal(tpt)
327327
}
328328
val selectorsText: Text = selectors match {
329329
case id :: Nil => toText(id)
@@ -334,7 +334,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
334334
}
335335

336336
tree match {
337-
case id: Trees.SearchFailureIdent[_] =>
337+
case id: Trees.SearchFailureIdent[?] =>
338338
tree.typeOpt match {
339339
case reason: Implicits.SearchFailureType =>
340340
toText(id.name) ~ "implicitly[" ~ toText(reason.clarify(reason.expectedType)) ~ "]"
@@ -403,7 +403,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
403403
case block: Block =>
404404
blockToText(block)
405405
case If(cond, thenp, elsep) =>
406-
val isInline = tree.isInstanceOf[Trees.InlineIf[_]]
406+
val isInline = tree.isInstanceOf[Trees.InlineIf[?]]
407407
changePrec(GlobalPrec) {
408408
keywordStr(if (isInline) "inline if " else "if ") ~
409409
toText(cond) ~ (keywordText(" then") provided !cond.isInstanceOf[Parens]) ~~
@@ -413,7 +413,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
413413
"closure(" ~ (toTextGlobal(env, ", ") ~ " | " provided env.nonEmpty) ~
414414
toTextGlobal(ref) ~ (":" ~ toText(target) provided !target.isEmpty) ~ ")"
415415
case Match(sel, cases) =>
416-
val isInline = tree.isInstanceOf[Trees.InlineMatch[_]]
416+
val isInline = tree.isInstanceOf[Trees.InlineMatch[?]]
417417
if (sel.isEmpty && !isInline) blockText(cases)
418418
else changePrec(GlobalPrec) {
419419
val selTxt: Text =
@@ -637,7 +637,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
637637
// with the original types before they are rewritten, which causes a discrepancy.
638638

639639
def suppressPositions = tree match {
640-
case _: WithoutTypeOrPos[_] | _: TypeTree => true // TypeTrees never have an interesting position
640+
case _: WithoutTypeOrPos[?] | _: TypeTree => true // TypeTrees never have an interesting position
641641
case _ => false
642642
}
643643

@@ -730,7 +730,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
730730
}
731731
else toText(tree.name) ~ idText(tree)
732732

733-
private def toTextOwner(tree: Tree[_]) =
733+
private def toTextOwner(tree: Tree[?]) =
734734
"[owner = " ~ tree.symbol.maybeOwner.show ~ "]" provided ctx.settings.YprintDebugOwners.value
735735

736736
protected def dclTextOr[T >: Untyped](tree: Tree[T])(treeText: => Text): Text =

0 commit comments

Comments
 (0)