Assertion failure fixed

This commit is contained in:
Andrey Breslav
2011-06-15 19:45:08 +04:00
parent 0210a495c3
commit bf84878a73
2 changed files with 7 additions and 2 deletions
@@ -13,6 +13,7 @@ public abstract class JetUnaryExpression extends JetExpression {
super(node); super(node);
} }
@Nullable @IfNotParsed
public abstract JetExpression getBaseExpression(); public abstract JetExpression getBaseExpression();
@NotNull @NotNull
@@ -1878,10 +1878,14 @@ public class JetTypeInferrer {
@Override @Override
public void visitUnaryExpression(JetUnaryExpression expression) { public void visitUnaryExpression(JetUnaryExpression expression) {
JetExpression baseExpression = expression.getBaseExpression();
if (baseExpression == null) {
return;
}
JetSimpleNameExpression operationSign = expression.getOperationSign(); JetSimpleNameExpression operationSign = expression.getOperationSign();
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) { if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
// TODO : Some processing for the label? // TODO : Some processing for the label?
result = getType(expression.getBaseExpression()); result = getType(baseExpression);
return; return;
} }
IElementType operationType = operationSign.getReferencedNameElementType(); IElementType operationType = operationSign.getReferencedNameElementType();
@@ -1890,7 +1894,7 @@ public class JetTypeInferrer {
trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation"); trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation");
} }
else { else {
JetType receiverType = getType(scope, expression.getBaseExpression(), false); JetType receiverType = getType(scope, baseExpression, false);
if (receiverType != null) { if (receiverType != null) {
FunctionDescriptor functionDescriptor = lookupFunction(scope, expression.getOperationSign(), name, receiverType, Collections.<JetType>emptyList(), true); FunctionDescriptor functionDescriptor = lookupFunction(scope, expression.getOperationSign(), name, receiverType, Collections.<JetType>emptyList(), true);
if (functionDescriptor != null) { if (functionDescriptor != null) {