[IR] Use deepCopyWithSymbols in IrTypeOperatorCall

This commit is contained in:
Ilya Goncharov
2021-03-26 16:20:12 +03:00
committed by TeamCityServer
parent 7046f9badd
commit 084d824984
3 changed files with 7 additions and 13 deletions
@@ -269,8 +269,12 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : BodyLoweringPass {
// assert(!typeParameter.isReified) { "reified parameters have to be lowered before" }
return typeParameter.superTypes.fold<IrType, IrExpression?>(null) { r, t ->
require(argument is IrExpressionWithCopy) { "Not a copyable expression: ${argument.render()}" }
val check = generateTypeCheckNonNull(argument.copy(), t.makeNotNull())
val copy = if (argument is IrExpressionWithCopy) {
argument.copy()
} else {
argument.deepCopyWithSymbols()
}
val check = generateTypeCheckNonNull(copy, t.makeNotNull())
if (r == null) {
check