@@ -146,6 +146,9 @@ object Denotations {
146
146
/** Is this denotation different from NoDenotation or an ErrorDenotation? */
147
147
def exists : Boolean = true
148
148
149
+ /** A denotation with the info of this denotation transformed using `f` */
150
+ def mapInfo (f : Type => Type )(implicit ctx : Context ): Denotation
151
+
149
152
/** If this denotation does not exist, fallback to alternative */
150
153
final def orElse (that : => Denotation ) = if (this .exists) this else that
151
154
@@ -242,7 +245,7 @@ object Denotations {
242
245
}
243
246
else if (exists && ! qualifies(symbol)) NoDenotation
244
247
else asSingleDenotation
245
- }
248
+ }
246
249
247
250
/** Form a denotation by conjoining with denotation `that`.
248
251
*
@@ -456,6 +459,8 @@ object Denotations {
456
459
else if (! d2.exists) d1
457
460
else derivedMultiDenotation(d1, d2)
458
461
}
462
+ def mapInfo (f : Type => Type )(implicit ctx : Context ): Denotation =
463
+ derivedMultiDenotation(denot1.mapInfo(f), denot2.mapInfo(f))
459
464
def derivedMultiDenotation (d1 : Denotation , d2 : Denotation ) =
460
465
if ((d1 eq denot1) && (d2 eq denot2)) this else MultiDenotation (d1, d2)
461
466
override def toString = alternatives.mkString(" <and> " )
@@ -488,6 +493,9 @@ object Denotations {
488
493
if ((symbol eq this .symbol) && (info eq this .info)) this
489
494
else newLikeThis(symbol, info)
490
495
496
+ def mapInfo (f : Type => Type )(implicit ctx : Context ): SingleDenotation =
497
+ derivedSingleDenotation(symbol, f(info))
498
+
491
499
def orElse (that : => SingleDenotation ) = if (this .exists) this else that
492
500
493
501
def altsWith (p : Symbol => Boolean ): List [SingleDenotation ] =
0 commit comments