Fix safe calls codegen for nullable generic

This commit is contained in:
Alexander Udalov
2013-02-06 17:53:31 +04:00
parent 433660b2ce
commit 64bc79aaac
4 changed files with 28 additions and 4 deletions
@@ -2228,11 +2228,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
@Override
public StackValue visitSafeQualifiedExpression(JetSafeQualifiedExpression expression, StackValue receiver) {
JetExpression expr = expression.getReceiverExpression();
JetType receiverJetType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression.getReceiverExpression());
assert receiverJetType != null;
Type receiverType = asmType(receiverJetType);
Type receiverType = expressionType(expr);
gen(expr, receiverType);
if (!receiverJetType.isNullable()) {
if (isPrimitive(receiverType)) {
StackValue propValue = genQualified(StackValue.onStack(receiverType), expression.getSelectorExpression());
Type type = boxType(propValue.type);
propValue.put(type, v);