Fix for KT-14868: CCE in runtime while converting Number to Char

#KT-14868 Fixed
This commit is contained in:
Mikhael Bogdanov
2016-12-20 10:38:23 +01:00
parent ce333b0a58
commit ef825a7559
7 changed files with 36 additions and 2 deletions
@@ -405,11 +405,12 @@ public abstract class StackValue {
coerce(unboxedType, toType, v);
}
else {
if (toType.getSort() == Type.BOOLEAN || toType.getSort() == Type.CHAR) {
Type numberType = getType(Number.class);
if (toType.getSort() == Type.BOOLEAN || (toType.getSort() == Type.CHAR && !numberType.equals(fromType))) {
coerce(fromType, boxType(toType), v);
}
else {
coerce(fromType, getType(Number.class), v);
coerce(fromType, numberType, v);
}
unbox(toType, v);
}