Skip to content

Commit 976cc9d

Browse files
committed
Move FollowAliasesMap from CaptureOps to Types
1 parent 7439414 commit 976cc9d

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
@@ -637,19 +637,6 @@ class CleanupRetains(using Context) extends TypeMap:
637637
RetainingType(tp, Nil, byName = annot.symbol == defn.RetainsByNameAnnot)
638638
case _ => mapOver(tp)
639639

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

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

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

61316131
end BiTypeMap
61326132

6133+
/** A typemap that follows aliases and keeps their transformed results if
6134+
* there is a change.
6135+
*/
6136+
trait FollowAliasesMap(using Context) extends TypeMap:
6137+
def mapFollowingAliases(t: Type): Type =
6138+
val t1 = t.dealiasKeepAnnots
6139+
if t1 ne t then
6140+
val t2 = apply(t1)
6141+
if t2 ne t1 then t2
6142+
else t
6143+
else mapOver(t)
6144+
61336145
abstract class TypeMap(implicit protected var mapCtx: Context)
61346146
extends VariantTraversal with (Type => Type) { thisMap =>
61356147

0 commit comments

Comments
 (0)