diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt index 0fe604bdfb5..48fff2c6b7c 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl +import org.jetbrains.kotlin.resolve.scopes.UsageLocation import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.isBoolean @@ -144,7 +145,9 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp return null } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection { + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + //TODO: use location parameter! + var result: SmartList? = null val processedTypes: MutableSet? = if (receiverTypes.size() > 1) HashSet() else null for (type in receiverTypes) { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt index 5a835762b4a..5d82db21cfc 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope +import org.jetbrains.kotlin.resolve.scopes.UsageLocation import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.DescriptorSubstitutor import org.jetbrains.kotlin.types.JetType @@ -54,10 +55,10 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : JetScope by Jet return MyFunctionDescriptor(enhancedFunction) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection { + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { var result: SmartList? = null for (type in receiverTypes) { - for (function in type.memberScope.getFunctions(name)) { + for (function in type.memberScope.getFunctions(name, location)) { val extension = extensionForFunction(function.original) if (extension != null) { if (result == null) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt index 564f6c8d879..8bbb7348466 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt @@ -54,12 +54,12 @@ class AllUnderImportsScope : JetScope { return scopes.flatMap { it.getFunctions(name, location) } } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection { - return scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name) } + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + return scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name, location) } } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection { - return scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes, name) } + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + return scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes, name, location) } } override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt index e68b581f04d..00309714442 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt @@ -258,14 +258,14 @@ class LazyImportScope( return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name, location) } } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection { + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() - return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionProperties(receiverTypes, name) } + return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionProperties(receiverTypes, name, location) } } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection { + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() - return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionFunctions(receiverTypes, name) } + return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionFunctions(receiverTypes, name, location) } } override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection { diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt index 8933318cc18..fbf6dc7bf78 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt @@ -47,12 +47,12 @@ public abstract class AbstractScopeAdapter : JetScope { return workerScope.getProperties(name, location) } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection { - return workerScope.getSyntheticExtensionProperties(receiverTypes, name) + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + return workerScope.getSyntheticExtensionProperties(receiverTypes, name, location) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection { - return workerScope.getSyntheticExtensionFunctions(receiverTypes, name) + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + return workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location) } override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection { diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt index 80d3d152bfb..279ddd4b858 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt @@ -64,11 +64,11 @@ public open class ChainedScope( override fun getFunctions(name: Name, location: UsageLocation): Collection = getFromAllScopes { it.getFunctions(name, location) } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection - = getFromAllScopes { it.getSyntheticExtensionProperties(receiverTypes, name) } + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + = getFromAllScopes { it.getSyntheticExtensionProperties(receiverTypes, name, location) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection - = getFromAllScopes { it.getSyntheticExtensionFunctions(receiverTypes, name) } + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + = getFromAllScopes { it.getSyntheticExtensionFunctions(receiverTypes, name, location) } override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection = getFromAllScopes { it.getSyntheticExtensionProperties(receiverTypes) } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt index b22c2fd0208..57c14b0954b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt @@ -38,13 +38,17 @@ public class FilteringScope(private val workerScope: JetScope, private val predi override fun getProperties(name: Name, location: UsageLocation) = workerScope.getProperties(name, location).filter(predicate) - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection = workerScope.getSyntheticExtensionProperties(receiverTypes, name).filter(predicate) + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + = workerScope.getSyntheticExtensionProperties(receiverTypes, name, location).filter(predicate) - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection = workerScope.getSyntheticExtensionFunctions(receiverTypes, name).filter(predicate) + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + = workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location).filter(predicate) - override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection = workerScope.getSyntheticExtensionProperties(receiverTypes).filter(predicate) + override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection + = workerScope.getSyntheticExtensionProperties(receiverTypes).filter(predicate) - override fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection = workerScope.getSyntheticExtensionFunctions(receiverTypes).filter(predicate) + override fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection + = workerScope.getSyntheticExtensionFunctions(receiverTypes).filter(predicate) override fun getLocalVariable(name: Name) = filterDescriptor(workerScope.getLocalVariable(name)) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt index 208540d2854..49f1270b26b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt @@ -35,8 +35,8 @@ public interface JetScope { public fun getFunctions(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection - public fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection - public fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection + public fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection + public fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection public fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection public fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt index 9496fe4bfea..bf9d5ea7430 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt @@ -32,8 +32,8 @@ public abstract class JetScopeImpl : JetScope { override fun getFunctions(name: Name, location: UsageLocation): Collection = emptyList() - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection = emptyList() - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection = emptyList() + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection = emptyList() + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection = emptyList() override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection = emptyList() override fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection = emptyList() diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt index ef33cf7f774..5f9945e993f 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt @@ -70,11 +70,11 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su override fun getFunctions(name: Name, location: UsageLocation) = substitute(workerScope.getFunctions(name, location)) - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name): Collection - = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes, name)) + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes, name, location)) - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name): Collection - = substitute(workerScope.getSyntheticExtensionFunctions(receiverTypes, name)) + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + = substitute(workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location)) override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes)) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java index 501e33d279f..c19cf467a23 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java @@ -96,7 +96,8 @@ public class ErrorUtils { @NotNull @Override public Collection getSyntheticExtensionProperties( - @NotNull Collection receiverTypes, @NotNull Name name + @NotNull Collection receiverTypes, @NotNull Name name, + @NotNull UsageLocation location ) { return ERROR_PROPERTY_GROUP; } @@ -104,7 +105,8 @@ public class ErrorUtils { @NotNull @Override public Collection getSyntheticExtensionFunctions( - @NotNull Collection receiverTypes, @NotNull Name name + @NotNull Collection receiverTypes, @NotNull Name name, + @NotNull UsageLocation location ) { return Collections.singleton(createErrorFunction(this)); } @@ -228,7 +230,8 @@ public class ErrorUtils { @NotNull @Override public Collection getSyntheticExtensionProperties( - @NotNull Collection receiverTypes, @NotNull Name name + @NotNull Collection receiverTypes, @NotNull Name name, + @NotNull UsageLocation location ) { throw new IllegalStateException(); } @@ -236,7 +239,8 @@ public class ErrorUtils { @NotNull @Override public Collection getSyntheticExtensionFunctions( - @NotNull Collection receiverTypes, @NotNull Name name + @NotNull Collection receiverTypes, @NotNull Name name, + @NotNull UsageLocation location ) { throw new IllegalStateException(); }