aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-05-27 19:44:29 +0200
committerMartin Odersky <odersky@gmail.com>2015-05-27 20:08:28 +0200
commitd07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0 (patch)
treebc7ada0d01aa9f88f88f3e115145ae5e9775cb91 /src/dotty/tools/dotc/typer/Applications.scala
parent5d02fe14e07a66ab219258565b10ff51baada5a0 (diff)
downloaddotty-d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0.tar.gz
dotty-d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0.tar.bz2
dotty-d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0.zip
Improve doc comments
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index dadd2afdc..9e9acf97a 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -1057,6 +1057,9 @@ trait Applications extends Compatibility { self: Typer =>
else ts
}
+ /** If `trees` all have numeric value types, and they do not have all the same type,
+ * pick a common numeric supertype and convert all trees to this type.
+ */
def harmonize(trees: List[Tree])(implicit ctx: Context): List[Tree] = {
def adapt(tree: Tree, pt: Type): Tree = tree match {
case cdef: CaseDef => tpd.cpy.CaseDef(cdef)(body = adapt(cdef.body, pt))
@@ -1065,6 +1068,9 @@ trait Applications extends Compatibility { self: Typer =>
harmonizeWith(trees)(_.tpe, adapt)
}
+ /** If all `types` are numeric value types, and they are not all the same type,
+ * pick a common numeric supertype and return it instead of every original type.
+ */
def harmonizeTypes(tpes: List[Type])(implicit ctx: Context): List[Type] =
harmonizeWith(tpes)(identity, (tp, pt) => pt)
}