Migration fixes for new inference
This commit is contained in:
+2
-1
@@ -70,6 +70,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProvid
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
|
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.reflect.KFunction1
|
||||||
|
|
||||||
object TopDownAnalyzerFacadeForJVM {
|
object TopDownAnalyzerFacadeForJVM {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -161,7 +162,7 @@ object TopDownAnalyzerFacadeForJVM {
|
|||||||
|
|
||||||
val configureJavaClassFinder =
|
val configureJavaClassFinder =
|
||||||
if (configuration.getBoolean(JVMConfigurationKeys.USE_JAVAC)) StorageComponentContainer::useJavac
|
if (configuration.getBoolean(JVMConfigurationKeys.USE_JAVAC)) StorageComponentContainer::useJavac
|
||||||
else null
|
else null as KFunction1<StorageComponentContainer, Unit>?
|
||||||
|
|
||||||
val dependencyModule = if (separateModules) {
|
val dependencyModule = if (separateModules) {
|
||||||
val dependenciesContext = ContextForNewModule(
|
val dependenciesContext = ContextForNewModule(
|
||||||
|
|||||||
+3
-1
@@ -37,7 +37,9 @@ fun createJvmProfile(targetRoot: File, version: Int): Profile = Profile("JVM$ver
|
|||||||
fun createJsProfile(targetRoot: File): Profile = Profile("JS", JsPlatformEvaluator(), File(targetRoot, "js"))
|
fun createJsProfile(targetRoot: File): Profile = Profile("JS", JsPlatformEvaluator(), File(targetRoot, "js"))
|
||||||
|
|
||||||
val profileEvaluators: Map<String, () -> Evaluator> =
|
val profileEvaluators: Map<String, () -> Evaluator> =
|
||||||
listOf(6, 7, 8).associateBy({ version -> "JVM$version" }, { version -> { JvmPlatformEvaluator(version) } }) + ("JS" to { JsPlatformEvaluator() })
|
listOf(6, 7, 8)
|
||||||
|
.associateBy({ version -> "JVM$version" }, { version -> { JvmPlatformEvaluator(version) } })
|
||||||
|
.plus<String, () -> PlatformEvaluator>(("JS" to { JsPlatformEvaluator() }))
|
||||||
|
|
||||||
fun createProfile(name: String, targetRoot: File): Profile {
|
fun createProfile(name: String, targetRoot: File): Profile {
|
||||||
val (profileName, evaluator) = profileEvaluators.entries.firstOrNull { it.key.equals(name, ignoreCase = true) } ?: throw IllegalArgumentException("Profile with name '$name' is not supported")
|
val (profileName, evaluator) = profileEvaluators.entries.firstOrNull { it.key.equals(name, ignoreCase = true) } ?: throw IllegalArgumentException("Profile with name '$name' is not supported")
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class LazyModuleDependencies<M : ModuleInfo>(
|
|||||||
) : ModuleDependencies {
|
) : ModuleDependencies {
|
||||||
private val dependencies = storageManager.createLazyValue {
|
private val dependencies = storageManager.createLazyValue {
|
||||||
val moduleDescriptor = resolverForProject.descriptorForModule(module)
|
val moduleDescriptor = resolverForProject.descriptorForModule(module)
|
||||||
buildSequence {
|
buildSequence<ModuleDescriptorImpl> {
|
||||||
if (firstDependency != null) {
|
if (firstDependency != null) {
|
||||||
yield(resolverForProject.descriptorForModule(firstDependency))
|
yield(resolverForProject.descriptorForModule(firstDependency))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.resolve.calls.context.CallPosition
|
|||||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
|
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
|
import org.jetbrains.kotlin.resolve.calls.inference.isCaptured
|
||||||
import org.jetbrains.kotlin.resolve.calls.inference.wrapWithCapturingSubstitution
|
import org.jetbrains.kotlin.resolve.calls.inference.wrapWithCapturingSubstitution
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.TypeConstructorSubstitution
|
import org.jetbrains.kotlin.types.TypeConstructorSubstitution
|
||||||
@@ -56,11 +57,11 @@ fun ResolutionContext<*>.reportTypeMismatchDueToTypeProjection(
|
|||||||
callPosition.resolvedCall, { f: CallableDescriptor ->
|
callPosition.resolvedCall, { f: CallableDescriptor ->
|
||||||
getEffectiveExpectedType(f.valueParameters[callPosition.valueParameter.index], callPosition.valueArgument, this)
|
getEffectiveExpectedType(f.valueParameters[callPosition.valueParameter.index], callPosition.valueArgument, this)
|
||||||
})
|
})
|
||||||
is CallPosition.ExtensionReceiverPosition -> Pair(
|
is CallPosition.ExtensionReceiverPosition -> Pair<ResolvedCall<*>, (CallableDescriptor) -> KotlinType?>(
|
||||||
callPosition.resolvedCall, { f: CallableDescriptor ->
|
callPosition.resolvedCall, { f: CallableDescriptor ->
|
||||||
f.extensionReceiverParameter?.type
|
f.extensionReceiverParameter?.type
|
||||||
})
|
})
|
||||||
is CallPosition.PropertyAssignment -> Pair(
|
is CallPosition.PropertyAssignment -> Pair<ResolvedCall<out CallableDescriptor>, (CallableDescriptor) -> KotlinType?>(
|
||||||
callPosition.leftPart.getResolvedCall(trace.bindingContext) ?: return false, { f: CallableDescriptor ->
|
callPosition.leftPart.getResolvedCall(trace.bindingContext) ?: return false, { f: CallableDescriptor ->
|
||||||
(f as? PropertyDescriptor)?.setter?.valueParameters?.get(0)?.type
|
(f as? PropertyDescriptor)?.setter?.valueParameters?.get(0)?.type
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -704,7 +704,7 @@ class DoubleColonExpressionResolver(
|
|||||||
?.apply { commitTrace() }?.results
|
?.apply { commitTrace() }?.results
|
||||||
}
|
}
|
||||||
|
|
||||||
val resultSequence = buildSequence {
|
val resultSequence = buildSequence<ResolutionResultsAndTraceCommitCallback> {
|
||||||
when (lhs) {
|
when (lhs) {
|
||||||
is DoubleColonLHS.Type -> {
|
is DoubleColonLHS.Type -> {
|
||||||
val classifier = lhsType.constructor.declarationDescriptor
|
val classifier = lhsType.constructor.declarationDescriptor
|
||||||
|
|||||||
Reference in New Issue
Block a user