Skip to content

Commit e8c27da

Browse files
committed
Comment ApproximatingTypeMap
1 parent 00034a2 commit e8c27da

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,6 +3546,13 @@ object Types {
35463546
def apply(tp: Type) = tp
35473547
}
35483548

3549+
/** A type map that approximates NoTypes by upper or lower known bounds depending on
3550+
* variance.
3551+
*
3552+
* if variance > 0 : approximate by upper bound
3553+
* variance < 0 : approximate by lower bound
3554+
* variance = 0 : propagate NoType to next outer level
3555+
*/
35493556
abstract class ApproximatingTypeMap(implicit ctx: Context) extends TypeMap { thisMap =>
35503557
def approx(lo: Type = defn.NothingType, hi: Type = defn.AnyType) =
35513558
if (variance == 0) NoType

0 commit comments

Comments
 (0)