From defba2af7c3b49231962a6f882173bcaff914fcc Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 1 Feb 2016 00:08:26 +0100 Subject: Check that non-abstract classes have realizable bounds. --- src/dotty/tools/dotc/core/TypeOps.scala | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 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 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) = { -- cgit v1.2.3