aboutsummaryrefslogtreecommitdiff
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
parent5d02fe14e07a66ab219258565b10ff51baada5a0 (diff)
downloaddotty-d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0.tar.gz
dotty-d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0.tar.bz2
dotty-d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0.zip
Improve doc comments
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 33258b6b6..f24c41ee2 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -386,7 +386,7 @@ object SymDenotations {
/** Is symbol a primitive value class? */
def isPrimitiveValueClass(implicit ctx: Context) = defn.ScalaValueClasses contains symbol
- /** Is symbol a primitive value class? */
+ /** Is symbol a primitive numeric value class? */
def isNumericValueClass(implicit ctx: Context) = defn.ScalaNumericValueClasses contains symbol
/** Is symbol a phantom class for which no runtime representation exists? */
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)
}