Skip to content

Commit c1a0835

Browse files
committed
Drop syntax sugar for capture set member
1 parent 1ed08de commit c1a0835

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureRef.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ trait CaptureRef extends TypeProxy, ValueType:
143143
|| viaInfo(y.info)(subsumingRefs(this, _))
144144
case MaybeCapability(y1) => this.stripMaybe.subsumes(y1)
145145
case y: TypeRef if y.derivesFrom(defn.Caps_CapSet) =>
146+
// The upper and lower bounds don't have to be in the form of `CapSet^{...}`.
147+
// They can be other capture set variables, which are bounded by `CapSet`,
148+
// like `def test[X^, Y^, Z >: X <: Y]`.
146149
y.info match
147150
case TypeBounds(_, hi: CaptureRef) => this.subsumes(hi)
148151
case _ => y.captureSetOfInfo.elems.forall(this.subsumes)

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,11 +4057,8 @@ object Parsers {
40574057
|| sourceVersion.isAtLeast(`3.6`) && in.isColon =>
40584058
makeTypeDef(typeAndCtxBounds(tname))
40594059
case _ =>
4060-
if in.isIdent(nme.UPARROW) && Feature.ccEnabled then
4061-
makeTypeDef(typeAndCtxBounds(tname))
4062-
else
4063-
syntaxErrorOrIncomplete(ExpectedTypeBoundOrEquals(in.token))
4064-
return EmptyTree // return to avoid setting the span to EmptyTree
4060+
syntaxErrorOrIncomplete(ExpectedTypeBoundOrEquals(in.token))
4061+
return EmptyTree // return to avoid setting the span to EmptyTree
40654062
}
40664063
}
40674064
}

tests/neg-custom-args/captures/capture-poly.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import caps.*
33
trait Foo extends Capability
44

55
trait CaptureSet:
6-
type C^
6+
type C >: CapSet <: CapSet^
77

88
def capturePoly[C^](a: Foo^{C^}): Foo^{C^} = a
99
def capturePoly2(c: CaptureSet)(a: Foo^{c.C^}): Foo^{c.C^} = a

tests/neg-custom-args/captures/i21868.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ trait AbstractWrong:
55
def f(): Unit^{C^} // error
66

77
trait Abstract1:
8-
type C^
8+
type C >: CapSet <: CapSet^
99
def f(): Unit^{C^}
1010

11-
class Abstract2:
12-
type C >: CapSet <: CapSet^
13-
def f(): Unit^{C^}
11+
// class Abstract2:
12+
// type C^
13+
// def f(): Unit^{C^}

0 commit comments

Comments
 (0)