diff options
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 7a050c412..986a9c292 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2358,6 +2358,8 @@ object Types { object AndType { def apply(tp1: Type, tp2: Type)(implicit ctx: Context) = { assert(tp1.isInstanceOf[ValueType] && tp2.isInstanceOf[ValueType]) + if (Config.checkKinds) + assert((tp1.knownHK - tp2.knownHK).abs <= 1, i"$tp1 & $tp2 / " + s"$tp1 & $tp2") unchecked(tp1, tp2) } def unchecked(tp1: Type, tp2: Type)(implicit ctx: Context) = { @@ -2392,6 +2394,8 @@ object Types { object OrType { def apply(tp1: Type, tp2: Type)(implicit ctx: Context) = { assertUnerased() + if (Config.checkKinds) + assert((tp1.knownHK - tp2.knownHK).abs <= 1, i"$tp1 | $tp2") unique(new CachedOrType(tp1, tp2)) } def make(tp1: Type, tp2: Type)(implicit ctx: Context): Type = |