aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index b8f81f1bb..639f5d142 100644
--- a/compiler/src/dotty/tools/dotc/core/Types.scala
+++ b/compiler/src/dotty/tools/dotc/core/Types.scala
@@ -3546,6 +3546,13 @@ object Types {
def apply(tp: Type) = tp
}
+ /** A type map that approximates NoTypes by upper or lower known bounds depending on
+ * variance.
+ *
+ * if variance > 0 : approximate by upper bound
+ * variance < 0 : approximate by lower bound
+ * variance = 0 : propagate NoType to next outer level
+ */
abstract class ApproximatingTypeMap(implicit ctx: Context) extends TypeMap { thisMap =>
def approx(lo: Type = defn.NothingType, hi: Type = defn.AnyType) =
if (variance == 0) NoType