diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-01 00:08:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-09 09:43:07 +0100 |
commit | defba2af7c3b49231962a6f882173bcaff914fcc (patch) | |
tree | 16149a87ac1422d5eac51e4e563f56eda743562c /src/dotty/tools/dotc/core/TypeOps.scala | |
parent | 3637e08033c857e19862ae1fc9730d96cdba3fe2 (diff) | |
download | dotty-defba2af7c3b49231962a6f882173bcaff914fcc.tar.gz dotty-defba2af7c3b49231962a6f882173bcaff914fcc.tar.bz2 dotty-defba2af7c3b49231962a6f882173bcaff914fcc.zip |
Check that non-abstract classes have realizable bounds.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 882ab9f10..227dbb90f 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -449,16 +449,21 @@ trait TypeOps { this: Context => // TODO: Make standalone object. case _ => false } if (!isConcrete(tp)) NotConcrete - else { - def hasBadBounds(mbr: SingleDenotation) = { - val bounds = mbr.info.bounds - !(bounds.lo <:< bounds.hi) - } - tp.nonClassTypeMembers.find(hasBadBounds) match { - case Some(mbr) => new HasProblemBounds(mbr) - case _ => Realizable - } - } + else boundsRealizability(tp) + } + + /** `Realizable` is `tp` has good bounds, a `HasProblemBounds` instance + * pointing to a bad bounds member otherwise. + */ + def boundsRealizability(tp: Type)(implicit ctx: Context) = { + def hasBadBounds(mbr: SingleDenotation) = { + val bounds = mbr.info.bounds + !(bounds.lo <:< bounds.hi) + } + tp.nonClassTypeMembers.find(hasBadBounds) match { + case Some(mbr) => new HasProblemBounds(mbr) + case _ => Realizable + } } private def enterArgBinding(formal: Symbol, info: Type, cls: ClassSymbol, decls: Scope) = { |