aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-01-12 23:00:57 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-05-31 16:53:33 +0200
commit8d0312f69966fbfcfc2f9602ccf660dfe7513885 (patch)
tree884e1b2373e6a7baa22f2affbb14270e4aef2dba /src/dotty/tools/dotc/core/Types.scala
parent5c2a19bfbbb158c809969fa2a9685b5c7e2695ea (diff)
downloaddotty-8d0312f69966fbfcfc2f9602ccf660dfe7513885.tar.gz
dotty-8d0312f69966fbfcfc2f9602ccf660dfe7513885.tar.bz2
dotty-8d0312f69966fbfcfc2f9602ccf660dfe7513885.zip
Avoid creating AndTypes with Any
This reduces the number of implicit scopes we cache.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 42079b4b8..f514a329e 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2145,7 +2145,12 @@ object Types {
unique(new CachedAndType(tp1, tp2))
}
def make(tp1: Type, tp2: Type)(implicit ctx: Context): Type =
- if (tp1 eq tp2) tp1 else apply(tp1, tp2)
+ if ((tp1 eq tp2) || (tp2 eq defn.AnyType))
+ tp1
+ else if (tp1 eq defn.AnyType)
+ tp2
+ else
+ apply(tp1, tp2)
}
abstract case class OrType(tp1: Type, tp2: Type) extends CachedGroundType with AndOrType {