Collect sam adapters for constructors in synthetic scope
Also place computation of synthetic constructors under one function
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
+1
-24
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,35 +16,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.load.java.sam
|
package org.jetbrains.kotlin.load.java.sam
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.components.SamConversionResolver
|
import org.jetbrains.kotlin.load.java.components.SamConversionResolver
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassConstructorDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
|
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.types.SimpleType
|
import org.jetbrains.kotlin.types.SimpleType
|
||||||
|
|
||||||
class SamConversionResolverImpl(val storageManager: StorageManager, val samWithReceiverResolver: SamWithReceiverResolver): SamConversionResolver {
|
class SamConversionResolverImpl(val storageManager: StorageManager, val samWithReceiverResolver: SamWithReceiverResolver): SamConversionResolver {
|
||||||
override fun resolveSamConstructor(constructorOwner: DeclarationDescriptor, classifier: () -> ClassifierDescriptor?): SamConstructorDescriptor? {
|
|
||||||
val classifierDescriptor = classifier()
|
|
||||||
if (classifierDescriptor !is LazyJavaClassDescriptor || classifierDescriptor.functionTypeForSamInterface == null) return null
|
|
||||||
return SingleAbstractMethodUtils.createSamConstructorFunction(constructorOwner, classifierDescriptor)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
override fun <D : FunctionDescriptor> resolveSamAdapter(original: D): D? {
|
|
||||||
return when {
|
|
||||||
!SingleAbstractMethodUtils.isSamAdapterNecessary(original) -> null
|
|
||||||
original is JavaClassConstructorDescriptor -> SingleAbstractMethodUtils.createSamAdapterConstructor(original) as D
|
|
||||||
original is JavaMethodDescriptor -> SingleAbstractMethodUtils.createSamAdapterFunction(original) as D
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val functionTypesForSamInterfaces = storageManager.createCacheWithNullableValues<JavaClassDescriptor, SimpleType>()
|
private val functionTypesForSamInterfaces = storageManager.createCacheWithNullableValues<JavaClassDescriptor, SimpleType>()
|
||||||
|
|
||||||
override fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType? {
|
override fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType? {
|
||||||
|
|||||||
+9
@@ -180,9 +180,18 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
|||||||
override fun getSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
override fun getSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
= emptyList()
|
= emptyList()
|
||||||
|
|
||||||
|
override fun getSyntheticConstructors(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
|
= emptyList()
|
||||||
|
|
||||||
override fun getSyntheticStaticFunctions(scope: ResolutionScope): Collection<FunctionDescriptor>
|
override fun getSyntheticStaticFunctions(scope: ResolutionScope): Collection<FunctionDescriptor>
|
||||||
= emptyList()
|
= emptyList()
|
||||||
|
|
||||||
|
override fun getSyntheticConstructors(scope: ResolutionScope): Collection<FunctionDescriptor>
|
||||||
|
= emptyList()
|
||||||
|
|
||||||
|
override fun getSyntheticConstructor(constructor: ConstructorDescriptor): ConstructorDescriptor?
|
||||||
|
= null
|
||||||
|
|
||||||
private fun collectSyntheticPropertiesByName(result: SmartList<PropertyDescriptor>?, type: TypeConstructor, name: Name, processedTypes: MutableSet<TypeConstructor>?, location: LookupLocation): SmartList<PropertyDescriptor>? {
|
private fun collectSyntheticPropertiesByName(result: SmartList<PropertyDescriptor>?, type: TypeConstructor, name: Name, processedTypes: MutableSet<TypeConstructor>?, location: LookupLocation): SmartList<PropertyDescriptor>? {
|
||||||
if (processedTypes != null && !processedTypes.add(type)) return result
|
if (processedTypes != null && !processedTypes.add(type)) return result
|
||||||
|
|
||||||
|
|||||||
+61
-19
@@ -21,12 +21,11 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
||||||
|
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptorImpl
|
||||||
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
|
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.*
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.SamAdapterDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
|
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.sam.SingleAbstractMethodUtils
|
import org.jetbrains.kotlin.load.java.sam.SingleAbstractMethodUtils
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -38,8 +37,6 @@ import org.jetbrains.kotlin.resolve.scopes.SyntheticScope
|
|||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.checker.findCorrespondingSupertype
|
import org.jetbrains.kotlin.types.checker.findCorrespondingSupertype
|
||||||
import java.util.*
|
|
||||||
import kotlin.collections.LinkedHashSet
|
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
interface SamAdapterExtensionFunctionDescriptor : FunctionDescriptor, SyntheticMemberDescriptor<FunctionDescriptor> {
|
interface SamAdapterExtensionFunctionDescriptor : FunctionDescriptor, SyntheticMemberDescriptor<FunctionDescriptor> {
|
||||||
@@ -61,7 +58,18 @@ class SamAdapterFunctionsScope(
|
|||||||
|
|
||||||
private val samConstructorForClassifier =
|
private val samConstructorForClassifier =
|
||||||
storageManager.createMemoizedFunction<JavaClassDescriptor, SamConstructorDescriptor> { classifier ->
|
storageManager.createMemoizedFunction<JavaClassDescriptor, SamConstructorDescriptor> { classifier ->
|
||||||
samConstructorForClassifierNotCached(classifier)
|
SingleAbstractMethodUtils.createSamConstructorFunction(classifier.containingDeclaration, classifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val samConstructorForJavaConstructor =
|
||||||
|
storageManager.createMemoizedFunction<JavaClassConstructorDescriptor, ClassConstructorDescriptor> { constructor ->
|
||||||
|
SingleAbstractMethodUtils.createSamAdapterConstructor(constructor) as ClassConstructorDescriptor
|
||||||
|
}
|
||||||
|
|
||||||
|
private val samConstructorForTypeAliasConstructor =
|
||||||
|
storageManager.createMemoizedFunctionWithNullableValues<Pair<ClassConstructorDescriptor, TypeAliasDescriptor>, TypeAliasConstructorDescriptor> {
|
||||||
|
(constructor, typeAliasDescriptor) ->
|
||||||
|
TypeAliasConstructorDescriptorImpl.createIfAvailable(storageManager, typeAliasDescriptor, constructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun extensionForFunctionNotCached(function: FunctionDescriptor): FunctionDescriptor? {
|
private fun extensionForFunctionNotCached(function: FunctionDescriptor): FunctionDescriptor? {
|
||||||
@@ -73,10 +81,6 @@ class SamAdapterFunctionsScope(
|
|||||||
return MyFunctionDescriptor.create(function)
|
return MyFunctionDescriptor.create(function)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun samConstructorForClassifierNotCached(classifier: JavaClassDescriptor): SamConstructorDescriptor {
|
|
||||||
return SingleAbstractMethodUtils.createSamConstructorFunction(classifier.containingDeclaration, classifier)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSyntheticMemberFunctions(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) {
|
||||||
@@ -124,18 +128,41 @@ class SamAdapterFunctionsScope(
|
|||||||
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor> = emptyList()
|
override fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor> = emptyList()
|
||||||
|
|
||||||
override fun getSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
override fun getSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||||
val classifier = scope.getContributedClassifier(name, location)
|
return getSamFunctions(scope.getContributedFunctions(name, location))
|
||||||
val samConstructor = classifier?.let { getSamConstructor(it) }
|
}
|
||||||
return getSamFunctions(scope.getContributedFunctions(name, location)) + listOfNotNull(samConstructor)
|
|
||||||
|
override fun getSyntheticConstructors(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||||
|
val classifier = scope.getContributedClassifier(name, location) ?: return emptyList()
|
||||||
|
return getAllSamConstructors(classifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSyntheticStaticFunctions(scope: ResolutionScope): Collection<FunctionDescriptor> {
|
override fun getSyntheticStaticFunctions(scope: ResolutionScope): Collection<FunctionDescriptor> {
|
||||||
val samConstructors =
|
return getSamFunctions(scope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS))
|
||||||
scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS)
|
}
|
||||||
.filterIsInstance<ClassifierDescriptor>()
|
|
||||||
.mapNotNull{ getSamConstructor(it) }
|
|
||||||
|
|
||||||
return getSamFunctions(scope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)) + samConstructors
|
override fun getSyntheticConstructors(scope: ResolutionScope): Collection<FunctionDescriptor> {
|
||||||
|
return scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS)
|
||||||
|
.filterIsInstance<ClassifierDescriptor>()
|
||||||
|
.flatMap { getAllSamConstructors(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getSyntheticConstructor(constructor: ConstructorDescriptor): ConstructorDescriptor? {
|
||||||
|
return when (constructor) {
|
||||||
|
is JavaClassConstructorDescriptor -> createJavaSamAdapterConstructor(constructor)
|
||||||
|
is TypeAliasConstructorDescriptor -> {
|
||||||
|
val underlyingConstructor = constructor.underlyingConstructorDescriptor
|
||||||
|
if (underlyingConstructor !is JavaClassConstructorDescriptor) return null
|
||||||
|
val underlyingSamConstructor = createJavaSamAdapterConstructor(underlyingConstructor) ?: return null
|
||||||
|
|
||||||
|
samConstructorForTypeAliasConstructor(Pair(underlyingSamConstructor, constructor.typeAliasDescriptor))
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createJavaSamAdapterConstructor(constructor: JavaClassConstructorDescriptor): ClassConstructorDescriptor? {
|
||||||
|
if (!SingleAbstractMethodUtils.isSamAdapterNecessary(constructor)) return null
|
||||||
|
return samConstructorForJavaConstructor(constructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSamFunctions(functions: Collection<DeclarationDescriptor>): List<SamAdapterDescriptor<JavaMethodDescriptor>> {
|
private fun getSamFunctions(functions: Collection<DeclarationDescriptor>): List<SamAdapterDescriptor<JavaMethodDescriptor>> {
|
||||||
@@ -148,6 +175,21 @@ class SamAdapterFunctionsScope(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getAllSamConstructors(classifier: ClassifierDescriptor): List<FunctionDescriptor> {
|
||||||
|
return getSamAdaptersFromConstructors(classifier) + listOfNotNull(getSamConstructor(classifier))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getSamAdaptersFromConstructors(classifier: ClassifierDescriptor): List<FunctionDescriptor> {
|
||||||
|
if (classifier !is JavaClassDescriptor) return emptyList()
|
||||||
|
|
||||||
|
return arrayListOf<FunctionDescriptor>().apply {
|
||||||
|
for (constructor in classifier.constructors) {
|
||||||
|
val samConstructor = getSyntheticConstructor(constructor) ?: continue
|
||||||
|
add(samConstructor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getSamConstructor(classifier: ClassifierDescriptor): SamConstructorDescriptor? {
|
private fun getSamConstructor(classifier: ClassifierDescriptor): SamConstructorDescriptor? {
|
||||||
if (classifier is TypeAliasDescriptor) {
|
if (classifier is TypeAliasDescriptor) {
|
||||||
return getTypeAliasSamConstructor(classifier)
|
return getTypeAliasSamConstructor(classifier)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.resolve.calls.util.CallMaker;
|
|||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
|
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
import org.jetbrains.kotlin.types.KotlinType;
|
||||||
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
||||||
@@ -70,6 +71,7 @@ public class CallResolver {
|
|||||||
private GenericCandidateResolver genericCandidateResolver;
|
private GenericCandidateResolver genericCandidateResolver;
|
||||||
private CallCompleter callCompleter;
|
private CallCompleter callCompleter;
|
||||||
private NewResolutionOldInference newCallResolver;
|
private NewResolutionOldInference newCallResolver;
|
||||||
|
private SyntheticScopes syntheticScopes;
|
||||||
private final KotlinBuiltIns builtIns;
|
private final KotlinBuiltIns builtIns;
|
||||||
private final LanguageVersionSettings languageVersionSettings;
|
private final LanguageVersionSettings languageVersionSettings;
|
||||||
|
|
||||||
@@ -119,6 +121,11 @@ public class CallResolver {
|
|||||||
this.newCallResolver = newCallResolver;
|
this.newCallResolver = newCallResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public void setSyntheticScopes(@NotNull SyntheticScopes syntheticScopes) {
|
||||||
|
this.syntheticScopes = syntheticScopes;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public OverloadResolutionResults<VariableDescriptor> resolveSimpleProperty(@NotNull BasicCallResolutionContext context) {
|
public OverloadResolutionResults<VariableDescriptor> resolveSimpleProperty(@NotNull BasicCallResolutionContext context) {
|
||||||
KtExpression calleeExpression = context.call.getCalleeExpression();
|
KtExpression calleeExpression = context.call.getCalleeExpression();
|
||||||
@@ -357,7 +364,7 @@ public class CallResolver {
|
|||||||
@NotNull KotlinType constructedType
|
@NotNull KotlinType constructedType
|
||||||
) {
|
) {
|
||||||
Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
|
Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
|
||||||
prepareCandidatesAndContextForConstructorCall(constructedType, context);
|
prepareCandidatesAndContextForConstructorCall(constructedType, context, syntheticScopes);
|
||||||
|
|
||||||
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
|
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
|
||||||
context = candidatesAndContext.getSecond();
|
context = candidatesAndContext.getSecond();
|
||||||
@@ -437,7 +444,7 @@ public class CallResolver {
|
|||||||
DescriptorUtils.getSuperClassType(currentClassDescriptor);
|
DescriptorUtils.getSuperClassType(currentClassDescriptor);
|
||||||
|
|
||||||
Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
|
Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> candidatesAndContext =
|
||||||
prepareCandidatesAndContextForConstructorCall(superType, context);
|
prepareCandidatesAndContextForConstructorCall(superType, context, syntheticScopes);
|
||||||
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
|
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates = candidatesAndContext.getFirst();
|
||||||
context = candidatesAndContext.getSecond();
|
context = candidatesAndContext.getSecond();
|
||||||
|
|
||||||
@@ -459,7 +466,8 @@ public class CallResolver {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private static Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> prepareCandidatesAndContextForConstructorCall(
|
private static Pair<Collection<ResolutionCandidate<ConstructorDescriptor>>, BasicCallResolutionContext> prepareCandidatesAndContextForConstructorCall(
|
||||||
@NotNull KotlinType superType,
|
@NotNull KotlinType superType,
|
||||||
@NotNull BasicCallResolutionContext context
|
@NotNull BasicCallResolutionContext context,
|
||||||
|
@NotNull SyntheticScopes syntheticScopes
|
||||||
) {
|
) {
|
||||||
if (!(superType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) {
|
if (!(superType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) {
|
||||||
return new Pair<>(Collections.<ResolutionCandidate<ConstructorDescriptor>>emptyList(), context);
|
return new Pair<>(Collections.<ResolutionCandidate<ConstructorDescriptor>>emptyList(), context);
|
||||||
@@ -474,9 +482,9 @@ public class CallResolver {
|
|||||||
context = context.replaceExpectedType(superType);
|
context = context.replaceExpectedType(superType);
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<ResolutionCandidate<ConstructorDescriptor>> candidates =
|
List<ResolutionCandidate<ConstructorDescriptor>> candidates =
|
||||||
CallResolverUtilKt.createResolutionCandidatesForConstructors(
|
CallResolverUtilKt.createResolutionCandidatesForConstructors(
|
||||||
context.scope, context.call, superType, !anyConstructorHasDeclaredTypeParameters
|
context.scope, context.call, superType, !anyConstructorHasDeclaredTypeParameters, syntheticScopes
|
||||||
);
|
);
|
||||||
|
|
||||||
return new Pair<>(candidates, context);
|
return new Pair<>(candidates, context);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -35,6 +35,8 @@ import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch
|
|||||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
||||||
import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate
|
import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate
|
||||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.collectSyntheticConstructors
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||||
import org.jetbrains.kotlin.resolve.scopes.utils.getImplicitReceiversHierarchy
|
import org.jetbrains.kotlin.resolve.scopes.utils.getImplicitReceiversHierarchy
|
||||||
@@ -192,8 +194,9 @@ fun createResolutionCandidatesForConstructors(
|
|||||||
lexicalScope: LexicalScope,
|
lexicalScope: LexicalScope,
|
||||||
call: Call,
|
call: Call,
|
||||||
typeWithConstructors: KotlinType,
|
typeWithConstructors: KotlinType,
|
||||||
useKnownTypeSubstitutor: Boolean
|
useKnownTypeSubstitutor: Boolean,
|
||||||
): Collection<ResolutionCandidate<ConstructorDescriptor>> {
|
syntheticScopes: SyntheticScopes
|
||||||
|
): List<ResolutionCandidate<ConstructorDescriptor>> {
|
||||||
val classWithConstructors = typeWithConstructors.constructor.declarationDescriptor as ClassDescriptor
|
val classWithConstructors = typeWithConstructors.constructor.declarationDescriptor as ClassDescriptor
|
||||||
|
|
||||||
val unwrappedType = typeWithConstructors.unwrap()
|
val unwrappedType = typeWithConstructors.unwrap()
|
||||||
@@ -233,7 +236,9 @@ fun createResolutionCandidatesForConstructors(
|
|||||||
dispatchReceiver = null
|
dispatchReceiver = null
|
||||||
}
|
}
|
||||||
|
|
||||||
return constructors.map {
|
val syntheticConstructors = constructors.flatMap { syntheticScopes.collectSyntheticConstructors(it) }
|
||||||
|
|
||||||
|
return (constructors + syntheticConstructors).map {
|
||||||
ResolutionCandidate.create(call, it, dispatchReceiver, receiverKind, knownSubstitutor)
|
ResolutionCandidate.create(call, it, dispatchReceiver, receiverKind, knownSubstitutor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ private fun ResolutionScope.getContributedFunctionsAndConstructors(
|
|||||||
callableConstructors.filterTo(result) { it.dispatchReceiverParameter == null }
|
callableConstructors.filterTo(result) { it.dispatchReceiverParameter == null }
|
||||||
|
|
||||||
result.addAll(syntheticScopes.collectSyntheticStaticFunctions(scope, name, location))
|
result.addAll(syntheticScopes.collectSyntheticStaticFunctions(scope, name, location))
|
||||||
|
result.addAll(syntheticScopes.collectSyntheticConstructors(scope, name, location))
|
||||||
|
|
||||||
return result.toList()
|
return result.toList()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// FILE: OnSubscribe.java
|
||||||
|
public interface OnSubscribe<T> {
|
||||||
|
void f();
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Observable.java
|
||||||
|
public class Observable<T> {
|
||||||
|
public Observable(OnSubscribe<T> f) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
|
||||||
|
typealias ObservableAlias<T> = Observable<T>
|
||||||
|
typealias ObservableIntAlias = Observable<Int>
|
||||||
|
|
||||||
|
class A : ObservableAlias<String>({})
|
||||||
|
class B : ObservableIntAlias({})
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class A : ObservableAlias<kotlin.String> /* = Observable<kotlin.String> */ {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B : ObservableIntAlias /* = Observable<kotlin.Int> */ {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class Observable</*0*/ T : kotlin.Any!> {
|
||||||
|
public constructor Observable</*0*/ T : kotlin.Any!>(/*0*/ f: OnSubscribe<T!>!)
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnSubscribe</*0*/ T : kotlin.Any!> {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun f(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
public typealias ObservableAlias</*0*/ T> = Observable<T>
|
||||||
|
public typealias ObservableIntAlias = Observable<kotlin.Int>
|
||||||
-1
@@ -4,7 +4,6 @@ package test {
|
|||||||
public fun test(): kotlin.Unit
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
public open class J {
|
public open class J {
|
||||||
public /*synthesized*/ constructor J(/*0*/ s: kotlin.String!, /*1*/ r: (() -> kotlin.Unit)!, /*2*/ z: kotlin.Boolean!)
|
|
||||||
public constructor J(/*0*/ s: kotlin.String!, /*1*/ r: java.lang.Runnable!, /*2*/ z: kotlin.Boolean!)
|
public constructor J(/*0*/ s: kotlin.String!, /*1*/ r: java.lang.Runnable!, /*2*/ z: kotlin.Boolean!)
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package
|
|||||||
public fun foo(): kotlin.Unit
|
public fun foo(): kotlin.Unit
|
||||||
|
|
||||||
public open class A</*0*/ E : kotlin.Any!> {
|
public open class A</*0*/ E : kotlin.Any!> {
|
||||||
public /*synthesized*/ constructor A</*0*/ E : kotlin.Any!>(/*0*/ comparator: ((E!, E!) -> kotlin.Int)!)
|
|
||||||
public constructor A</*0*/ E : kotlin.Any!>(/*0*/ comparator: java.util.Comparator<in E!>!)
|
public constructor A</*0*/ E : kotlin.Any!>(/*0*/ comparator: java.util.Comparator<in E!>!)
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public open class Constructor {
|
public open class Constructor {
|
||||||
public /*synthesized*/ constructor Constructor(/*0*/ p0: (() -> kotlin.Unit)!)
|
|
||||||
public constructor Constructor(/*0*/ p0: java.lang.Runnable!)
|
public constructor Constructor(/*0*/ p0: java.lang.Runnable!)
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public open class ConstructorWithAnnotations {
|
public open class ConstructorWithAnnotations {
|
||||||
public /*synthesized*/ constructor ConstructorWithAnnotations(/*0*/ p0: (() -> kotlin.Unit)!, /*1*/ @org.jetbrains.annotations.NotNull p1: kotlin.String)
|
|
||||||
public constructor ConstructorWithAnnotations(/*0*/ p0: java.lang.Runnable!, /*1*/ @org.jetbrains.annotations.NotNull p1: kotlin.String)
|
public constructor ConstructorWithAnnotations(/*0*/ p0: java.lang.Runnable!, /*1*/ @org.jetbrains.annotations.NotNull p1: kotlin.String)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12268,6 +12268,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeAliasWithSamConstructor.kt")
|
||||||
|
public void testTypeAliasWithSamConstructor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/typeAliasWithSamConstructor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("UnboxingNulls.kt")
|
@TestMetadata("UnboxingNulls.kt")
|
||||||
public void testUnboxingNulls() throws Exception {
|
public void testUnboxingNulls() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/UnboxingNulls.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/UnboxingNulls.kt");
|
||||||
|
|||||||
+1
-11
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,23 +16,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.load.java.components
|
package org.jetbrains.kotlin.load.java.components
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor
|
|
||||||
import org.jetbrains.kotlin.types.SimpleType
|
import org.jetbrains.kotlin.types.SimpleType
|
||||||
|
|
||||||
interface SamConversionResolver {
|
interface SamConversionResolver {
|
||||||
companion object EMPTY : SamConversionResolver {
|
companion object EMPTY : SamConversionResolver {
|
||||||
override fun <D : FunctionDescriptor> resolveSamAdapter(original: D) = null
|
|
||||||
override fun resolveSamConstructor(constructorOwner: DeclarationDescriptor, classifier: () -> ClassifierDescriptor?) = null
|
|
||||||
override fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType? = null
|
override fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resolveSamConstructor(constructorOwner: DeclarationDescriptor, classifier: () -> ClassifierDescriptor?): SamConstructorDescriptor?
|
|
||||||
|
|
||||||
fun <D : FunctionDescriptor> resolveSamAdapter(original: D): D?
|
|
||||||
|
|
||||||
fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType?
|
fun resolveFunctionTypeIfSamInterface(classDescriptor: JavaClassDescriptor): SimpleType?
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,7 +18,10 @@ package org.jetbrains.kotlin.load.java.descriptors;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||||
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||||
|
import org.jetbrains.kotlin.descriptors.SourceElement;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl;
|
import org.jetbrains.kotlin.descriptors.impl.ClassConstructorDescriptorImpl;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
@@ -135,5 +138,4 @@ public class JavaClassConstructorDescriptor extends ClassConstructorDescriptorIm
|
|||||||
|
|
||||||
return enhanced;
|
return enhanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -58,7 +58,6 @@ import org.jetbrains.kotlin.types.KotlinType
|
|||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||||
import org.jetbrains.kotlin.utils.SmartSet
|
import org.jetbrains.kotlin.utils.SmartSet
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||||
import org.jetbrains.kotlin.utils.ifEmpty
|
import org.jetbrains.kotlin.utils.ifEmpty
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -85,7 +84,6 @@ class LazyJavaClassMemberScope(
|
|||||||
for (constructor in constructors) {
|
for (constructor in constructors) {
|
||||||
val descriptor = resolveConstructor(constructor)
|
val descriptor = resolveConstructor(constructor)
|
||||||
result.add(descriptor)
|
result.add(descriptor)
|
||||||
result.addIfNotNull(c.components.samConversionResolver.resolveSamAdapter(descriptor))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enhanceSignatures(
|
enhanceSignatures(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.scopes
|
package org.jetbrains.kotlin.resolve.scopes
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
@@ -27,10 +28,14 @@ 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 getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
fun getSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
fun getSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
|
fun getSyntheticConstructors(scope: ResolutionScope, name: Name, location: LookupLocation): Collection<FunctionDescriptor>
|
||||||
|
|
||||||
fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
fun getSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>): Collection<PropertyDescriptor>
|
||||||
fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
fun getSyntheticMemberFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor>
|
||||||
fun getSyntheticStaticFunctions(scope: ResolutionScope): Collection<FunctionDescriptor>
|
fun getSyntheticStaticFunctions(scope: ResolutionScope): Collection<FunctionDescriptor>
|
||||||
|
fun getSyntheticConstructors(scope: ResolutionScope): Collection<FunctionDescriptor>
|
||||||
|
|
||||||
|
fun getSyntheticConstructor(constructor: ConstructorDescriptor): ConstructorDescriptor?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SyntheticScopes {
|
interface SyntheticScopes {
|
||||||
@@ -51,6 +56,9 @@ fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection<Ko
|
|||||||
fun SyntheticScopes.collectSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation)
|
fun SyntheticScopes.collectSyntheticStaticFunctions(scope: ResolutionScope, name: Name, location: LookupLocation)
|
||||||
= scopes.flatMap { it.getSyntheticStaticFunctions(scope, name, location) }
|
= scopes.flatMap { it.getSyntheticStaticFunctions(scope, name, location) }
|
||||||
|
|
||||||
|
fun SyntheticScopes.collectSyntheticConstructors(scope: ResolutionScope, name: Name, location: LookupLocation)
|
||||||
|
= scopes.flatMap { it.getSyntheticConstructors(scope, name, location) }
|
||||||
|
|
||||||
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>)
|
fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection<KotlinType>)
|
||||||
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes) }
|
= scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes) }
|
||||||
|
|
||||||
@@ -59,3 +67,9 @@ fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection<Ko
|
|||||||
|
|
||||||
fun SyntheticScopes.collectSyntheticStaticFunctions(scope: ResolutionScope)
|
fun SyntheticScopes.collectSyntheticStaticFunctions(scope: ResolutionScope)
|
||||||
= scopes.flatMap { it.getSyntheticStaticFunctions(scope) }
|
= scopes.flatMap { it.getSyntheticStaticFunctions(scope) }
|
||||||
|
|
||||||
|
fun SyntheticScopes.collectSyntheticConstructors(scope: ResolutionScope)
|
||||||
|
= scopes.flatMap { it.getSyntheticConstructors(scope) }
|
||||||
|
|
||||||
|
fun SyntheticScopes.collectSyntheticConstructors(constructor: ConstructorDescriptor)
|
||||||
|
= scopes.mapNotNull { it.getSyntheticConstructor(constructor) }
|
||||||
Reference in New Issue
Block a user