From d07d669ae03ad4cb5eb8352bcbb5a0be7f3aa0f0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 27 May 2015 19:44:29 +0200 Subject: Improve doc comments --- src/dotty/tools/dotc/core/SymDenotations.scala | 2 +- src/dotty/tools/dotc/typer/Applications.scala | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc') 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) } -- cgit v1.2.3