Skip to content

Hide capture sets when the current unit is not capture checked #19858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ class PlainPrinter(_ctx: Context) extends Printer {
val refsText = if showAsCap then rootSetText else toTextCaptureSet(refs)
toTextCapturing(parent, refsText, boxText)
case tp @ RetainingType(parent, refs) =>
val refsText = refs match
case ref :: Nil if ref.symbol == defn.captureRoot => rootSetText
case _ => toTextRetainedElems(refs)
toTextCapturing(parent, refsText, "") ~ Str("R").provided(printDebug)
if Feature.ccEnabledSomewhere then
val refsText = refs match
case ref :: Nil if ref.symbol == defn.captureRoot => rootSetText
case _ => toTextRetainedElems(refs)
toTextCapturing(parent, refsText, "") ~ Str("R").provided(printDebug)
else toText(parent)
case tp: PreviousErrorType if ctx.settings.XprintTypes.value =>
"<error>" // do not print previously reported error message because they may try to print this error type again recuresevely
case tp: ErrorType =>
Expand Down