Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Hashable.*
import Uniques.*
import collection.mutable
import config.Config
import config.Feature
import config.Feature.sourceVersion
import config.SourceVersion
import annotation.{tailrec, constructorOnly}
Expand Down Expand Up @@ -6279,12 +6280,12 @@ object Types extends TypeUtils {

end BiTypeMap

/** A typemap that follows aliases and keeps their transformed results if
* there is a change.
*/
/** A typemap that follows non-opaque aliases and keeps their transformed
* results if there is a change.
*/
trait FollowAliasesMap(using Context) extends TypeMap:
def mapFollowingAliases(t: Type): Type =
val t1 = t.dealiasKeepAnnots
val t1 = t.dealiasKeepAnnotsAndOpaques
if t1 ne t then
val t2 = apply(t1)
if t2 ne t1 then t2
Expand Down Expand Up @@ -6483,10 +6484,13 @@ object Types extends TypeUtils {
mapCapturingType(tp, parent, refs, variance)

case tp @ AnnotatedType(underlying, annot) =>
val underlying1 = this(underlying)
val annot1 = annot.mapWith(this)
if annot1 eq EmptyAnnotation then underlying1
else derivedAnnotatedType(tp, underlying1, annot1)
if annot.symbol.isRetainsLike && !Feature.ccEnabledSomewhere then
this(underlying) // strip retains like annotations unless capture checking is enabled
else
val underlying1 = this(underlying)
val annot1 = annot.mapWith(this)
if annot1 eq EmptyAnnotation then underlying1
else derivedAnnotatedType(tp, underlying1, annot1)

case _: ThisType
| _: BoundType
Expand Down
Loading