From ad039a28bd6f1a824e5e1c6714218f00033f6c91 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 26 Aug 2020 13:29:06 +0300 Subject: [PATCH] [NI] Get rid of left FE 1.0 types in NewConstraintSystemImpl --- .../fir/resolve/inference/ConeConstraintSystemUtilContext.kt | 5 +++++ .../components/ClassicConstraintSystemUtilContext.kt | 5 +++++ .../inference/components/ConstraintSystemUtilContext.kt | 1 + .../resolve/calls/inference/model/NewConstraintSystemImpl.kt | 5 ++--- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConeConstraintSystemUtilContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConeConstraintSystemUtilContext.kt index 1790ab9fc44..0b6b9c09fff 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConeConstraintSystemUtilContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConeConstraintSystemUtilContext.kt @@ -26,4 +26,9 @@ object ConeConstraintSystemUtilContext : ConstraintSystemUtilContext { // TODO, see TypeUtils.kt return this } + + override fun TypeVariableMarker.isReified(): Boolean { + // TODO + return false + } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ClassicConstraintSystemUtilContext.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ClassicConstraintSystemUtilContext.kt index f7fd440eafe..11b50456743 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ClassicConstraintSystemUtilContext.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ClassicConstraintSystemUtilContext.kt @@ -27,4 +27,9 @@ object ClassicConstraintSystemUtilContext : ConstraintSystemUtilContext { require(this is KotlinType) return unCaptureKotlinType().unwrap() } + + override fun TypeVariableMarker.isReified(): Boolean { + if (this !is TypeVariableFromCallableDescriptor) return false + return originalTypeParameter.isReified + } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemUtilContext.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemUtilContext.kt index 5ffc947bd6d..53b909496eb 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemUtilContext.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemUtilContext.kt @@ -17,4 +17,5 @@ interface ConstraintSystemUtilContext { fun TypeVariableMarker.shouldBeFlexible(): Boolean fun TypeVariableMarker.hasOnlyInputTypesAttribute(): Boolean fun KotlinTypeMarker.unCapture(): KotlinTypeMarker + fun TypeVariableMarker.isReified(): Boolean } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt index a21363b9375..f34c0d5bb89 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt @@ -363,14 +363,13 @@ class NewConstraintSystemImpl( // ResultTypeResolver.Context, VariableFixationFinder.Context override fun isReified(variable: TypeVariableMarker): Boolean { - if (variable !is TypeVariableFromCallableDescriptor) return false - return variable.originalTypeParameter.isReified + return with(utilContext) { variable.isReified() } } override fun bindingStubsForPostponedVariables(): Map { checkState(State.BUILDING, State.COMPLETION) // TODO: SUB - return storage.postponedTypeVariables.associate { it to createStubType(it)/*StubType(it.freshTypeConstructor() as TypeConstructor, it.defaultType().isMarkedNullable())*/ } + return storage.postponedTypeVariables.associateWith { createStubType(it) } } override fun currentStorage(): ConstraintStorage {