File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
compiler/src/dotty/tools/dotc/printing
tests/neg-custom-args/captures Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -416,10 +416,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
416416 homogenize(tp) match
417417 case tp : TermRef if tp.symbol == defn.captureRoot => Str (" cap" )
418418 case tp : SingletonType => toTextRef(tp)
419- case ReachCapability (tp1) => toTextRef(tp1) ~ " *"
420- case MaybeCapability (tp1) => toTextRef(tp1) ~ " ?"
421419 case tp : (TypeRef | TypeParamRef ) => toText(tp) ~ " ^"
422- case _ => toText(tp)
420+ case tp : AnnotatedType if tp.isReach => toTextCaptureRef(tp.stripReach) ~ " *"
421+ case tp : AnnotatedType if tp.isMaybe => toTextCaptureRef(tp.stripMaybe) ~ " ?"
422+ case tp => toText(tp)
423423
424424 protected def isOmittablePrefix (sym : Symbol ): Boolean =
425425 defn.unqualifiedOwnerTypes.exists(_.symbol == sym) || isEmptyPrefix(sym)
Original file line number Diff line number Diff line change @@ -330,6 +330,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
330330 " ?" ~ ((" (ignored: " ~ toText(ignored) ~ " )" ) provided printDebug)
331331 case tp @ PolyProto (targs, resType) =>
332332 " [applied to [" ~ toTextGlobal(targs, " , " ) ~ " ] returning " ~ toText(resType)
333+ case tp : AnnotatedType if tp.isReach || tp.isMaybe =>
334+ toTextCaptureRef(tp)
333335 case _ =>
334336 super .toText(tp)
335337 }
Original file line number Diff line number Diff line change 11-- Error: tests/neg-custom-args/captures/reaches2.scala:8:10 -----------------------------------------------------------
228 | ps.map((x, y) => compose1(x, y)) // error // error
33 | ^
4- |reference (ps : List[(box A => A, box A => A)]) @reachCapability is not included in the allowed capture set {}
4+ |reference ps* is not included in the allowed capture set {}
55 |of an enclosing function literal with expected type ((box A ->{ps*} A, box A ->{ps*} A)) -> box (x$0: A^?) ->? (ex$15: caps.Exists) -> A^?
66-- Error: tests/neg-custom-args/captures/reaches2.scala:8:13 -----------------------------------------------------------
778 | ps.map((x, y) => compose1(x, y)) // error // error
88 | ^
9- |reference (ps : List[(box A => A, box A => A)]) @reachCapability is not included in the allowed capture set {}
9+ |reference ps* is not included in the allowed capture set {}
1010 |of an enclosing function literal with expected type ((box A ->{ps*} A, box A ->{ps*} A)) -> box (x$0: A^?) ->? (ex$15: caps.Exists) -> A^?
You can’t perform that action at this time.
0 commit comments