diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index 6e64372e8a5..6bf753df18b 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.resolve.calls.inference.NewConstraintSystem import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintSystemCompleter.ConstraintSystemCompletionMode -import org.jetbrains.kotlin.resolve.calls.inference.components.TrivialConstraintTypeInferenceOracle import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage.Empty.hasContradiction import org.jetbrains.kotlin.resolve.calls.inference.model.ExpectedTypeConstraintPosition import org.jetbrains.kotlin.resolve.calls.model.* @@ -18,11 +17,12 @@ import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.UnwrappedType import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContext +import org.jetbrains.kotlin.types.model.isIntegerLiteralTypeConstructor +import org.jetbrains.kotlin.types.model.typeConstructor class KotlinCallCompleter( private val postponedArgumentsAnalyzer: PostponedArgumentsAnalyzer, - private val kotlinConstraintSystemCompleter: KotlinConstraintSystemCompleter, - private val trivialConstraintTypeInferenceOracle: TrivialConstraintTypeInferenceOracle + private val kotlinConstraintSystemCompleter: KotlinConstraintSystemCompleter ) { fun runCompletion( @@ -201,8 +201,8 @@ class KotlinCallCompleter( val variableWithConstraints = csBuilder.currentStorage().notFixedTypeVariables[constructor] ?: return false val constraints = variableWithConstraints.constraints return constraints.isNotEmpty() && constraints.all { - with(context) { !it.type.typeConstructor().isIntegerLiteralTypeConstructor() } && - it.kind.isLower() && csBuilder.isProperType(it.type) + !it.type.typeConstructor(context).isIntegerLiteralTypeConstructor(context) && + it.kind.isLower() && csBuilder.isProperType(it.type) } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt index de3912a009e..34eb9c2551b 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintIncorporator.kt @@ -122,15 +122,6 @@ class ConstraintIncorporator( null, CaptureStatus.FOR_INCORPORATION ) -// val newCapturedTypeConstructor = NewCapturedTypeConstructor( -// TypeProjectionImpl(Variance.OUT_VARIANCE, otherConstraint.type), -// listOf(otherConstraint.type) -// ) -// val temporaryCapturedType = NewCapturedType( -// CaptureStatus.FOR_INCORPORATION, -// newCapturedTypeConstructor, -// lowerType = null -// ) baseConstraintType.substitute(this, otherVariable, temporaryCapturedType) } ConstraintKind.LOWER -> { @@ -141,15 +132,6 @@ class ConstraintIncorporator( CaptureStatus.FOR_INCORPORATION ) -// val newCapturedTypeConstructor = NewCapturedTypeConstructor( -// TypeProjectionImpl(Variance.IN_VARIANCE, otherConstraint.type), -// emptyList() -// ) -// val temporaryCapturedType = NewCapturedType( -// CaptureStatus.FOR_INCORPORATION, -// newCapturedTypeConstructor, -// lowerType = otherConstraint.type -// ) baseConstraintType.substitute(this, otherVariable, temporaryCapturedType) } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/TrivialConstraintTypeInferenceOracle.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/TrivialConstraintTypeInferenceOracle.kt index 024bb92c860..4a2ae9ed489 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/TrivialConstraintTypeInferenceOracle.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/TrivialConstraintTypeInferenceOracle.kt @@ -7,12 +7,9 @@ package org.jetbrains.kotlin.resolve.calls.inference.components import org.jetbrains.kotlin.resolve.calls.inference.model.Constraint import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintKind -import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable -import org.jetbrains.kotlin.types.UnwrappedType import org.jetbrains.kotlin.types.model.KotlinTypeMarker -import org.jetbrains.kotlin.types.typeUtil.contains -import org.jetbrains.kotlin.types.typeUtil.isNothing -import org.jetbrains.kotlin.types.typeUtil.isNullableNothing +import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContext +import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContextDelegate class TrivialConstraintTypeInferenceOracle(context: TypeSystemInferenceExtensionContextDelegate) : TypeSystemInferenceExtensionContext by context { diff --git a/core/type-system/src/org/jetbrains/kotlin/types/model/typeSystemContextHelpers.kt b/core/type-system/src/org/jetbrains/kotlin/types/model/typeSystemContextHelpers.kt new file mode 100644 index 00000000000..7ffcaf3d142 --- /dev/null +++ b/core/type-system/src/org/jetbrains/kotlin/types/model/typeSystemContextHelpers.kt @@ -0,0 +1,12 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.types.model + +fun KotlinTypeMarker.typeConstructor(context: TypeSystemContext): TypeConstructorMarker = + with(context) { typeConstructor() } + +fun TypeConstructorMarker.isIntegerLiteralTypeConstructor(context: TypeSystemContext): Boolean = + with(context) { isIntegerLiteralTypeConstructor() }