Not ignoring other properties in scope.

First one (almost randomly) was chosen instead of ambiguity.
This commit is contained in:
Evgeny Gerashchenko
2013-09-11 00:04:02 +04:00
parent 48e96aece3
commit e4d8e4d61b
4 changed files with 34 additions and 16 deletions
@@ -195,16 +195,6 @@ public class DescriptorUtils {
return false;
}
@Nullable
public static VariableDescriptor filterNonExtensionProperty(Collection<VariableDescriptor> variables) {
for (VariableDescriptor variable : variables) {
if (variable.getReceiverParameter() == null) {
return variable;
}
}
return null;
}
@NotNull
public static JetType getFunctionExpectedReturnType(@NotNull FunctionDescriptor descriptor, @NotNull JetElement function) {
JetType expectedType;
@@ -20,7 +20,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.ErrorUtils;
@@ -84,12 +83,18 @@ public class CallableDescriptorCollectors {
@NotNull
@Override
public Collection<VariableDescriptor> getNonExtensionsByName(JetScope scope, Name name) {
VariableDescriptor descriptor = scope.getLocalVariable(name);
if (descriptor == null) {
descriptor = DescriptorUtils.filterNonExtensionProperty(scope.getProperties(name));
VariableDescriptor localVariable = scope.getLocalVariable(name);
if (localVariable != null) {
return Collections.singleton(localVariable);
}
if (descriptor == null) return Collections.emptyList();
return Collections.singleton(descriptor);
LinkedHashSet<VariableDescriptor> variables = Sets.newLinkedHashSet();
for (VariableDescriptor variable : scope.getProperties(name)) {
if (variable.getReceiverParameter() == null) {
variables.add(variable);
}
}
return variables;
}
@NotNull