Skip to content

Commit ccea23d

Browse files
committed
Move FollowAliasesMap from CaptureOps to Types
1 parent f3ba302 commit ccea23d

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -639,19 +639,6 @@ class CleanupRetains(using Context) extends TypeMap:
639639
RetainingType(tp, Nil, byName = annot.symbol == defn.RetainsByNameAnnot)
640640
case _ => mapOver(tp)
641641

642-
/** A typemap that follows aliases and keeps their transformed results if
643-
* there is a change.
644-
*/
645-
trait FollowAliasesMap(using Context) extends TypeMap:
646-
var follow = true // Used for debugging so that we can compare results with and w/o following.
647-
def mapFollowingAliases(t: Type): Type =
648-
val t1 = t.dealiasKeepAnnots
649-
if follow && (t1 ne t) then
650-
val t2 = apply(t1)
651-
if t2 ne t1 then t2
652-
else t
653-
else mapOver(t)
654-
655642
/** An extractor for `caps.reachCapability(ref)`, which is used to express a reach
656643
* capability as a tree in a @retains annotation.
657644
*/

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6168,6 +6168,18 @@ object Types extends TypeUtils {
61686168

61696169
end BiTypeMap
61706170

6171+
/** A typemap that follows aliases and keeps their transformed results if
6172+
* there is a change.
6173+
*/
6174+
trait FollowAliasesMap(using Context) extends TypeMap:
6175+
def mapFollowingAliases(t: Type): Type =
6176+
val t1 = t.dealiasKeepAnnots
6177+
if t1 ne t then
6178+
val t2 = apply(t1)
6179+
if t2 ne t1 then t2
6180+
else t
6181+
else mapOver(t)
6182+
61716183
abstract class TypeMap(implicit protected var mapCtx: Context)
61726184
extends VariantTraversal with (Type => Type) { thisMap =>
61736185

0 commit comments

Comments
 (0)