[FIR] Add creating simple type for type parameters symbols
This commit is contained in:
+8
-6
@@ -12,12 +12,10 @@ import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
|||||||
import org.jetbrains.kotlin.fir.resolve.withArguments
|
import org.jetbrains.kotlin.fir.resolve.withArguments
|
||||||
import org.jetbrains.kotlin.fir.resolve.withNullability
|
import org.jetbrains.kotlin.fir.resolve.withNullability
|
||||||
import org.jetbrains.kotlin.fir.service
|
import org.jetbrains.kotlin.fir.service
|
||||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeSymbol
|
import org.jetbrains.kotlin.fir.symbols.*
|
||||||
import org.jetbrains.kotlin.fir.symbols.ConeClassifierSymbol
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.invoke
|
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassTypeImpl
|
||||||
|
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||||
import org.jetbrains.kotlin.types.AbstractTypeCheckerContext
|
import org.jetbrains.kotlin.types.AbstractTypeCheckerContext
|
||||||
import org.jetbrains.kotlin.types.model.*
|
import org.jetbrains.kotlin.types.model.*
|
||||||
@@ -59,12 +57,16 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext,
|
|||||||
nullable: Boolean
|
nullable: Boolean
|
||||||
): SimpleTypeMarker {
|
): SimpleTypeMarker {
|
||||||
require(constructor is ConeClassifierSymbol)
|
require(constructor is ConeClassifierSymbol)
|
||||||
when (constructor) {
|
return when (constructor) {
|
||||||
is ConeClassLikeSymbol -> return ConeClassTypeImpl(
|
is ConeClassLikeSymbol -> ConeClassTypeImpl(
|
||||||
constructor.toLookupTag(),
|
constructor.toLookupTag(),
|
||||||
(arguments as List<ConeKotlinTypeProjection>).toTypedArray(),
|
(arguments as List<ConeKotlinTypeProjection>).toTypedArray(),
|
||||||
nullable
|
nullable
|
||||||
)
|
)
|
||||||
|
is ConeTypeParameterSymbol -> ConeTypeParameterTypeImpl(
|
||||||
|
constructor.toLookupTag(),
|
||||||
|
nullable
|
||||||
|
)
|
||||||
else -> error("!")
|
else -> error("!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
FILE: typeParameterDerived.kt
|
||||||
|
public final inline fun <K, V, VA : R|V|> R|kotlin/collections/MutableMap<K, V>|.getOrPut(key: R|K|, defaultValue: R|kotlin/Function1<K, VA>|, postCompute: R|kotlin/Function1<VA, kotlin/Unit>|): R|V| {
|
||||||
|
lval value: R|V| = R|FakeOverride<kotlin/collections/Map.get: R|V|>|(R|<local>/key|)
|
||||||
|
^getOrPut when () {
|
||||||
|
==(R|<local>/value|, Null(null)) -> {
|
||||||
|
lval answer: R|VA| = R|<local>/defaultValue|.R|FakeOverride<kotlin/Function1.invoke: R|VA|>|(R|<local>/key|)
|
||||||
|
R|FakeOverride<kotlin/collections/MutableMap.put: R|V|>|(R|<local>/key|, R|<local>/answer|)
|
||||||
|
R|<local>/postCompute|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/answer|)
|
||||||
|
R|<local>/answer|
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
R|<local>/value|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user