Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -13,6 +13,7 @@ public abstract class JetUnaryExpression extends JetExpression {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public abstract JetExpression getBaseExpression();
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.*;
|
||||
public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
|
||||
private final Collection<DeclarationDescriptor> allDescriptors = Sets.newHashSet();
|
||||
private boolean allDescriptorsDone = false;
|
||||
|
||||
@NotNull
|
||||
private final DeclarationDescriptor ownerDeclarationDescriptor;
|
||||
@@ -38,7 +39,6 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
public WritableScopeImpl(@NotNull JetScope scope, @NotNull DeclarationDescriptor owner, @NotNull ErrorHandler errorHandler) {
|
||||
super(scope, errorHandler);
|
||||
this.ownerDeclarationDescriptor = owner;
|
||||
this.allDescriptors.addAll(scope.getAllDescriptors());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -57,7 +57,6 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
|
||||
@Override
|
||||
public void importScope(@NotNull JetScope imported) {
|
||||
allDescriptors.addAll(imported.getAllDescriptors());
|
||||
super.importScope(imported);
|
||||
}
|
||||
|
||||
@@ -69,6 +68,13 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getAllDescriptors() {
|
||||
if (!allDescriptorsDone) {
|
||||
allDescriptorsDone = true;
|
||||
allDescriptors.addAll(getWorkerScope().getAllDescriptors());
|
||||
for (JetScope imported : getImports()) {
|
||||
allDescriptors.addAll(imported.getAllDescriptors());
|
||||
}
|
||||
}
|
||||
return allDescriptors;
|
||||
}
|
||||
|
||||
|
||||
@@ -1885,10 +1885,14 @@ public class JetTypeInferrer {
|
||||
|
||||
@Override
|
||||
public void visitUnaryExpression(JetUnaryExpression expression) {
|
||||
JetExpression baseExpression = expression.getBaseExpression();
|
||||
if (baseExpression == null) {
|
||||
return;
|
||||
}
|
||||
JetSimpleNameExpression operationSign = expression.getOperationSign();
|
||||
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
|
||||
// TODO : Some processing for the label?
|
||||
result = getType(expression.getBaseExpression());
|
||||
result = getType(baseExpression);
|
||||
return;
|
||||
}
|
||||
IElementType operationType = operationSign.getReferencedNameElementType();
|
||||
@@ -1897,7 +1901,7 @@ public class JetTypeInferrer {
|
||||
trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation");
|
||||
}
|
||||
else {
|
||||
JetType receiverType = getType(scope, expression.getBaseExpression(), false);
|
||||
JetType receiverType = getType(scope, baseExpression, false);
|
||||
if (receiverType != null) {
|
||||
FunctionDescriptor functionDescriptor = lookupFunction(scope, expression.getOperationSign(), name, receiverType, Collections.<JetType>emptyList(), true);
|
||||
if (functionDescriptor != null) {
|
||||
|
||||
Reference in New Issue
Block a user