File tree 2 files changed +7
-1
lines changed 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ object SymDenotations {
386
386
/** Is symbol a primitive value class? */
387
387
def isPrimitiveValueClass (implicit ctx : Context ) = defn.ScalaValueClasses contains symbol
388
388
389
- /** Is symbol a primitive value class? */
389
+ /** Is symbol a primitive numeric value class? */
390
390
def isNumericValueClass (implicit ctx : Context ) = defn.ScalaNumericValueClasses contains symbol
391
391
392
392
/** Is symbol a phantom class for which no runtime representation exists? */
Original file line number Diff line number Diff line change @@ -1057,6 +1057,9 @@ trait Applications extends Compatibility { self: Typer =>
1057
1057
else ts
1058
1058
}
1059
1059
1060
+ /** If `trees` all have numeric value types, and they do not have all the same type,
1061
+ * pick a common numeric supertype and convert all trees to this type.
1062
+ */
1060
1063
def harmonize (trees : List [Tree ])(implicit ctx : Context ): List [Tree ] = {
1061
1064
def adapt (tree : Tree , pt : Type ): Tree = tree match {
1062
1065
case cdef : CaseDef => tpd.cpy.CaseDef (cdef)(body = adapt(cdef.body, pt))
@@ -1065,6 +1068,9 @@ trait Applications extends Compatibility { self: Typer =>
1065
1068
harmonizeWith(trees)(_.tpe, adapt)
1066
1069
}
1067
1070
1071
+ /** If all `types` are numeric value types, and they are not all the same type,
1072
+ * pick a common numeric supertype and return it instead of every original type.
1073
+ */
1068
1074
def harmonizeTypes (tpes : List [Type ])(implicit ctx : Context ): List [Type ] =
1069
1075
harmonizeWith(tpes)(identity, (tp, pt) => pt)
1070
1076
}
You can’t perform that action at this time.
0 commit comments