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:
603
603
def assumedContainsOf (x : TypeRef )(using Context ): SimpleIdentitySet [Capability ] =
604
604
CaptureSet .assumedContains.getOrElse(x, SimpleIdentitySet .empty)
605
605
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
+ */
606
610
def toType (using Context ): Type = this match
607
611
case c : RootCapability => defn.captureRoot.termRef
608
612
case c : CoreCapability => c
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
203
203
)
204
204
isUniversal
205
205
|| ! refs.elems.isEmpty && refs.elems.forall(_.isCapOrFresh) && ! ccVerbose
206
- case ( ref : TermRef ) :: Nil => ref.symbol == defn.captureRoot
206
+ case ref :: Nil => ref.isCapRef
207
207
case _ => false
208
208
209
209
protected def toTextGeneralCaptureSet (refs : GeneralCaptureSet ): Text = refs match
@@ -312,7 +312,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
312
312
def arrowText : Text = restp match
313
313
case AnnotatedType (parent, ann) if ann.symbol == defn.RetainsByNameAnnot =>
314
314
ann.tree.retainedSet.retainedElementsRaw match
315
- case ( ref : TermRef ) :: Nil if ref.symbol == defn.captureRoot => Str (" =>" )
315
+ case ref :: Nil if ref.isCapRef => Str (" =>" )
316
316
case refs => Str (" ->" ) ~ toTextRetainedElems(refs)
317
317
case _ =>
318
318
if Feature .pureFunsEnabled then " ->" else " =>"
Original file line number Diff line number Diff line change @@ -435,7 +435,7 @@ object RefChecks {
435
435
436
436
def emitOverrideError (fullmsg : Message ) =
437
437
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
439
439
// errors (e.g. relating to the companion class) have already been reported.
440
440
if (member.owner == clazz) report.error(fullmsg, member.srcPos)
441
441
else mixinOverrideErrors += new MixinOverrideError (member, fullmsg)
You can’t perform that action at this time.
0 commit comments