Changed signatures

This commit is contained in:
Valentin Kipyatkov
2015-07-14 18:12:59 +03:00
parent 8f3650ebdb
commit d743924be9
10 changed files with 29 additions and 26 deletions
@@ -127,7 +127,7 @@ class JavaBeansExtensionsScope(storageManager: StorageManager) : JetScope by Jet
&& descriptor.getVisibility() == Visibilities.PUBLIC && descriptor.getVisibility() == Visibilities.PUBLIC
} }
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> {
return collectSyntheticPropertiesByName(null, receiverType.makeNotNullable(), name) ?: emptyList() return collectSyntheticPropertiesByName(null, receiverType.makeNotNullable(), name) ?: emptyList()
} }
@@ -146,7 +146,7 @@ class JavaBeansExtensionsScope(storageManager: StorageManager) : JetScope by Jet
return result return result
} }
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> {
val result = ArrayList<PropertyDescriptor>() val result = ArrayList<PropertyDescriptor>()
result.collectSyntheticProperties(receiverType.makeNotNullable()) result.collectSyntheticProperties(receiverType.makeNotNullable())
return result return result
@@ -53,11 +53,11 @@ class AllUnderImportsScope : JetScope {
return scopes.flatMap { it.getFunctions(name) } return scopes.flatMap { it.getFunctions(name) }
} }
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> {
return scopes.flatMap { it.getSyntheticExtensionProperties(receiverType, name) } return scopes.flatMap { it.getSyntheticExtensionProperties(receiverType, name) }
} }
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> {
return scopes.flatMap { it.getSyntheticExtensionProperties(receiverType) } return scopes.flatMap { it.getSyntheticExtensionProperties(receiverType) }
} }
@@ -255,17 +255,17 @@ class LazyImportScope(
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name) } return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name) }
} }
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> {
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionProperties(receiverType, name) } return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionProperties(receiverType, name) }
} }
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> {
// we do not perform any filtering by visibility here because all descriptors from both visible/invisible filter scopes are to be added anyway // we do not perform any filtering by visibility here because all descriptors from both visible/invisible filter scopes are to be added anyway
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
return importResolver.resolveSession.getStorageManager().compute { return importResolver.resolveSession.getStorageManager().compute {
importResolver.indexedImports.imports.flatMapTo(LinkedHashSet<VariableDescriptor>()) { import -> importResolver.indexedImports.imports.flatMapTo(LinkedHashSet<PropertyDescriptor>()) { import ->
importResolver.getImportScope(import, LookupMode.EVERYTHING).getSyntheticExtensionProperties(receiverType) importResolver.getImportScope(import, LookupMode.EVERYTHING).getSyntheticExtensionProperties(receiverType)
} }
} }
@@ -47,11 +47,11 @@ public abstract class AbstractScopeAdapter : JetScope {
return workerScope.getProperties(name) return workerScope.getProperties(name)
} }
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> {
return workerScope.getSyntheticExtensionProperties(receiverType, name) return workerScope.getSyntheticExtensionProperties(receiverType, name)
} }
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> { override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> {
return workerScope.getSyntheticExtensionProperties(receiverType) return workerScope.getSyntheticExtensionProperties(receiverType)
} }
@@ -65,10 +65,10 @@ public open class ChainedScope(
override fun getFunctions(name: Name): Collection<FunctionDescriptor> override fun getFunctions(name: Name): Collection<FunctionDescriptor>
= getFromAllScopes { it.getFunctions(name) } = getFromAllScopes { it.getFunctions(name) }
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor>
= getFromAllScopes { it.getSyntheticExtensionProperties(receiverType, name) } = getFromAllScopes { it.getSyntheticExtensionProperties(receiverType, name) }
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor>
= getFromAllScopes { it.getSyntheticExtensionProperties(receiverType) } = getFromAllScopes { it.getSyntheticExtensionProperties(receiverType) }
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> { override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.resolve.scopes package org.jetbrains.kotlin.resolve.scopes
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.Printer
@@ -36,9 +37,9 @@ public class FilteringScope(private val workerScope: JetScope, private val predi
override fun getProperties(name: Name) = workerScope.getProperties(name).filter(predicate) override fun getProperties(name: Name) = workerScope.getProperties(name).filter(predicate)
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name) = workerScope.getSyntheticExtensionProperties(receiverType, name).filter(predicate) override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverType, name).filter(predicate)
override fun getSyntheticExtensionProperties(receiverType: JetType) = workerScope.getSyntheticExtensionProperties(receiverType).filter(predicate) override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverType).filter(predicate)
override fun getLocalVariable(name: Name) = filterDescriptor(workerScope.getLocalVariable(name)) override fun getLocalVariable(name: Name) = filterDescriptor(workerScope.getLocalVariable(name))
@@ -35,9 +35,9 @@ public trait JetScope {
public fun getFunctions(name: Name): Collection<FunctionDescriptor> public fun getFunctions(name: Name): Collection<FunctionDescriptor>
public fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> public fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor>
public fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> public fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor>
public fun getContainingDeclaration(): DeclarationDescriptor public fun getContainingDeclaration(): DeclarationDescriptor
@@ -32,9 +32,9 @@ public abstract class JetScopeImpl : JetScope {
override fun getFunctions(name: Name): Collection<FunctionDescriptor> = setOf() override fun getFunctions(name: Name): Collection<FunctionDescriptor> = setOf()
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<VariableDescriptor> = listOf() override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> = listOf()
override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<VariableDescriptor> = listOf() override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> = listOf()
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> = listOf() override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> = listOf()
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.resolve.scopes package org.jetbrains.kotlin.resolve.scopes
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.JetType
@@ -69,9 +70,9 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
override fun getFunctions(name: Name) = substitute(workerScope.getFunctions(name)) override fun getFunctions(name: Name) = substitute(workerScope.getFunctions(name))
override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name) = substitute(workerScope.getSyntheticExtensionProperties(receiverType, name)) override fun getSyntheticExtensionProperties(receiverType: JetType, name: Name): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverType, name))
override fun getSyntheticExtensionProperties(receiverType: JetType) = substitute(workerScope.getSyntheticExtensionProperties(receiverType)) override fun getSyntheticExtensionProperties(receiverType: JetType): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverType))
override fun getPackage(name: Name) = workerScope.getPackage(name) override fun getPackage(name: Name) = workerScope.getPackage(name)
@@ -88,12 +88,12 @@ public class ErrorUtils {
@NotNull @NotNull
@Override @Override
public Set<VariableDescriptor> getProperties(@NotNull Name name) { public Set<VariableDescriptor> getProperties(@NotNull Name name) {
return ERROR_PROPERTY_GROUP; return ERROR_VARIABLE_GROUP;
} }
@NotNull @NotNull
@Override @Override
public Collection<VariableDescriptor> getSyntheticExtensionProperties( public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
@NotNull JetType receiverType, @NotNull Name name @NotNull JetType receiverType, @NotNull Name name
) { ) {
return ERROR_PROPERTY_GROUP; return ERROR_PROPERTY_GROUP;
@@ -101,7 +101,7 @@ public class ErrorUtils {
@NotNull @NotNull
@Override @Override
public Collection<VariableDescriptor> getSyntheticExtensionProperties(@NotNull JetType receiverType) { public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull JetType receiverType) {
return ERROR_PROPERTY_GROUP; return ERROR_PROPERTY_GROUP;
} }
@@ -209,7 +209,7 @@ public class ErrorUtils {
@NotNull @NotNull
@Override @Override
public Collection<VariableDescriptor> getSyntheticExtensionProperties( public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
@NotNull JetType receiverType, @NotNull Name name @NotNull JetType receiverType, @NotNull Name name
) { ) {
throw new IllegalStateException(); throw new IllegalStateException();
@@ -217,7 +217,7 @@ public class ErrorUtils {
@NotNull @NotNull
@Override @Override
public Collection<VariableDescriptor> getSyntheticExtensionProperties(@NotNull JetType receiverType) { public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull JetType receiverType) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
@@ -333,9 +333,10 @@ public class ErrorUtils {
} }
private static final JetType ERROR_PROPERTY_TYPE = createErrorType("<ERROR PROPERTY TYPE>"); private static final JetType ERROR_PROPERTY_TYPE = createErrorType("<ERROR PROPERTY TYPE>");
private static final VariableDescriptor ERROR_PROPERTY = createErrorProperty(); private static final PropertyDescriptor ERROR_PROPERTY = createErrorProperty();
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY); private static final Set<VariableDescriptor> ERROR_VARIABLE_GROUP = Collections.<VariableDescriptor>singleton(ERROR_PROPERTY);
private static final Set<PropertyDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
@NotNull @NotNull
private static PropertyDescriptorImpl createErrorProperty() { private static PropertyDescriptorImpl createErrorProperty() {