From 041f9ceaf4edf02dbf197d6e636eeed2f09a6693 Mon Sep 17 00:00:00 2001 From: odersky Date: Sun, 29 Oct 2023 17:55:09 +0100 Subject: [PATCH] Make printing of capture sets work also when testing Pickler --- .../src/dotty/tools/dotc/printing/RefinedPrinter.scala | 4 +++- tests/pos-custom-args/captures/i18699.scala | 7 ------- 2 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 tests/pos-custom-args/captures/i18699.scala diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 4f63bfb38691..bc8e2e9bc88e 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -640,7 +640,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { try changePrec(GlobalPrec)(toText(arg) ~ "^" ~ toTextCaptureSet(captureSet)) catch case ex: IllegalCaptureRef => toTextAnnot if annot.symbol.maybeOwner == defn.RetainsAnnot - && Feature.ccEnabled && Config.printCaptureSetsAsPrefix && !printDebug + && Feature.ccEnabled + && Config.printCaptureSetsAsPrefix && !printDebug + && Phases.checkCapturesPhase.exists // might be missing on -Ytest-pickler then toTextRetainsAnnot else toTextAnnot case EmptyTree => diff --git a/tests/pos-custom-args/captures/i18699.scala b/tests/pos-custom-args/captures/i18699.scala deleted file mode 100644 index 61b21b0d3ad4..000000000000 --- a/tests/pos-custom-args/captures/i18699.scala +++ /dev/null @@ -1,7 +0,0 @@ -import language.experimental.captureChecking -trait Cap: - def use: Int = 42 - -def test2(cs: List[Cap^]): Unit = - val t0: Cap^{cap[test2]} = cs.head // error - var t1: Cap^{cap[test2]} = cs.head // error \ No newline at end of file