diff options
author | Martin Odersky <odersky@gmail.com> | 2014-12-09 16:26:18 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-12-10 18:54:02 +0100 |
commit | b1b76515a66d94e9552f3ccde02cb4d1bacbc0ec (patch) | |
tree | cf25808e742e884631174e989133413214d6248d /src/dotty/tools/dotc/typer | |
parent | 176d677258051fd1eef1d1bf26575919cab03530 (diff) | |
download | dotty-b1b76515a66d94e9552f3ccde02cb4d1bacbc0ec.tar.gz dotty-b1b76515a66d94e9552f3ccde02cb4d1bacbc0ec.tar.bz2 dotty-b1b76515a66d94e9552f3ccde02cb4d1bacbc0ec.zip |
Moved derivedTypeAlias method to TypeAlias
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 38 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ProtoTypes.scala | 4 |
2 files changed, 20 insertions, 22 deletions
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index 17cba1373..60f5372bb 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -63,26 +63,24 @@ object Checking { * break direct cycle with a LazyRef for legal, F-bounded cycles. */ def checkInfo(tp: Type): Type = tp match { + case tp @ TypeAlias(alias) => + try tp.derivedTypeAlias(apply(alias)) + finally { + where = "alias" + lastChecked = alias + } case tp @ TypeBounds(lo, hi) => - if (lo eq hi) - try tp.derivedTypeAlias(apply(lo)) - finally { - where = "alias" - lastChecked = lo - } - else { - val lo1 = try apply(lo) finally { - where = "lower bound" - lastChecked = lo - } - val saved = nestedCycleOK - nestedCycleOK = true - try tp.derivedTypeBounds(lo1, apply(hi)) - finally { - nestedCycleOK = saved - where = "upper bound" - lastChecked = hi - } + val lo1 = try apply(lo) finally { + where = "lower bound" + lastChecked = lo + } + val saved = nestedCycleOK + nestedCycleOK = true + try tp.derivedTypeBounds(lo1, apply(hi)) + finally { + nestedCycleOK = saved + where = "upper bound" + lastChecked = hi } case _ => tp @@ -277,7 +275,7 @@ trait Checking { tp.derivedRefinedType(tp.parent, tp.refinedName, checkFeasible(tp.refinedInfo, pos, where)) case tp @ TypeBounds(lo, hi) if !(lo <:< hi) => ctx.error(d"no type exists between low bound $lo and high bound $hi$where", pos) - tp.derivedTypeAlias(hi) + TypeAlias(hi) case _ => tp } diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala index 8d29916fa..98300f0b0 100644 --- a/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -373,8 +373,8 @@ object ProtoTypes { else tp.derivedSelect(wildApprox(tp.prefix, theMap)) case tp: RefinedType => // default case, inlined for speed tp.derivedRefinedType(wildApprox(tp.parent, theMap), tp.refinedName, wildApprox(tp.refinedInfo, theMap)) - case tp: TypeBounds if tp.lo eq tp.hi => // default case, inlined for speed - tp.derivedTypeAlias(wildApprox(tp.lo, theMap)) + case tp: TypeAlias => // default case, inlined for speed + tp.derivedTypeAlias(wildApprox(tp.alias, theMap)) case tp @ PolyParam(poly, pnum) => ctx.typerState.constraint.at(tp) match { case bounds: TypeBounds => wildApprox(WildcardType(bounds)) |