[FIR] Properly substitute arguments of error types
This commit is contained in:
committed by
Space Team
parent
edbf199f84
commit
e7148daad2
+1
-1
@@ -41,7 +41,7 @@ FILE: referenceToExtension.kt
|
||||
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval extensionValRef: R|kotlin/reflect/KProperty1<GenericTest.B<*>, GenericTest.A<out kotlin/Any?>>| = Q|GenericTest.B|::R|/GenericTest.extensionVal<CapturedType(*)>|
|
||||
lval extensionFunRef: R|kotlin/reflect/KFunction1<GenericTest.B<*>, GenericTest.A<out kotlin/Any?>>| = Q|GenericTest.B|::R|/GenericTest.extensionFun<CapturedType(*)>|
|
||||
lval extensionFunRef: R|@ExtensionFunctionType kotlin/reflect/KFunction1<GenericTest.B<*>, GenericTest.A<out kotlin/Any?>>| = Q|GenericTest.B|::R|/GenericTest.extensionFun<CapturedType(*)>|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-4
@@ -59,7 +59,6 @@ abstract class AbstractConeSubstitutor(protected val typeContext: ConeTypeContex
|
||||
|
||||
private fun ConeKotlinType.substituteRecursive(): ConeKotlinType? {
|
||||
return when (this) {
|
||||
is ConeErrorType -> return null
|
||||
is ConeClassLikeType -> this.substituteArguments()
|
||||
is ConeLookupTagBasedType -> return null
|
||||
is ConeFlexibleType -> this.substituteBounds()?.let {
|
||||
@@ -131,12 +130,10 @@ abstract class AbstractConeSubstitutor(protected val typeContext: ConeTypeContex
|
||||
return null
|
||||
}
|
||||
|
||||
private fun ConeKotlinType.substituteArguments(): ConeKotlinType? {
|
||||
private fun ConeClassLikeType.substituteArguments(): ConeKotlinType? {
|
||||
val newArguments by lazy { arrayOfNulls<ConeTypeProjection>(typeArguments.size) }
|
||||
var initialized = false
|
||||
|
||||
require(this is ConeClassLikeType) { "Unknown type to substitute: $this, ${this::class}" }
|
||||
|
||||
for ((index, typeArgument) in this.typeArguments.withIndex()) {
|
||||
newArguments[index] = substituteArgument(typeArgument, index)?.also {
|
||||
initialized = true
|
||||
@@ -157,6 +154,12 @@ abstract class AbstractConeSubstitutor(protected val typeContext: ConeTypeContex
|
||||
nullability.isNullable,
|
||||
attributes
|
||||
)
|
||||
is ConeErrorType -> ConeErrorType(
|
||||
diagnostic,
|
||||
isUninferredParameter,
|
||||
newArguments as Array<ConeTypeProjection>,
|
||||
attributes
|
||||
)
|
||||
else -> error("Unknown class-like type to substitute: $this, ${this::class}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user