Skip to content

Commit 537c53b

Browse files
committed
Merge pull request #334 from olhotak/pr-annotatedtypevars
fix TypeMap.mapOver to not drop type annotations
2 parents 433e9cf + ac61c26 commit 537c53b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2727,7 +2727,7 @@ object Types {
27272727

27282728
case tp @ AnnotatedType(annot, underlying) =>
27292729
val underlying1 = this(underlying)
2730-
if (underlying1 eq underlying) tp else underlying1
2730+
if (underlying1 eq underlying) tp else tp.derivedAnnotatedType(mapOver(annot), underlying1)
27312731

27322732
case tp @ WildcardType =>
27332733
tp.derivedWildcardType(mapOver(tp.optBounds))

src/dotty/tools/dotc/typer/Inferencing.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ trait Inferencing { this: Checking =>
9999
/** Recursively widen and also follow type declarations and type aliases. */
100100
def widenForMatchSelector(tp: Type)(implicit ctx: Context): Type = tp.widen match {
101101
case tp: TypeRef if !tp.symbol.isClass => widenForMatchSelector(tp.info.bounds.hi)
102+
case tp: AnnotatedType => tp.derivedAnnotatedType(tp.annot, widenForMatchSelector(tp.tpe))
102103
case tp => tp
103104
}
104105

0 commit comments

Comments
 (0)