Skip to content

Commit 7c1e76d

Browse files
committed
Get rid of TypeBounds.onAlias
This was the last bit that tested for the fragile `lo eq hi` condition.
1 parent 4a4b310 commit 7c1e76d

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,9 +2483,6 @@ object Types {
24832483
object TypeBounds {
24842484
def apply(lo: Type, hi: Type)(implicit ctx: Context): TypeBounds =
24852485
unique(new RealTypeBounds(lo, hi))
2486-
def orAlias(lo: Type, hi: Type)(implicit ctx: Context): TypeBounds =
2487-
if (lo eq hi) TypeAlias(lo, 0)
2488-
else unique(new RealTypeBounds(lo, hi))
24892486
def empty(implicit ctx: Context) = apply(defn.NothingType, defn.AnyType)
24902487
def upper(hi: Type)(implicit ctx: Context) = apply(defn.NothingType, hi)
24912488
def lower(lo: Type)(implicit ctx: Context) = apply(lo, defn.AnyType)

src/dotty/tools/dotc/core/pickling/UnPickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot:
656656
if (sym == defn.ByNameParamClass2x) ExprType(args.head)
657657
else tycon.appliedTo(args)
658658
case TYPEBOUNDStpe =>
659-
TypeBounds.orAlias(readTypeRef(), readTypeRef())
659+
TypeBounds(readTypeRef(), readTypeRef())
660660
case REFINEDtpe =>
661661
val clazz = readSymbolRef()
662662
val decls = symScope(clazz)

src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ trait TypeAssigner {
355355
tree.withType(ExprType(result.tpe))
356356

357357
def assignType(tree: untpd.TypeBoundsTree, lo: Tree, hi: Tree)(implicit ctx: Context) =
358-
tree.withType(TypeBounds.orAlias(lo.tpe, hi.tpe))
358+
tree.withType(if (lo eq hi) TypeAlias(lo.tpe) else TypeBounds(lo.tpe, hi.tpe))
359359

360360
def assignType(tree: untpd.Bind, sym: TermSymbol)(implicit ctx: Context) =
361361
tree.withType(TermRef(NoPrefix, sym))

0 commit comments

Comments
 (0)