Skip to content

Commit 6183cde

Browse files
Print owner of bind symbol with -Yprint-debug-owners (#16854)
Compiling with `-Yprint-debug-owners` now prints the owners of `Bind` trees. #### Before ```scala class Foo() extends Object() { [owner = class Foo]def fooImpl: Int = 1:Int match { case x @ y @ _:Int => 0 } } ``` #### After ```scala class Foo() extends Object() { [owner = class Foo]def fooImpl: Int = 1:Int match { case [owner = method fooImpl]x @ [owner = method fooImpl]y @ _:Int => 0 } } ```
2 parents ed35fef + 5fb2766 commit 6183cde

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
571571
if (lo eq hi) && alias.isEmpty then optText(lo)(" = " ~ _)
572572
else optText(lo)(" >: " ~ _) ~ optText(hi)(" <: " ~ _) ~ optText(alias)(" = " ~ _)
573573
case bind @ Bind(name, body) =>
574-
keywordText("given ").provided(tree.symbol.isOneOf(GivenOrImplicit) && !homogenizedView) ~ // Used for scala.quoted.Type in quote patterns (not pickled)
574+
toTextOwner(bind) ~ keywordText("given ").provided(tree.symbol.isOneOf(GivenOrImplicit) && !homogenizedView) ~ // Used for scala.quoted.Type in quote patterns (not pickled)
575575
changePrec(InfixPrec) { nameIdText(bind) ~ " @ " ~ toText(body) }
576576
case Alternative(trees) =>
577577
changePrec(OrPrec) { toText(trees, " | ") }

0 commit comments

Comments
 (0)