aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-03 15:28:51 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-03 15:28:51 +0100
commit2023b940f0ec91705d9fd8017fa08d59aa11ac99 (patch)
treefa099bb13e7174c5fbe906fab50ba6ca6aacd30f /src/dotty/tools/dotc/core/Types.scala
parentc81a21a8ecc690813bbe4eaece0640f262434f84 (diff)
downloaddotty-2023b940f0ec91705d9fd8017fa08d59aa11ac99.tar.gz
dotty-2023b940f0ec91705d9fd8017fa08d59aa11ac99.tar.bz2
dotty-2023b940f0ec91705d9fd8017fa08d59aa11ac99.zip
Making namedPartsWith more robust.
When called from implicitScope, we formed an AndType with a WildcardType. No problem, except that this broke the AndType assertion. The assertion is not needed for this sepcial case.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index a3639cbde..8fe813e4d 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1385,7 +1385,6 @@ object Types {
}
abstract case class AndType(tp1: Type, tp2: Type) extends CachedGroundType with AndOrType {
- assert(tp1.isInstanceOf[ValueType] && tp2.isInstanceOf[ValueType], s"$tp1 & $tp2")
def derivedAndType(tp1: Type, tp2: Type)(implicit ctx: Context) =
if ((tp1 eq this.tp1) && (tp2 eq this.tp2)) this
@@ -1397,8 +1396,13 @@ object Types {
final class CachedAndType(tp1: Type, tp2: Type) extends AndType(tp1, tp2)
object AndType {
- def apply(tp1: Type, tp2: Type)(implicit ctx: Context) =
+ def apply(tp1: Type, tp2: Type)(implicit ctx: Context) = {
+ assert(tp1.isInstanceOf[ValueType] && tp2.isInstanceOf[ValueType], s"$tp1 & $tp2")
+ unchecked(tp1, tp2)
+ }
+ def unchecked(tp1: Type, tp2: Type)(implicit ctx: Context) = {
unique(new CachedAndType(tp1, tp2))
+ }
}
abstract case class OrType(tp1: Type, tp2: Type) extends CachedGroundType with AndOrType {