Skip to content

Commit a4745fd

Browse files
committed
Address review comments
1 parent 984afee commit a4745fd

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ object SymDenotations {
12081208
case tp: LambdaType => tp.paramInfos.exists(hasSkolems) || hasSkolems(tp.resType)
12091209
case tp: AndType => hasSkolems(tp.tp1) || hasSkolems(tp.tp2)
12101210
case tp: OrType => hasSkolems(tp.tp1) || hasSkolems(tp.tp2)
1211-
case tp: AnnotatedType => hasSkolems(tp.tpe)
1211+
case tp: AnnotatedType => hasSkolems(tp.parent)
12121212
case _ => false
12131213
}
12141214

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
237237
case tp2: LazyRef =>
238238
!tp2.evaluating && recur(tp1, tp2.ref)
239239
case tp2: AnnotatedType if !tp2.isRefining =>
240-
recur(tp1, tp2.tpe)
240+
recur(tp1, tp2.parent)
241241
case tp2: ThisType =>
242242
def compareThis = {
243243
val cls2 = tp2.cls
@@ -346,7 +346,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
346346
// See i859.scala for an example where we hit this case.
347347
!tp1.evaluating && recur(tp1.ref, tp2)
348348
case tp1: AnnotatedType if !tp1.isRefining =>
349-
recur(tp1.tpe, tp2)
349+
recur(tp1.parent, tp2)
350350
case AndType(tp11, tp12) =>
351351
if (tp11.stripTypeVar eq tp12.stripTypeVar) recur(tp11, tp2)
352352
else thirdTry
@@ -569,7 +569,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
569569
compareTypeBounds
570570
case tp2: AnnotatedType if tp2.isRefining =>
571571
(tp1.derivesAnnotWith(tp2.annot.sameAnnotation) || defn.isBottomType(tp1)) &&
572-
recur(tp1, tp2.tpe)
572+
recur(tp1, tp2.parent)
573573
case ClassInfo(pre2, cls2, _, _, _) =>
574574
def compareClassInfo = tp1 match {
575575
case ClassInfo(pre1, cls1, _, _, _) =>
@@ -665,7 +665,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
665665
}
666666
either(recur(tp11, tp2), recur(tp12, tp2))
667667
case tp1: AnnotatedType if tp1.isRefining =>
668-
isNewSubType(tp1.tpe)
668+
isNewSubType(tp1.parent)
669669
case JavaArrayType(elem1) =>
670670
def compareJavaArray = tp2 match {
671671
case JavaArrayType(elem2) => isSubType(elem1, elem2)
@@ -705,7 +705,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
705705
}
706706
case tycon1: TypeVar =>
707707
isMatchingApply(tycon1.underlying)
708-
case tycon1: AnnotatedType if !tycon1.isRefining =>
708+
case tycon1: AnnotatedType =>
709709
isMatchingApply(tycon1.underlying)
710710
case _ =>
711711
false

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ object Types {
152152
case _: SingletonType | NoPrefix => true
153153
case tp: RefinedOrRecType => tp.parent.isStable
154154
case tp: ExprType => tp.resultType.isStable
155-
case tp: AnnotatedType => tp.tpe.isStable
155+
case tp: AnnotatedType => tp.parent.isStable
156156
case _ => false
157157
}
158158

@@ -285,7 +285,7 @@ object Types {
285285

286286
/** Does this type have a supertype with an annotation satisfying given predicate `p`? */
287287
def derivesAnnotWith(p: Annotation => Boolean)(implicit ctx: Context): Boolean = this match {
288-
case tp: AnnotatedType => p(tp.annot) || tp.tpe.derivesAnnotWith(p)
288+
case tp: AnnotatedType => p(tp.annot) || tp.parent.derivesAnnotWith(p)
289289
case tp: TypeProxy => tp.superType.derivesAnnotWith(p)
290290
case AndType(l, r) => l.derivesAnnotWith(p) || r.derivesAnnotWith(p)
291291
case OrType(l, r) => l.derivesAnnotWith(p) && r.derivesAnnotWith(p)
@@ -1037,7 +1037,7 @@ object Types {
10371037
val tp1 = tp.instanceOpt
10381038
if (tp1.exists) tp1.dealias1(keep): @tailrec else tp
10391039
case tp: AnnotatedType =>
1040-
val tp1 = tp.tpe.dealias1(keep)
1040+
val tp1 = tp.parent.dealias1(keep)
10411041
if (keep(tp)(ctx)) tp.derivedAnnotatedType(tp1, tp.annot) else tp1
10421042
case tp: LazyRef =>
10431043
tp.ref.dealias1(keep): @tailrec
@@ -3702,19 +3702,19 @@ object Types {
37023702
// ----- Annotated and Import types -----------------------------------------------
37033703

37043704
/** An annotated type tpe @ annot */
3705-
case class AnnotatedType(tpe: Type, annot: Annotation) extends UncachedProxyType with ValueType {
3705+
case class AnnotatedType(parent: Type, annot: Annotation) extends UncachedProxyType with ValueType {
37063706
// todo: cache them? but this makes only sense if annotations and trees are also cached.
37073707

3708-
override def underlying(implicit ctx: Context): Type = tpe
3708+
override def underlying(implicit ctx: Context): Type = parent
37093709

37103710
def derivedAnnotatedType(tpe: Type, annot: Annotation) =
3711-
if ((tpe eq this.tpe) && (annot eq this.annot)) this
3711+
if ((parent eq this.parent) && (annot eq this.annot)) this
37123712
else AnnotatedType(tpe, annot)
37133713

37143714
override def stripTypeVar(implicit ctx: Context): Type =
3715-
derivedAnnotatedType(tpe.stripTypeVar, annot)
3715+
derivedAnnotatedType(parent.stripTypeVar, annot)
37163716

3717-
override def stripAnnots(implicit ctx: Context): Type = tpe.stripAnnots
3717+
override def stripAnnots(implicit ctx: Context): Type = parent.stripAnnots
37183718

37193719
private[this] var isRefiningKnown = false
37203720
private[this] var isRefiningCache: Boolean = _
@@ -3728,7 +3728,7 @@ object Types {
37283728
}
37293729

37303730
override def iso(that: Any, bs: BinderPairs): Boolean = that match {
3731-
case that: AnnotatedType => tpe.equals(that.tpe, bs) && (annot `eq` that.annot)
3731+
case that: AnnotatedType => parent.equals(that.parent, bs) && (annot `eq` that.annot)
37323732
case _ => false
37333733
}
37343734
// equals comes from case class; no matching override is needed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class TreePickler(pickler: TastyPickler) {
236236
withLength { pickleType(tpe.lo, richTypes); pickleType(tpe.hi, richTypes) }
237237
case tpe: AnnotatedType =>
238238
writeByte(ANNOTATEDtype)
239-
withLength { pickleType(tpe.tpe, richTypes); pickleTree(tpe.annot.tree) }
239+
withLength { pickleType(tpe.parent, richTypes); pickleTree(tpe.annot.tree) }
240240
case tpe: AndType =>
241241
writeByte(ANDtype)
242242
withLength { pickleType(tpe.tp1, richTypes); pickleType(tpe.tp2, richTypes) }

compiler/src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class TreeChecker extends Phase with SymTransformer {
302302

303303
/** Check that all methods have MethodicType */
304304
def isMethodType(pt: Type)(implicit ctx: Context): Boolean = pt match {
305-
case at: AnnotatedType => isMethodType(at.tpe)
305+
case at: AnnotatedType => isMethodType(at.parent)
306306
case _: MethodicType => true // MethodType, ExprType, PolyType
307307
case _ => false
308308
}

doc-tool/src/dotty/tools/dottydoc/model/factories.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ object factories {
183183
paramLists(mp.underlying)
184184

185185
case annot: AnnotatedType =>
186-
paramLists(annot.tpe)
186+
paramLists(annot.parent)
187187

188188
case _ =>
189189
Nil // return types should not be in the paramlist

0 commit comments

Comments
 (0)