@@ -110,7 +110,7 @@ object root:
110
110
" "
111
111
112
112
enum Kind :
113
- case Result (binder : MethodType )
113
+ case Result (binder : MethodicType )
114
114
case Fresh (hidden : CaptureSet .HiddenSet )(val origin : Origin )
115
115
case Global
116
116
@@ -134,14 +134,14 @@ object root:
134
134
ccs.rootId += 1
135
135
ccs.rootId
136
136
137
- // assert(id != 4)
137
+ // assert(id != 4, kind )
138
138
139
139
override def symbol (using Context ) = defn.RootCapabilityAnnot
140
140
override def tree (using Context ) = New (symbol.typeRef, Nil )
141
141
override def derivedAnnotation (tree : Tree )(using Context ): Annotation = this
142
142
143
143
private var myOriginalKind = kind
144
- def originalBinder : MethodType = myOriginalKind.asInstanceOf [Kind .Result ].binder
144
+ def originalBinder : MethodicType = myOriginalKind.asInstanceOf [Kind .Result ].binder
145
145
146
146
def derivedAnnotation (binder : MethodType )(using Context ): Annotation = kind match
147
147
case Kind .Result (b) if b ne binder =>
@@ -198,13 +198,13 @@ object root:
198
198
type Result = AnnotatedType
199
199
200
200
object Result :
201
- def apply (binder : MethodType )(using Context ): Result =
201
+ def apply (binder : MethodicType )(using Context ): Result =
202
202
val hiddenSet = CaptureSet .HiddenSet (NoSymbol )
203
203
val res = AnnotatedType (cap, Annot (Kind .Result (binder)))
204
204
hiddenSet.owningCap = res
205
205
res
206
206
207
- def unapply (tp : Result )(using Context ): Option [MethodType ] = tp.annot match
207
+ def unapply (tp : Result )(using Context ): Option [MethodicType ] = tp.annot match
208
208
case Annot (Kind .Result (binder)) => Some (binder)
209
209
case _ => None
210
210
end Result
@@ -298,7 +298,7 @@ object root:
298
298
* variable bound by `mt`.
299
299
* Stop at function or method types since these have been mapped before.
300
300
*/
301
- def toResult (tp : Type , mt : MethodType , fail : Message => Unit )(using Context ): Type =
301
+ def toResult (tp : Type , mt : MethodicType , fail : Message => Unit )(using Context ): Type =
302
302
303
303
abstract class CapMap extends BiTypeMap :
304
304
override def mapOver (t : Type ): Type = t match
@@ -356,7 +356,7 @@ object root:
356
356
end toResult
357
357
358
358
/** Map global roots in function results to result roots */
359
- def toResultInResults (fail : Message => Unit , keepAliases : Boolean = false )(using Context ): TypeMap = new TypeMap with FollowAliasesMap :
359
+ def toResultInResults (sym : Symbol , fail : Message => Unit , keepAliases : Boolean = false )(using Context ): TypeMap = new TypeMap with FollowAliasesMap :
360
360
def apply (t : Type ): Type = t match
361
361
case defn.RefinedFunctionOf (mt) =>
362
362
val mt1 = apply(mt)
@@ -369,6 +369,8 @@ object root:
369
369
t.derivedCapturingType(this (parent), refs)
370
370
case t : (LazyRef | TypeVar ) =>
371
371
mapConserveSuper(t)
372
+ case t : ExprType if sym.is(Method , butNot = Accessor ) =>
373
+ t.derivedExprType(toResult(t.resType, t, fail))
372
374
case _ =>
373
375
try
374
376
if keepAliases then mapOver(t)
0 commit comments