FIR+JVM_IR DNN-related fixes
This commit is contained in:
+3
-5
@@ -60,10 +60,6 @@ internal sealed class MetafactoryArgumentsResult {
|
|||||||
// TODO make sure indy and Kotlin bytecode inliner work well together
|
// TODO make sure indy and Kotlin bytecode inliner work well together
|
||||||
object InliningHazard : Failure()
|
object InliningHazard : Failure()
|
||||||
|
|
||||||
// Resulting object should be Serializable.
|
|
||||||
// TODO implement serialization support required by j.l.invoke.LambdaMetafactory
|
|
||||||
object SerializationHazard : Failure()
|
|
||||||
|
|
||||||
// There's something special about a function we are referencing.
|
// There's something special about a function we are referencing.
|
||||||
// Wrapping it into a proxy local function might help.
|
// Wrapping it into a proxy local function might help.
|
||||||
object FunctionHazard : Failure()
|
object FunctionHazard : Failure()
|
||||||
@@ -549,7 +545,9 @@ internal class LambdaMetafactoryArgumentsBuilder(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun computeParameterTypeAdaptationConstraint(adapteeType: IrType, expectedType: IrType): TypeAdaptationConstraint? {
|
private fun computeParameterTypeAdaptationConstraint(adapteeType0: IrType, expectedType0: IrType): TypeAdaptationConstraint? {
|
||||||
|
val adapteeType = adapteeType0.unwrapDefinitelyNotNullType()
|
||||||
|
val expectedType = expectedType0.unwrapDefinitelyNotNullType()
|
||||||
if (adapteeType !is IrSimpleType)
|
if (adapteeType !is IrSimpleType)
|
||||||
throw AssertionError("Simple type expected: ${adapteeType.render()}")
|
throw AssertionError("Simple type expected: ${adapteeType.render()}")
|
||||||
if (expectedType !is IrSimpleType)
|
if (expectedType !is IrSimpleType)
|
||||||
|
|||||||
@@ -1134,11 +1134,13 @@ private fun getContainingDeclaration(declaration: IrDeclaration): DeclarationDes
|
|||||||
fun IrType.toIrBasedKotlinType(): KotlinType = when (this) {
|
fun IrType.toIrBasedKotlinType(): KotlinType = when (this) {
|
||||||
is IrSimpleType ->
|
is IrSimpleType ->
|
||||||
makeKotlinType(classifier, arguments, hasQuestionMark)
|
makeKotlinType(classifier, arguments, hasQuestionMark)
|
||||||
is IrDefinitelyNotNullType ->
|
is IrDefinitelyNotNullType -> {
|
||||||
DefinitelyNotNullType.makeDefinitelyNotNull(this.original.toIrBasedKotlinType().unwrap())
|
val kotlinType = this.original.toIrBasedKotlinType()
|
||||||
?: throw AssertionError("Can't reconstruct a definitely not-null type: ${this.render()}")
|
DefinitelyNotNullType.makeDefinitelyNotNull(kotlinType.unwrap())
|
||||||
|
?: kotlinType
|
||||||
|
}
|
||||||
else ->
|
else ->
|
||||||
TODO(toString())
|
throw AssertionError("Unexpected type: $this = ${this.render()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makeKotlinType(
|
private fun makeKotlinType(
|
||||||
|
|||||||
@@ -70,3 +70,9 @@ fun IrType.toArrayOrPrimitiveArrayType(irBuiltIns: IrBuiltIns): IrType =
|
|||||||
} else {
|
} else {
|
||||||
irBuiltIns.arrayClass.typeWith(this)
|
irBuiltIns.arrayClass.typeWith(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun IrType.unwrapDefinitelyNotNullType(): IrType =
|
||||||
|
if (this is IrDefinitelyNotNullType)
|
||||||
|
this.original.unwrapDefinitelyNotNullType()
|
||||||
|
else
|
||||||
|
this
|
||||||
|
|||||||
Reference in New Issue
Block a user