Drop TypeLazinessToken and LazyResolveToken
This commit is contained in:
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||
import org.jetbrains.kotlin.container.get
|
||||
import org.jetbrains.kotlin.container.useImpl
|
||||
import org.jetbrains.kotlin.container.useInstance
|
||||
import org.jetbrains.kotlin.context.LazyResolveToken
|
||||
import org.jetbrains.kotlin.context.ModuleContext
|
||||
import org.jetbrains.kotlin.context.ProjectContext
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
@@ -144,7 +143,6 @@ object DefaultAnalyzerFacade : AnalyzerFacade<PlatformAnalysisParameters>() {
|
||||
useInstance(metadataFinderFactory.create(moduleContentScope))
|
||||
|
||||
targetEnvironment.configure(this)
|
||||
useImpl<LazyResolveToken>()
|
||||
}
|
||||
|
||||
override val targetPlatform: TargetPlatform
|
||||
|
||||
@@ -104,15 +104,3 @@ fun ContextForNewModule(
|
||||
val module = ModuleDescriptorImpl(moduleName, projectContext.storageManager, builtIns, multiTargetPlatform)
|
||||
return MutableModuleContextImpl(module, projectContext)
|
||||
}
|
||||
|
||||
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
open class TypeLazinessToken {
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
open fun isLazy(): Boolean = false
|
||||
}
|
||||
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve") class LazyResolveToken : TypeLazinessToken() {
|
||||
@Deprecated("Used temporarily while we are in transition from to lazy resolve")
|
||||
override fun isLazy() = true
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||
import org.jetbrains.kotlin.container.get
|
||||
import org.jetbrains.kotlin.container.useImpl
|
||||
import org.jetbrains.kotlin.container.useInstance
|
||||
import org.jetbrains.kotlin.context.LazyResolveToken
|
||||
import org.jetbrains.kotlin.context.ModuleContext
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
@@ -161,7 +160,6 @@ fun createContainerForLazyResolve(
|
||||
useImpl<CompilerDeserializationConfiguration>()
|
||||
targetEnvironment.configure(this)
|
||||
|
||||
useImpl<LazyResolveToken>()
|
||||
useImpl<ResolveSession>()
|
||||
}
|
||||
|
||||
|
||||
@@ -24,24 +24,18 @@ public class TypeResolutionContext {
|
||||
public final BindingTrace trace;
|
||||
public final boolean checkBounds;
|
||||
public final boolean allowBareTypes;
|
||||
public final boolean forceResolveLazyTypes;
|
||||
public final boolean isDebuggerContext;
|
||||
public final boolean abbreviated;
|
||||
|
||||
public TypeResolutionContext(@NotNull LexicalScope scope, @NotNull BindingTrace trace, boolean checkBounds, boolean allowBareTypes, boolean isDebuggerContext) {
|
||||
this(scope, trace, checkBounds, allowBareTypes, allowBareTypes, isDebuggerContext, false);
|
||||
this(scope, trace, checkBounds, allowBareTypes, isDebuggerContext, false);
|
||||
}
|
||||
|
||||
public TypeResolutionContext(@NotNull LexicalScope scope, @NotNull BindingTrace trace, boolean checkBounds, boolean allowBareTypes, boolean isDebuggerContext, boolean abbreviated) {
|
||||
this(scope, trace, checkBounds, allowBareTypes, allowBareTypes, isDebuggerContext, abbreviated);
|
||||
}
|
||||
|
||||
private TypeResolutionContext(
|
||||
public TypeResolutionContext(
|
||||
@NotNull LexicalScope scope,
|
||||
@NotNull BindingTrace trace,
|
||||
boolean checkBounds,
|
||||
boolean allowBareTypes,
|
||||
boolean forceResolveLazyTypes,
|
||||
boolean isDebuggerContext,
|
||||
boolean abbreviated
|
||||
) {
|
||||
@@ -49,12 +43,12 @@ public class TypeResolutionContext {
|
||||
this.trace = trace;
|
||||
this.checkBounds = checkBounds;
|
||||
this.allowBareTypes = allowBareTypes;
|
||||
this.forceResolveLazyTypes = forceResolveLazyTypes;
|
||||
this.isDebuggerContext = isDebuggerContext;
|
||||
this.abbreviated = abbreviated;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TypeResolutionContext noBareTypes() {
|
||||
return new TypeResolutionContext(scope, trace, checkBounds, false, forceResolveLazyTypes, isDebuggerContext, abbreviated);
|
||||
return new TypeResolutionContext(scope, trace, checkBounds, false, isDebuggerContext, abbreviated);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.util.SmartList
|
||||
import org.jetbrains.kotlin.builtins.createFunctionType
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.context.TypeLazinessToken
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
@@ -62,11 +61,9 @@ class TypeResolver(
|
||||
private val qualifiedExpressionResolver: QualifiedExpressionResolver,
|
||||
private val moduleDescriptor: ModuleDescriptor,
|
||||
private val typeTransformerForTests: TypeTransformerForTests,
|
||||
private val lazinessToken: TypeLazinessToken,
|
||||
private val dynamicTypesSettings: DynamicTypesSettings,
|
||||
private val dynamicCallableDescriptors: DynamicCallableDescriptors,
|
||||
private val identifierChecker: IdentifierChecker,
|
||||
private val wrappedTypeFactory: WrappedTypeFactory,
|
||||
private val platformToKotlinClassMap: PlatformToKotlinClassMap,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
@@ -115,37 +112,16 @@ class TypeResolver(
|
||||
return type(debugType)
|
||||
}
|
||||
|
||||
if (!c.allowBareTypes && !c.forceResolveLazyTypes && lazinessToken.isLazy()) {
|
||||
// Bare types can be allowed only inside expressions; lazy type resolution is only relevant for declarations
|
||||
|
||||
val lazyKotlinType = wrappedTypeFactory.createLazyWrappedType {
|
||||
doResolvePossiblyBareType(c, typeReference).actualType
|
||||
}
|
||||
c.trace.record(resolvedTypeSlice, typeReference, lazyKotlinType)
|
||||
return type(lazyKotlinType)
|
||||
}
|
||||
|
||||
val type = doResolvePossiblyBareType(c, typeReference)
|
||||
if (!type.isBare) {
|
||||
c.trace.record(resolvedTypeSlice, typeReference, type.actualType)
|
||||
}
|
||||
return type
|
||||
}
|
||||
|
||||
private fun doResolvePossiblyBareType(c: TypeResolutionContext, typeReference: KtTypeReference): PossiblyBareType {
|
||||
val typeElement = typeReference.typeElement
|
||||
|
||||
val annotations = resolveTypeAnnotations(c, typeReference)
|
||||
|
||||
val type = resolveTypeElement(c, annotations, typeReference.modifierList, typeElement)
|
||||
val type = resolveTypeElement(c, annotations, typeReference.modifierList, typeReference.typeElement)
|
||||
c.trace.recordScope(c.scope, typeReference)
|
||||
|
||||
if (!type.isBare) {
|
||||
for (argument in type.actualType.arguments) {
|
||||
forceResolveTypeContents(argument.type)
|
||||
}
|
||||
c.trace.record(resolvedTypeSlice, typeReference, type.actualType)
|
||||
}
|
||||
|
||||
return type
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
open class WrappedTypeFactory(private val storageManager: StorageManager) {
|
||||
open fun createLazyWrappedType(computation: () -> KotlinType): KotlinType = LazyWrappedType(storageManager, computation)
|
||||
open fun createDeferredType(trace: BindingTrace, computation: () -> KotlinType): KotlinType = DeferredType.create(storageManager, trace, computation)
|
||||
open fun createRecursionIntolerantDeferredType(trace: BindingTrace, computation: () -> KotlinType): KotlinType = DeferredType.createRecursionIntolerant(storageManager, trace, computation)
|
||||
}
|
||||
open fun createDeferredType(trace: BindingTrace, computation: () -> KotlinType): KotlinType =
|
||||
DeferredType.create(storageManager, trace, computation)
|
||||
|
||||
open fun createRecursionIntolerantDeferredType(trace: BindingTrace, computation: () -> KotlinType): KotlinType =
|
||||
DeferredType.createRecursionIntolerant(storageManager, trace, computation)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user