[NI] Get rid of FE 1.0 types in AbstractTypeApproximator
This commit is contained in:
+2
-2
@@ -13,8 +13,8 @@ FILE: withInInitializer.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val list: R|kotlin/collections/List<it(kotlin/Comparable<it(kotlin/String & kotlin/Int)> & java/io/Serializable)>| = R|kotlin/collections/listOf|<R|it(kotlin/Comparable<it(kotlin/String & kotlin/Int)> & java/io/Serializable)|>(vararg(Int(1), Int(2), Int(3), String()))
|
||||
public get(): R|kotlin/collections/List<it(kotlin/Comparable<it(kotlin/String & kotlin/Int)> & java/io/Serializable)>|
|
||||
public final val list: R|kotlin/collections/List<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|kotlin/collections/listOf|<R|it(kotlin/Comparable<it(kotlin/String & kotlin/Int)> & java/io/Serializable)|>(vararg(Int(1), Int(2), Int(3), String()))
|
||||
public get(): R|kotlin/collections/List<it(kotlin/Comparable<*> & java/io/Serializable)>|
|
||||
|
||||
public final val data: R|First| = R|/First.First|(Int(42))
|
||||
public get(): R|First|
|
||||
|
||||
@@ -235,7 +235,7 @@ class ConeRawType(lowerBound: ConeKotlinType, upperBound: ConeKotlinType) : Cone
|
||||
*/
|
||||
class ConeIntersectionType(
|
||||
val intersectedTypes: Collection<ConeKotlinType>
|
||||
) : ConeSimpleKotlinType(), TypeConstructorMarker {
|
||||
) : ConeSimpleKotlinType(), IntersectionTypeConstructorMarker {
|
||||
override val typeArguments: Array<out ConeTypeProjection>
|
||||
get() = emptyArray()
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.fir.types
|
||||
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic
|
||||
import org.jetbrains.kotlin.fir.isPrimitiveNumberOrUnsignedNumberType
|
||||
import org.jetbrains.kotlin.fir.resolve.*
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.NoSubstitutor
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
|
||||
@@ -316,6 +317,11 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
return this.defaultType
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.isSpecial(): Boolean {
|
||||
// TODO
|
||||
return false
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.isTypeVariable(): Boolean {
|
||||
return this is ConeTypeVariableTypeConstructor
|
||||
}
|
||||
@@ -362,4 +368,10 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
require(this is ConeIntegerLiteralType)
|
||||
return this.getApproximatedType()
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.isSignedOrUnsignedNumberType(): Boolean {
|
||||
require(this is ConeKotlinType)
|
||||
if (this !is ConeClassLikeType) return false
|
||||
return isPrimitiveNumberOrUnsignedNumberType()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,29 +12,35 @@ import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
object PrimitiveTypes {
|
||||
val Boolean = StandardClassIds.Boolean.createType()
|
||||
val Char = StandardClassIds.Char.createType()
|
||||
val Byte = StandardClassIds.Byte.createType()
|
||||
val Short = StandardClassIds.Short.createType()
|
||||
val Int = StandardClassIds.Int.createType()
|
||||
val Long = StandardClassIds.Long.createType()
|
||||
val Float = StandardClassIds.Float.createType()
|
||||
val Double = StandardClassIds.Double.createType()
|
||||
val Boolean: ConeClassLikeType = StandardClassIds.Boolean.createType()
|
||||
val Char: ConeClassLikeType = StandardClassIds.Char.createType()
|
||||
val Byte: ConeClassLikeType = StandardClassIds.Byte.createType()
|
||||
val Short: ConeClassLikeType = StandardClassIds.Short.createType()
|
||||
val Int: ConeClassLikeType = StandardClassIds.Int.createType()
|
||||
val Long: ConeClassLikeType = StandardClassIds.Long.createType()
|
||||
val Float: ConeClassLikeType = StandardClassIds.Float.createType()
|
||||
val Double: ConeClassLikeType = StandardClassIds.Double.createType()
|
||||
}
|
||||
|
||||
private fun ClassId.createType(): ConeClassLikeType =
|
||||
ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(this), emptyArray(), isNullable = false)
|
||||
|
||||
fun ConeClassLikeType.isDouble() = lookupTag.classId == StandardClassIds.Double
|
||||
fun ConeClassLikeType.isFloat() = lookupTag.classId == StandardClassIds.Float
|
||||
fun ConeClassLikeType.isLong() = lookupTag.classId == StandardClassIds.Long
|
||||
fun ConeClassLikeType.isInt() = lookupTag.classId == StandardClassIds.Int
|
||||
fun ConeClassLikeType.isShort() = lookupTag.classId == StandardClassIds.Short
|
||||
fun ConeClassLikeType.isByte() = lookupTag.classId == StandardClassIds.Byte
|
||||
fun ConeClassLikeType.isDouble(): Boolean = lookupTag.classId == StandardClassIds.Double
|
||||
fun ConeClassLikeType.isFloat(): Boolean = lookupTag.classId == StandardClassIds.Float
|
||||
fun ConeClassLikeType.isLong(): Boolean = lookupTag.classId == StandardClassIds.Long
|
||||
fun ConeClassLikeType.isInt(): Boolean = lookupTag.classId == StandardClassIds.Int
|
||||
fun ConeClassLikeType.isShort(): Boolean = lookupTag.classId == StandardClassIds.Short
|
||||
fun ConeClassLikeType.isByte(): Boolean = lookupTag.classId == StandardClassIds.Byte
|
||||
|
||||
private val PRIMITIVE_NUMBER_CLASS_IDS = setOf(
|
||||
fun ConeClassLikeType.isPrimitiveNumberType(): Boolean = lookupTag.classId in PRIMITIVE_NUMBER_CLASS_IDS
|
||||
fun ConeClassLikeType.isPrimitiveUnsignedNumberType(): Boolean = lookupTag.classId in PRIMITIVE_UNSIGNED_NUMBER_CLASS_IDS
|
||||
fun ConeClassLikeType.isPrimitiveNumberOrUnsignedNumberType(): Boolean = isPrimitiveNumberType() || isPrimitiveUnsignedNumberType()
|
||||
|
||||
private val PRIMITIVE_NUMBER_CLASS_IDS: Set<ClassId> = setOf(
|
||||
StandardClassIds.Double, StandardClassIds.Float, StandardClassIds.Long, StandardClassIds.Int,
|
||||
StandardClassIds.Short, StandardClassIds.Byte
|
||||
)
|
||||
|
||||
fun ConeClassLikeType.isPrimitiveNumberType() = lookupTag.classId in PRIMITIVE_NUMBER_CLASS_IDS
|
||||
private val PRIMITIVE_UNSIGNED_NUMBER_CLASS_IDS: Set<ClassId> = setOf(
|
||||
StandardClassIds.ULong, StandardClassIds.UInt, StandardClassIds.UShort, StandardClassIds.UByte
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user