Skip to content

Commit 8aa9437

Browse files
committed
Move FollowAliasesMap from CaptureOps to Types
1 parent 2c630b7 commit 8aa9437

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

539-
/** A typemap that follows aliases and keeps their transformed results if
540-
* there is a change.
541-
*/
542-
trait FollowAliasesMap(using Context) extends TypeMap:
543-
var follow = true // Used for debugging so that we can compare results with and w/o following.
544-
def mapFollowingAliases(t: Type): Type =
545-
val t1 = t.dealiasKeepAnnots
546-
if follow && (t1 ne t) then
547-
val t2 = apply(t1)
548-
if t2 ne t1 then t2
549-
else t
550-
else mapOver(t)
551-
552539
/** An extractor for `caps.reachCapability(ref)`, which is used to express a reach
553540
* capability as a tree in a @retains annotation.
554541
*/

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

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

61736173
end BiTypeMap
61746174

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

0 commit comments

Comments
 (0)