File tree Expand file tree Collapse file tree 3 files changed +6
-8
lines changed
compiler/src/dotty/tools/dotc
tests/neg-custom-args/captures Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -83,15 +83,13 @@ extension (tp: Type)
8383 tp1.reach :: Nil
8484 case ReadOnlyCapability (tp1) =>
8585 tp1.readOnly :: Nil
86- case tp : CaptureRef if tp.isTrackableRef =>
87- tp :: Nil
88- case tp : TypeRef if tp.symbol.isType && tp.derivesFrom(defn.Caps_CapSet ) =>
89- tp :: Nil
86+ case tp : CaptureRef =>
87+ if tp.isNothingType then Nil
88+ else tp :: Nil // should be checked by wellformedness
9089 case OrType (tp1, tp2) =>
9190 tp1.retainedElements ++ tp2.retainedElements
9291 case _ =>
93- if tp.isNothingType then Nil
94- else throw IllegalCaptureRef (tp)
92+ throw IllegalCaptureRef (tp)
9593
9694 /** Is this type a CaptureRef that can be tracked?
9795 * This is true for
Original file line number Diff line number Diff line change @@ -788,7 +788,7 @@ object SymDenotations {
788788 * So the first call to a stable member might fail and/or produce side effects.
789789 */
790790 final def isStableMember (using Context ): Boolean = {
791- def isUnstableValue = isOneOf(UnstableValueFlags ) || info. isInstanceOf [ ExprType ] || isAllOf(InlineParam )
791+ def isUnstableValue = isOneOf(UnstableValueFlags ) || isAllOf(InlineParam )
792792 isType || is(StableRealizable ) || exists && ! isUnstableValue
793793 }
794794
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ object foo
66
77def test (c : Cap , other : String ): Unit =
88 val x7 : String ^ {c} = ??? // OK
9- val x8 : String @ retains[x7 + x7] = ??? // error
9+ val x8 : String @ retains[( x7 + x7) ] = ??? // error
1010 val x9 : String @ retains[foo] = ??? // error
1111 ()
You can’t perform that action at this time.
0 commit comments