diff options
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 4a3aef2c9..a082f2f43 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2727,7 +2727,7 @@ object Types { case tp @ AnnotatedType(annot, underlying) => val underlying1 = this(underlying) - if (underlying1 eq underlying) tp else underlying1 + if (underlying1 eq underlying) tp else tp.derivedAnnotatedType(mapOver(annot), underlying1) case tp @ WildcardType => tp.derivedWildcardType(mapOver(tp.optBounds)) diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 05be46f29..8f08c19f9 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -99,6 +99,7 @@ trait Inferencing { this: Checking => /** Recursively widen and also follow type declarations and type aliases. */ def widenForMatchSelector(tp: Type)(implicit ctx: Context): Type = tp.widen match { case tp: TypeRef if !tp.symbol.isClass => widenForMatchSelector(tp.info.bounds.hi) + case tp: AnnotatedType => tp.derivedAnnotatedType(tp.annot, widenForMatchSelector(tp.tpe)) case tp => tp } |