From e8c27da5855f59574ba00cb1a95be8fb36b1fb48 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 12 Mar 2017 16:34:59 +0100 Subject: Comment ApproximatingTypeMap --- compiler/src/dotty/tools/dotc/core/Types.scala | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3