Skip to content

Commit 211fe56

Browse files
committed
More cases of handling AnnotatedTypes transparently
This fixes the i0091-infpaths test
1 parent a90eaae commit 211fe56

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ object SymDenotations {
573573
!( this.isTerm
574574
|| this.isStaticOwner
575575
|| ctx.erasedTypes
576-
|| (pre eq NoPrefix) || (pre eq thisType)
576+
|| (pre.stripAnnots eq NoPrefix) || (pre.stripAnnots eq thisType.stripAnnots)
577577
)
578578

579579
/** Is this symbol concrete, or that symbol deferred? */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ object Types {
415415
case tp: TypeRef =>
416416
tp.denot.findMember(name, pre, excluded)
417417
case tp: TermRef =>
418-
go (tp.underlying match {
418+
go (tp.underlying.stripAnnots match {
419419
case mt: MethodType
420420
if mt.paramTypes.isEmpty && (tp.symbol is Stable) => mt.resultType
421421
case tp1 => tp1

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object Checking {
6262
/** Check info `tp` for cycles. Throw CyclicReference for illegal cycles,
6363
* break direct cycle with a LazyRef for legal, F-bounded cycles.
6464
*/
65-
def checkInfo(tp: Type): Type = tp match {
65+
def checkInfo(tp: Type): Type = tp.stripAnnots match {
6666
case tp @ TypeAlias(alias) =>
6767
try tp.derivedTypeAlias(apply(alias))
6868
finally {
@@ -102,7 +102,7 @@ object Checking {
102102
// to symbol `sym` itself. We only check references with interesting
103103
// prefixes for cycles. This pruning is done in order not to force
104104
// global symbols when doing the cyclicity check.
105-
def isInteresting(prefix: Type): Boolean = prefix.stripTypeVar match {
105+
def isInteresting(prefix: Type): Boolean = prefix.stripTypeVar.stripAnnots match {
106106
case NoPrefix => true
107107
case prefix: ThisType => sym.owner.isClass && prefix.cls.isContainedIn(sym.owner)
108108
case prefix: NamedType => !prefix.symbol.isStaticOwner && isInteresting(prefix.prefix)
@@ -246,7 +246,7 @@ trait Checking {
246246
* @return `tp` itself if it is a class or trait ref, ObjectClass.typeRef if not.
247247
*/
248248
def checkClassTypeWithStablePrefix(tp: Type, pos: Position, traitReq: Boolean)(implicit ctx: Context): Type =
249-
tp.underlyingClassRef(refinementOK = false) match {
249+
tp.underlyingClassRef(refinementOK = false).stripAnnots match {
250250
case tref: TypeRef =>
251251
if (ctx.phase <= ctx.refchecksPhase) checkStable(tref.prefix, pos)
252252
if (traitReq && !(tref.symbol is Trait)) ctx.error(d"$tref is not a trait", pos)
@@ -270,7 +270,7 @@ trait Checking {
270270
* their lower bound conforms to their upper cound. If a type argument is
271271
* infeasible, issue and error and continue with upper bound.
272272
*/
273-
def checkFeasible(tp: Type, pos: Position, where: => String = "")(implicit ctx: Context): Type = tp match {
273+
def checkFeasible(tp: Type, pos: Position, where: => String = "")(implicit ctx: Context): Type = tp.stripAnnots match {
274274
case tp: RefinedType =>
275275
tp.derivedRefinedType(tp.parent, tp.refinedName, checkFeasible(tp.refinedInfo, pos, where))
276276
case tp @ TypeBounds(lo, hi) if !(lo <:< hi) =>
@@ -310,7 +310,7 @@ trait Checking {
310310
}
311311

312312
cls.info.decls.foreach(checkDecl)
313-
cls.info match {
313+
cls.info.stripAnnots match {
314314
case ClassInfo(_, _, _, _, selfSym: Symbol) => checkDecl(selfSym)
315315
case _ =>
316316
}

0 commit comments

Comments
 (0)