Skip to content

Commit 03fcc35

Browse files
committed
Make isCapSetCap reject cap* and cap.rd
1 parent 241e02d commit 03fcc35

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

local/project/dummy/capturevars.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ trait Test:
2525
def baz2(x: U[{caps.cap}]): Unit
2626
def test[E^, F^ >: {caps.cap} <: {}, G <: [C^ >: {a,b} <: {a,b}] =>> AnyRef^{C}](x: T[{E,a,b}], y: U[F]): Unit
2727
val poly: [C^ >: {a,b}] => (f: () ->{C} Unit) -> Int ->{C} Unit
28+
29+
def readup[T^ <: {cap.rd}]() = ()
30+
def readlo[T^ >: {cap.rd}]() = ()

scaladoc/src/dotty/tools/scaladoc/cc/CaptureOps.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ extension (using qctx: Quotes)(tpe: qctx.reflect.TypeRepr) // FIXME clean up and
103103

104104
def isCapSetCap: Boolean =
105105
tpe.isCapSet && tpe.match
106-
case CapturingType(_, List(ref)) => ref.isCaptureRoot
106+
case CapturingType(_, List(ref)) =>
107+
ref.isCaptureRoot && (ref match // make sure it's not cap* or cap.rd
108+
case ReachCapability(_) => false
109+
case ReadOnlyCapability(_) => false
110+
case _ => true)
107111
case _ => false
108112
end extension
109113

@@ -182,4 +186,4 @@ object CapturingType:
182186
case AnnotatedType(base, Apply(Select(New(annot), _), Nil)) if annot.symbol == CaptureDefs.retainsCap =>
183187
Some((base, List(CaptureDefs.captureRoot.termRef)))
184188
case _ => None
185-
end CapturingType
189+
end CapturingType

0 commit comments

Comments
 (0)