diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-04 16:30:11 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-04 16:30:11 +0100 |
commit | 6778e3c74ff86c0174e84bb3df08af47931ecbbb (patch) | |
tree | f1526d2fa05da7349d21e3abb7c01721047ca943 /src/dotty/tools/dotc/core/TypeOps.scala | |
parent | 8efdbdc9843f66fbb8fc39aa2716da0fe7187fd9 (diff) | |
download | dotty-6778e3c74ff86c0174e84bb3df08af47931ecbbb.tar.gz dotty-6778e3c74ff86c0174e84bb3df08af47931ecbbb.tar.bz2 dotty-6778e3c74ff86c0174e84bb3df08af47931ecbbb.zip |
Slight optimization
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 28730fec9..e85bd335a 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -280,19 +280,21 @@ trait TypeOps { this: Context => // TODO: Make standalone object. * or to make them equal, by instantiating uninstantiated type variables. */ def homogenizedUnion(tp1: Type, tp2: Type): Type = { - def fitInto(tp1: Type, tp2: Type): Unit = tp1 match { + tp1 match { case tp1: TypeBounds => tp2 match { case tp2: TypeBounds => - val nestedCtx = ctx.fresh.setNewTyperState - if (tp2.boundsInterval.contains(tp1.boundsInterval)(nestedCtx)) - nestedCtx.typerState.commit() + def fitInto(tp1: TypeBounds, tp2: TypeBounds): Unit = { + val nestedCtx = ctx.fresh.setNewTyperState + if (tp2.boundsInterval.contains(tp1.boundsInterval)(nestedCtx)) + nestedCtx.typerState.commit() + } + fitInto(tp1, tp2) + fitInto(tp2, tp1) case _ => } case _ => } - fitInto(tp1, tp2) - fitInto(tp2, tp1) tp1 | tp2 } |