File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
compiler/src/dotty/tools/dotc/cc
tests/neg-custom-args/captures Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,14 @@ object Mutability:
104104 if tp.derivesFrom(defn.Caps_Stateful )
105105 then ctx.owner.inExclusivePartOf(tp.cls)
106106 else Exclusivity .OK
107- case tp @ TermRef (prefix : Capability , _) =>
108- prefix.exclusivityInContext(required).andAlso(tp.exclusivity(required))
107+ case tp : TermRef =>
108+ tp.info match
109+ case tp1 : SingletonType => tp1.exclusivityInContext(required)
110+ case _ =>
111+ val preEx = tp.prefix match
112+ case prefix : Capability => prefix.exclusivityInContext(required)
113+ case _ => Exclusivity .OK
114+ preEx.andAlso(tp.exclusivity(required))
109115 case _ =>
110116 tp.exclusivity(required)
111117
Original file line number Diff line number Diff line change 1+ import caps .*
2+ trait A extends Stateful :
3+ def f () = /* read-only f */
4+ val ref : this .type = this
5+ this .g()
6+ ref.g()
7+
8+ update def g () = ???
You can’t perform that action at this time.
0 commit comments