Make generation of assertions for platform types aware of kotlin types

#KT-26859 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-09-17 10:59:26 +03:00
parent 03ea8603ce
commit fa9a3868b7
7 changed files with 47 additions and 3 deletions
@@ -910,19 +910,20 @@ public class AsmUtil {
if (state.isCallAssertionsDisabled()) return stackValue;
if (runtimeAssertionInfo == null || !runtimeAssertionInfo.getNeedNotNullAssertion()) return stackValue;
return new StackValue(stackValue.type) {
return new StackValue(stackValue.type, stackValue.kotlinType) {
@Override
public void putSelector(@NotNull Type type, @Nullable KotlinType kotlinType, @NotNull InstructionAdapter v) {
Type innerType = stackValue.type;
stackValue.put(innerType, v);
KotlinType innerKotlinType = stackValue.kotlinType;
stackValue.put(innerType, innerKotlinType, v);
if (innerType.getSort() == Type.OBJECT || innerType.getSort() == Type.ARRAY) {
v.dup();
v.visitLdcInsn(runtimeAssertionInfo.getMessage());
v.invokestatic(IntrinsicMethods.INTRINSICS_CLASS_NAME, "checkExpressionValueIsNotNull",
"(Ljava/lang/Object;Ljava/lang/String;)V", false);
}
StackValue.coerce(innerType, type, v);
StackValue.coerce(innerType, innerKotlinType, type, kotlinType, v);
}
};
}