@@ -344,16 +344,17 @@ trait Checking {
344
344
ctx.error(i " $tp cannot be instantiated since it ${rstatus.msg}" , pos)
345
345
}
346
346
347
- /** Check that `tp` is a class type with a stable prefix. Also, if `traitReq` is
348
- * true check that `tp` is a trait.
349
- * Stability checking is disabled in phases after RefChecks.
347
+ /** Check that `tp` is a class type.
348
+ * Also, if `traitReq` is true, check that `tp` is a trait.
349
+ * Also, if `stablePrefixReq` is true and phase is not after RefChecks,
350
+ * check that class prefix is stable.
350
351
* @return `tp` itself if it is a class or trait ref, ObjectType if not.
351
352
*/
352
- def checkClassTypeWithStablePrefix (tp : Type , pos : Position , traitReq : Boolean )(implicit ctx : Context ): Type =
353
+ def checkClassType (tp : Type , pos : Position , traitReq : Boolean , stablePrefixReq : Boolean )(implicit ctx : Context ): Type =
353
354
tp.underlyingClassRef(refinementOK = false ) match {
354
355
case tref : TypeRef =>
355
- if (ctx.phase <= ctx.refchecksPhase) checkStable(tref.prefix, pos)
356
356
if (traitReq && ! (tref.symbol is Trait )) ctx.error(d " $tref is not a trait " , pos)
357
+ if (stablePrefixReq && ctx.phase <= ctx.refchecksPhase) checkStable(tref.prefix, pos)
357
358
tp
358
359
case _ =>
359
360
ctx.error(d " $tp is not a class type " , pos)
@@ -456,7 +457,7 @@ trait NoChecking extends Checking {
456
457
override def checkNonCyclic (sym : Symbol , info : TypeBounds , reportErrors : Boolean )(implicit ctx : Context ): Type = info
457
458
override def checkValue (tree : Tree , proto : Type )(implicit ctx : Context ): tree.type = tree
458
459
override def checkStable (tp : Type , pos : Position )(implicit ctx : Context ): Unit = ()
459
- override def checkClassTypeWithStablePrefix (tp : Type , pos : Position , traitReq : Boolean )(implicit ctx : Context ): Type = tp
460
+ override def checkClassType (tp : Type , pos : Position , traitReq : Boolean , stablePrefixReq : Boolean )(implicit ctx : Context ): Type = tp
460
461
override def checkImplicitParamsNotSingletons (vparamss : List [List [ValDef ]])(implicit ctx : Context ): Unit = ()
461
462
override def checkFeasible (tp : Type , pos : Position , where : => String = " " )(implicit ctx : Context ): Type = tp
462
463
override def checkNoDoubleDefs (cls : Symbol )(implicit ctx : Context ): Unit = ()
0 commit comments