Minor. Rename SyntheticExtensionFunctions -> SyntheticMemberFunctions
This commit is contained in:
+2
-2
@@ -259,8 +259,8 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
|||||||
return Name.identifier("set" + identifier.removePrefix(prefix))
|
return Name.identifier("set" + identifier.removePrefix(prefix))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
|
override fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> = emptyList()
|
override fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> = emptyList()
|
||||||
|
|
||||||
private data class SyntheticPropertyHolder(val descriptor: PropertyDescriptor?, val lookedNames: List<Name>) {
|
private data class SyntheticPropertyHolder(val descriptor: PropertyDescriptor?, val lookedNames: List<Name>) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
+2
-2
@@ -55,7 +55,7 @@ class SamAdapterFunctionsScope(
|
|||||||
return MyFunctionDescriptor.create(function)
|
return MyFunctionDescriptor.create(function)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
override fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||||
var result: SmartList<FunctionDescriptor>? = null
|
var result: SmartList<FunctionDescriptor>? = null
|
||||||
for (type in receiverTypes) {
|
for (type in receiverTypes) {
|
||||||
val substitutorForType by lazy { buildMemberScopeSubstitutorForType(type) }
|
val substitutorForType by lazy { buildMemberScopeSubstitutorForType(type) }
|
||||||
@@ -80,7 +80,7 @@ class SamAdapterFunctionsScope(
|
|||||||
private fun buildMemberScopeSubstitutorForType(type: KotlinType) =
|
private fun buildMemberScopeSubstitutorForType(type: KotlinType) =
|
||||||
TypeConstructorSubstitution.create(type).wrapWithCapturingSubstitution(needApproximation = true).buildSubstitutor()
|
TypeConstructorSubstitution.create(type).wrapWithCapturingSubstitution(needApproximation = true).buildSubstitutor()
|
||||||
|
|
||||||
override fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> {
|
override fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> {
|
||||||
return receiverTypes.flatMapTo(LinkedHashSet<FunctionDescriptor>()) { type ->
|
return receiverTypes.flatMapTo(LinkedHashSet<FunctionDescriptor>()) { type ->
|
||||||
type.memberScope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
|
type.memberScope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
|
||||||
.filterIsInstance<FunctionDescriptor>()
|
.filterIsInstance<FunctionDescriptor>()
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ internal class MemberScopeTowerLevel(
|
|||||||
override fun getFunctions(name: Name, extensionReceiver: ReceiverValueWithSmartCastInfo?): Collection<CandidateWithBoundDispatchReceiver<FunctionDescriptor>> {
|
override fun getFunctions(name: Name, extensionReceiver: ReceiverValueWithSmartCastInfo?): Collection<CandidateWithBoundDispatchReceiver<FunctionDescriptor>> {
|
||||||
return collectMembers {
|
return collectMembers {
|
||||||
getContributedFunctions(name, location) + it.getInnerConstructors(name, location) +
|
getContributedFunctions(name, location) + it.getInnerConstructors(name, location) +
|
||||||
syntheticScopes.collectSyntheticExtensionFunctions(it.singletonOrEmptyList(), name, location)
|
syntheticScopes.collectSyntheticMemberFunctions(it.singletonOrEmptyList(), name, location)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ import org.jetbrains.kotlin.types.KotlinType
|
|||||||
|
|
||||||
interface SyntheticScope {
|
interface SyntheticScope {
|
||||||
fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<PropertyDescriptor>
|
||||||
fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
|
|
||||||
fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
||||||
fun getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SyntheticScopes {
|
interface SyntheticScopes {
|
||||||
@@ -43,11 +43,11 @@ interface SyntheticScopes {
|
|||||||
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
||||||
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name, location) }
|
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name, location) }
|
||||||
|
|
||||||
fun SyntheticScopes.collectSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
||||||
= scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes, name, location) }
|
= scopes.flatMap { it.getSyntheticMemberFunctions(receiverTypes, name, location) }
|
||||||
|
|
||||||
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>)
|
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>)
|
||||||
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes) }
|
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes) }
|
||||||
|
|
||||||
fun SyntheticScopes.collectSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>)
|
fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>)
|
||||||
= scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes) }
|
= scopes.flatMap { it.getSyntheticMemberFunctions(receiverTypes) }
|
||||||
|
|||||||
+1
-1
@@ -385,7 +385,7 @@ class ReferenceVariantsHelper(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK)) {
|
if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK)) {
|
||||||
for (syntheticMember in syntheticScopes.collectSyntheticExtensionFunctions(receiverTypes)) {
|
for (syntheticMember in syntheticScopes.collectSyntheticMemberFunctions(receiverTypes)) {
|
||||||
process(syntheticMember)
|
process(syntheticMember)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess
|
|||||||
import org.jetbrains.kotlin.resolve.calls.util.DelegatingCall
|
import org.jetbrains.kotlin.resolve.calls.util.DelegatingCall
|
||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||||
import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes
|
import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes
|
||||||
import org.jetbrains.kotlin.resolve.scopes.collectSyntheticExtensionFunctions
|
import org.jetbrains.kotlin.resolve.scopes.collectSyntheticMemberFunctions
|
||||||
import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor
|
import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||||
@@ -186,7 +186,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() {
|
|||||||
|
|
||||||
// SAM adapters for member functions
|
// SAM adapters for member functions
|
||||||
val syntheticScopes = functionCall.getResolutionFacade().getFrontendService(SyntheticScopes::class.java)
|
val syntheticScopes = functionCall.getResolutionFacade().getFrontendService(SyntheticScopes::class.java)
|
||||||
val syntheticExtensions = syntheticScopes.collectSyntheticExtensionFunctions(
|
val syntheticExtensions = syntheticScopes.collectSyntheticMemberFunctions(
|
||||||
containingClass.defaultType.singletonList(),
|
containingClass.defaultType.singletonList(),
|
||||||
functionResolvedCall.resultingDescriptor.name,
|
functionResolvedCall.resultingDescriptor.name,
|
||||||
NoLookupLocation.FROM_IDE)
|
NoLookupLocation.FROM_IDE)
|
||||||
@@ -236,4 +236,4 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() {
|
|||||||
return argument.anyDescendantOfType<KtReturnExpression> { it.getLabelNameAsName() == samConstructorName }
|
return argument.anyDescendantOfType<KtReturnExpression> { it.getLabelNameAsName() == samConstructorName }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user