Delete deprecated Type.Constructor message, advance ABI version
This commit is contained in:
+2
-10
@@ -37,9 +37,6 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinPlaceHolderStubImpl
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
||||
import org.jetbrains.kotlin.serialization.deserialization.TypeConstructorKind
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getTypeConstructorData
|
||||
|
||||
|
||||
fun createClassStub(parent: StubElement<out PsiElement>, classProto: ProtoBuf.Class, classId: ClassId, context: ClsStubBuilderContext) {
|
||||
ClassClsStubBuilder(parent, classProto, classId, context).build()
|
||||
@@ -54,13 +51,8 @@ private class ClassClsStubBuilder(
|
||||
private val c = outerContext.child(classProto.getTypeParameterList(), classId.getShortClassName())
|
||||
private val typeStubBuilder = TypeClsStubBuilder(c)
|
||||
private val classKind = Flags.CLASS_KIND[classProto.getFlags()]
|
||||
private val supertypeIds = classProto.getSupertypeList().map {
|
||||
type ->
|
||||
val typeConstructorData = type.getTypeConstructorData()
|
||||
assert(typeConstructorData.kind == TypeConstructorKind.CLASS)
|
||||
c.nameResolver.getClassId(typeConstructorData.id)
|
||||
}.let {
|
||||
supertypeIds ->
|
||||
private val supertypeIds = run {
|
||||
val supertypeIds = classProto.supertypeList.map { c.nameResolver.getClassId(it.className) }
|
||||
//empty supertype list if single supertype is Any
|
||||
if (supertypeIds.singleOrNull()?.let { KotlinBuiltIns.isAny(it.asSingleFqName().toUnsafe()) } ?: false) {
|
||||
listOf()
|
||||
|
||||
+9
-16
@@ -36,11 +36,9 @@ import org.jetbrains.kotlin.serialization.ProtoBuf.Type
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Type.Argument.Projection
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.Variance
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
|
||||
import org.jetbrains.kotlin.serialization.deserialization.TypeConstructorKind
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getTypeConstructorData
|
||||
import org.jetbrains.kotlin.types.DynamicTypeCapabilities
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
|
||||
import java.util.ArrayList
|
||||
import java.util.*
|
||||
|
||||
class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
|
||||
|
||||
@@ -56,14 +54,12 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
|
||||
if (type.getNullable()) KotlinPlaceHolderStubImpl<JetNullableType>(typeReference, JetStubElementTypes.NULLABLE_TYPE)
|
||||
else typeReference
|
||||
|
||||
val typeConstructorData = type.getTypeConstructorData()
|
||||
when (typeConstructorData.kind) {
|
||||
TypeConstructorKind.CLASS -> {
|
||||
when {
|
||||
type.hasClassName() ->
|
||||
createClassReferenceTypeStub(effectiveParent, type, annotations)
|
||||
}
|
||||
TypeConstructorKind.TYPE_PARAMETER -> {
|
||||
type.hasTypeParameter() -> {
|
||||
createTypeAnnotationStubs(effectiveParent, annotations)
|
||||
val typeParameterName = c.typeParameters[typeConstructorData.id]
|
||||
val typeParameterName = c.typeParameters[type.typeParameter]
|
||||
createStubForTypeName(ClassId.topLevel(FqName.topLevel(typeParameterName)), effectiveParent)
|
||||
}
|
||||
}
|
||||
@@ -79,7 +75,7 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
|
||||
}
|
||||
}
|
||||
|
||||
val classId = c.nameResolver.getClassId(type.getConstructor().getId())
|
||||
val classId = c.nameResolver.getClassId(type.className)
|
||||
val shouldBuildAsFunctionType = KotlinBuiltIns.isNumberedFunctionClassFqName(classId.asSingleFqName().toUnsafe())
|
||||
&& type.getArgumentList().none { it.getProjection() == Projection.STAR }
|
||||
if (shouldBuildAsFunctionType) {
|
||||
@@ -240,11 +236,8 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
|
||||
}
|
||||
|
||||
private fun Type.isDefaultUpperBound(): Boolean {
|
||||
val typeConstructorData = getTypeConstructorData()
|
||||
if (typeConstructorData.kind != TypeConstructorKind.CLASS) {
|
||||
return false
|
||||
}
|
||||
val classId = c.nameResolver.getClassId(typeConstructorData.id)
|
||||
return KotlinBuiltIns.isAny(classId.asSingleFqName().toUnsafe()) && this.nullable
|
||||
return this.hasClassName() &&
|
||||
c.nameResolver.getClassId(className).let { KotlinBuiltIns.isAny(it.asSingleFqName().toUnsafe()) } &&
|
||||
this.nullable
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user