diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index 54da476c864..1120b599aaf 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -2761,7 +2761,10 @@ public class ExpressionCodegen extends JetVisitor implem } private StackValue generateExpressionWithNullFallback(@NotNull JetExpression expression, @NotNull Label ifnull) { - expression = JetPsiUtil.deparenthesize(expression); + JetExpression deparenthesized = JetPsiUtil.deparenthesize(expression); + assert deparenthesized != null : "Unexpected empty expression"; + + expression = deparenthesized; Type type = expressionType(expression); if (expression instanceof JetSafeQualifiedExpression && !isPrimitive(type)) { @@ -2849,6 +2852,9 @@ public class ExpressionCodegen extends JetVisitor implem private StackValue generateIn(final StackValue leftValue, JetExpression rangeExpression, final JetSimpleNameExpression operationReference) { final JetExpression deparenthesized = JetPsiUtil.deparenthesize(rangeExpression); + + assert deparenthesized != null : "For with empty range expression"; + return StackValue.operation(Type.BOOLEAN_TYPE, new Function1() { @Override public Unit invoke(InstructionAdapter v) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java index 560866233ad..48dc3be3c9f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java @@ -76,7 +76,6 @@ public class JetPsiUtil { } @Nullable - @Contract("!null -> !null") public static JetExpression deparenthesize(@Nullable JetExpression expression) { return deparenthesize(expression, /* deparenthesizeBinaryExpressionWithTypeRHS = */ true); }