@@ -703,14 +703,6 @@ object Capabilities:
703
703
(this eq y)
704
704
|| this .match
705
705
case x : FreshCap =>
706
- def levelOK =
707
- if ccConfig.useFreshLevels && ! CCState .collapseFresh then
708
- val yOwner = y.levelOwner
709
- yOwner.isStaticOwner || x.ccOwner.isContainedIn(yOwner)
710
- else y.core match
711
- case ResultCap (_) | _ : ParamRef => false
712
- case _ => true
713
-
714
706
vs.ifNotSeen(this )(x.hiddenSet.elems.exists(_.subsumes(y)))
715
707
|| x.acceptsLevelOf(y)
716
708
&& ( y.tryClassifyAs(x.hiddenSet.classifier)
@@ -1017,69 +1009,6 @@ object Capabilities:
1017
1009
def inverse = Inverse ()
1018
1010
end Internalize
1019
1011
1020
- /** The local dual of a result type of a closure type.
1021
- * @param binder the method type of the anonymous function whose result is mapped
1022
- * @pre the context's owner is the anonymous function
1023
- */
1024
- class Internalize (binder : MethodType )(using Context ) extends BiTypeMap :
1025
- thisMap =>
1026
-
1027
- val sym = ctx.owner
1028
- assert(sym.isAnonymousFunction)
1029
- val paramSyms = atPhase(ctx.phase.prev):
1030
- // We need to ask one phase before since `sym` should not be completed as a side effect.
1031
- // The result of Internalize is used to se the result type of an anonymous function, and
1032
- // the new info of that function is built with the result.
1033
- sym.paramSymss.head
1034
- val resultToFresh = EqHashMap [ResultCap , FreshCap ]()
1035
- val freshToResult = EqHashMap [FreshCap , ResultCap ]()
1036
-
1037
- override def apply (t : Type ) =
1038
- if variance < 0 then t
1039
- else t match
1040
- case t : ParamRef =>
1041
- if t.binder == this .binder then paramSyms(t.paramNum).termRef else t
1042
- case _ => mapOver(t)
1043
-
1044
- override def mapCapability (c : Capability , deep : Boolean ): Capability = c match
1045
- case r : ResultCap if r.binder == this .binder =>
1046
- resultToFresh.get(r) match
1047
- case Some (f) => f
1048
- case None =>
1049
- val f = FreshCap (Origin .LocalInstance (binder.resType))
1050
- resultToFresh(r) = f
1051
- freshToResult(f) = r
1052
- f
1053
- case _ =>
1054
- super .mapCapability(c, deep)
1055
-
1056
- class Inverse extends BiTypeMap :
1057
- def apply (t : Type ): Type =
1058
- if variance < 0 then t
1059
- else t match
1060
- case t : TermRef if paramSyms.contains(t) =>
1061
- binder.paramRefs(paramSyms.indexOf(t.symbol))
1062
- case _ => mapOver(t)
1063
-
1064
- override def mapCapability (c : Capability , deep : Boolean ): Capability = c match
1065
- case f : FreshCap if f.owner == sym =>
1066
- freshToResult.get(f) match
1067
- case Some (r) => r
1068
- case None =>
1069
- val r = ResultCap (binder)
1070
- resultToFresh(r) = f
1071
- freshToResult(f) = r
1072
- r
1073
- case _ => super .mapCapability(c, deep)
1074
-
1075
- def inverse = thisMap
1076
- override def toString = thisMap.toString + " .inverse"
1077
- end Inverse
1078
-
1079
- override def toString = " InternalizeClosureResult"
1080
- def inverse = Inverse ()
1081
- end Internalize
1082
-
1083
1012
/** Map top-level free existential variables one-to-one to Fresh instances */
1084
1013
def resultToFresh (tp : Type , origin : Origin )(using Context ): Type =
1085
1014
val subst = new TypeMap :
0 commit comments