File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -603,6 +603,10 @@ object Capabilities:
603603 def assumedContainsOf (x : TypeRef )(using Context ): SimpleIdentitySet [Capability ] =
604604 CaptureSet .assumedContains.getOrElse(x, SimpleIdentitySet .empty)
605605
606+ /** The type representing this capability.
607+ * Note this method does not distinguish different `RootCapability` instances,
608+ * and should only be used for printing or phases not related to CC.
609+ */
606610 def toType (using Context ): Type = this match
607611 case c : RootCapability => defn.captureRoot.termRef
608612 case c : CoreCapability => c
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
203203 )
204204 isUniversal
205205 || ! refs.elems.isEmpty && refs.elems.forall(_.isCapOrFresh) && ! ccVerbose
206- case ( ref : TermRef ) :: Nil => ref.symbol == defn.captureRoot
206+ case ref :: Nil => ref.isCapRef
207207 case _ => false
208208
209209 protected def toTextGeneralCaptureSet (refs : GeneralCaptureSet ): Text = refs match
@@ -312,7 +312,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
312312 def arrowText : Text = restp match
313313 case AnnotatedType (parent, ann) if ann.symbol == defn.RetainsByNameAnnot =>
314314 ann.tree.retainedSet.retainedElementsRaw match
315- case ( ref : TermRef ) :: Nil if ref.symbol == defn.captureRoot => Str (" =>" )
315+ case ref :: Nil if ref.isCapRef => Str (" =>" )
316316 case refs => Str (" ->" ) ~ toTextRetainedElems(refs)
317317 case _ =>
318318 if Feature .pureFunsEnabled then " ->" else " =>"
Original file line number Diff line number Diff line change @@ -435,7 +435,7 @@ object RefChecks {
435435
436436 def emitOverrideError (fullmsg : Message ) =
437437 if ! (hasErrors && member.is(Synthetic ) && member.is(Module ) || member.isDummyCaptureParam) then
438- // suppress errors relating to synthetic companion objects if other override
438+ // suppress errors relating to synthetic companion objects and capture parameters if other override
439439 // errors (e.g. relating to the companion class) have already been reported.
440440 if (member.owner == clazz) report.error(fullmsg, member.srcPos)
441441 else mixinOverrideErrors += new MixinOverrideError (member, fullmsg)
You can’t perform that action at this time.
0 commit comments