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))
|
||||
}
|
||||
|
||||
override fun getSyntheticExtensionFunctions(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>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> = emptyList()
|
||||
override fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> = emptyList()
|
||||
|
||||
private data class SyntheticPropertyHolder(val descriptor: PropertyDescriptor?, val lookedNames: List<Name>) {
|
||||
companion object {
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ class SamAdapterFunctionsScope(
|
||||
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
|
||||
for (type in receiverTypes) {
|
||||
val substitutorForType by lazy { buildMemberScopeSubstitutorForType(type) }
|
||||
@@ -80,7 +80,7 @@ class SamAdapterFunctionsScope(
|
||||
private fun buildMemberScopeSubstitutorForType(type: KotlinType) =
|
||||
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 ->
|
||||
type.memberScope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
|
||||
.filterIsInstance<FunctionDescriptor>()
|
||||
|
||||
@@ -146,7 +146,7 @@ internal class MemberScopeTowerLevel(
|
||||
override fun getFunctions(name: Name, extensionReceiver: ReceiverValueWithSmartCastInfo?): Collection<CandidateWithBoundDispatchReceiver<FunctionDescriptor>> {
|
||||
return collectMembers {
|
||||
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 {
|
||||
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 getSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
||||
fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
||||
}
|
||||
|
||||
interface SyntheticScopes {
|
||||
@@ -43,11 +43,11 @@ interface SyntheticScopes {
|
||||
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
||||
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name, location) }
|
||||
|
||||
fun SyntheticScopes.collectSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
||||
= scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes, name, location) }
|
||||
fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation)
|
||||
= scopes.flatMap { it.getSyntheticMemberFunctions(receiverTypes, name, location) }
|
||||
|
||||
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>)
|
||||
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes) }
|
||||
|
||||
fun SyntheticScopes.collectSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>)
|
||||
= scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes) }
|
||||
fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>)
|
||||
= scopes.flatMap { it.getSyntheticMemberFunctions(receiverTypes) }
|
||||
|
||||
+1
-1
@@ -385,7 +385,7 @@ class ReferenceVariantsHelper(
|
||||
}
|
||||
|
||||
if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK)) {
|
||||
for (syntheticMember in syntheticScopes.collectSyntheticExtensionFunctions(receiverTypes)) {
|
||||
for (syntheticMember in syntheticScopes.collectSyntheticMemberFunctions(receiverTypes)) {
|
||||
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.lazy.BodyResolveMode
|
||||
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.types.TypeUtils
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
@@ -186,7 +186,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() {
|
||||
|
||||
// SAM adapters for member functions
|
||||
val syntheticScopes = functionCall.getResolutionFacade().getFrontendService(SyntheticScopes::class.java)
|
||||
val syntheticExtensions = syntheticScopes.collectSyntheticExtensionFunctions(
|
||||
val syntheticExtensions = syntheticScopes.collectSyntheticMemberFunctions(
|
||||
containingClass.defaultType.singletonList(),
|
||||
functionResolvedCall.resultingDescriptor.name,
|
||||
NoLookupLocation.FROM_IDE)
|
||||
@@ -236,4 +236,4 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() {
|
||||
return argument.anyDescendantOfType<KtReturnExpression> { it.getLabelNameAsName() == samConstructorName }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user