From 9a6f82b2ecfd7462d0a1f4e0464878fd58231277 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 31 Jan 2016 14:03:26 +0100 Subject: Reorganize tests to account for new typing of projection Tests with failed projections are moved to pos-scala2, which was renamed from pos-special. Files in pos-scala2 are compiled with -language:Scala2 option. --- src/dotty/tools/dotc/core/TypeOps.scala | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/dotty/tools/dotc/core/TypeOps.scala') diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 26ce4ebf8..9fcc6abbc 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -435,7 +435,10 @@ trait TypeOps { this: Context => // TODO: Make standalone object. /** The realizability status of given type `tp`*/ def realizability(tp: Type): Realizability = tp.dealias match { case tp: TermRef => - if (tp.symbol.isRealizable) Realizable else NotStable + if (tp.symbol.isRealizable) Realizable + else if (!tp.symbol.isStable) NotStable + else if (!tp.symbol.isEffectivelyFinal) new NotFinal(tp.symbol) + else new ProblemInUnderlying(tp.info, realizability(tp.info)) case _: SingletonType | NoPrefix => Realizable case tp => @@ -684,10 +687,16 @@ object TypeOps { object Realizable extends Realizability("") - object NotConcrete extends Realizability("is not a concrete type") + object NotConcrete extends Realizability("it is not a concrete type") - object NotStable extends Realizability("is not a stable reference") + object NotStable extends Realizability("it is not a stable reference") + + class NotFinal(sym: Symbol)(implicit ctx: Context) + extends Realizability(i"it refers to nonfinal $sym") class HasProblemBounds(mbr: SingleDenotation)(implicit ctx: Context) - extends Realizability(i"has a member $mbr with possibly empty bounds ${mbr.info.bounds.lo} .. ${mbr.info.bounds.hi}") + extends Realizability(i"it has a member $mbr with possibly conflicting bounds ${mbr.info.bounds.lo} <: ... <: ${mbr.info.bounds.hi}") + + class ProblemInUnderlying(tp: Type, problem: Realizability)(implicit ctx: Context) + extends Realizability(i"its underlying type ${tp} ${problem.msg}") } -- cgit v1.2.3