File tree 3 files changed +7
-5
lines changed
compiler/src/dotty/tools/dotc/printing
tests/neg-custom-args/captures
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 {
416
416
homogenize(tp) match
417
417
case tp : TermRef if tp.symbol == defn.captureRoot => Str (" cap" )
418
418
case tp : SingletonType => toTextRef(tp)
419
- case ReachCapability (tp1) => toTextRef(tp1) ~ " *"
420
- case MaybeCapability (tp1) => toTextRef(tp1) ~ " ?"
421
419
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)
423
423
424
424
protected def isOmittablePrefix (sym : Symbol ): Boolean =
425
425
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) {
330
330
" ?" ~ ((" (ignored: " ~ toText(ignored) ~ " )" ) provided printDebug)
331
331
case tp @ PolyProto (targs, resType) =>
332
332
" [applied to [" ~ toTextGlobal(targs, " , " ) ~ " ] returning " ~ toText(resType)
333
+ case tp : AnnotatedType if tp.isReach || tp.isMaybe =>
334
+ toTextCaptureRef(tp)
333
335
case _ =>
334
336
super .toText(tp)
335
337
}
Original file line number Diff line number Diff line change 1
1
-- Error: tests/neg-custom-args/captures/reaches2.scala:8:10 -----------------------------------------------------------
2
2
8 | ps.map((x, y) => compose1(x, y)) // error // error
3
3
| ^
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 {}
5
5
|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^?
6
6
-- Error: tests/neg-custom-args/captures/reaches2.scala:8:13 -----------------------------------------------------------
7
7
8 | ps.map((x, y) => compose1(x, y)) // error // error
8
8
| ^
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 {}
10
10
|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