diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-12 16:34:59 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-03-12 16:34:59 +0100 |
commit | e8c27da5855f59574ba00cb1a95be8fb36b1fb48 (patch) | |
tree | 7f091380f830ffe53fdff9ef0e853797c39fb6a0 | |
parent | 00034a2a8c91f3e83b3a2518cc7c944c66ffab3f (diff) | |
download | dotty-e8c27da5855f59574ba00cb1a95be8fb36b1fb48.tar.gz dotty-e8c27da5855f59574ba00cb1a95be8fb36b1fb48.tar.bz2 dotty-e8c27da5855f59574ba00cb1a95be8fb36b1fb48.zip |
Comment ApproximatingTypeMap
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Types.scala | 7 |
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 |