JVM_IR: Add null-checks in SAM wrapper constructors (KT-50108)

This commit is contained in:
Steven Schäfer
2021-12-08 11:17:58 +01:00
committed by Alexander Udalov
parent 7f531d8426
commit 0da23198e6
7 changed files with 102 additions and 3 deletions
@@ -291,9 +291,7 @@ class ExpressionCodegen(
irFunction.origin.isSynthetic ||
// TODO: refine this condition to not generate nullability assertions on parameters
// corresponding to captured variables and anonymous object super constructor arguments
(irFunction is IrConstructor &&
(irFunction.parentAsClass.isAnonymousObject ||
irFunction.parentAsClass.origin == IrDeclarationOrigin.GENERATED_SAM_IMPLEMENTATION)) ||
(irFunction is IrConstructor && irFunction.parentAsClass.isAnonymousObject) ||
// TODO: Implement this as a lowering, so that we can more easily exclude generated methods.
irFunction.origin == JvmLoweredDeclarationOrigin.INLINE_CLASS_GENERATED_IMPL_METHOD ||
// Although these are accessible from Java, the functions they bridge to already have the assertions.