aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-01-31 14:03:26 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-09 09:43:05 +0100
commit9a6f82b2ecfd7462d0a1f4e0464878fd58231277 (patch)
tree8e9e46b08d7fdf45f4b1fd06b30d7e35c43f05b1 /src/dotty/tools/dotc/core/TypeOps.scala
parent44c14b3fb6e5eb6f2b9734f092eef1d85f6b4d18 (diff)
downloaddotty-9a6f82b2ecfd7462d0a1f4e0464878fd58231277.tar.gz
dotty-9a6f82b2ecfd7462d0a1f4e0464878fd58231277.tar.bz2
dotty-9a6f82b2ecfd7462d0a1f4e0464878fd58231277.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala17
1 files changed, 13 insertions, 4 deletions
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}")
}