aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-28 13:00:28 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-31 14:52:08 +0200
commitad437d8fa9bd4127889569952ae6fdb048d2b1ec (patch)
tree319a0b0566a6f43733aea0d2d52898d76015382a /src/dotty/tools/dotc/transform/TypeTestsCasts.scala
parentc62d021cdcc0a3dda6daffd74daf8eaf48aeae88 (diff)
downloaddotty-ad437d8fa9bd4127889569952ae6fdb048d2b1ec.tar.gz
dotty-ad437d8fa9bd4127889569952ae6fdb048d2b1ec.tar.bz2
dotty-ad437d8fa9bd4127889569952ae6fdb048d2b1ec.zip
Make primitive conversions work also for non-numeric types
If the arguments to a primitive conversion are not both numbers, the conversion will either return the argument itself, or throw a ClassCastException.
Diffstat (limited to 'src/dotty/tools/dotc/transform/TypeTestsCasts.scala')
-rw-r--r--src/dotty/tools/dotc/transform/TypeTestsCasts.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 1c453750e..48a377c02 100644
--- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
+++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
@@ -81,7 +81,7 @@ class TypeTestsCasts extends TreeTransform {
Typed(qual, tree.args.head)
else if (qualCls.isPrimitiveValueClass) {
val argCls = argType.classSymbol
- if (argCls.isPrimitiveValueClass) numericConversion(qual, argCls)
+ if (argCls.isPrimitiveValueClass) primitiveConversion(qual, argCls)
else derivedTree(box(qual), defn.Object_asInstanceOf)
}
else