FIR2IR: fix inverted types for array/element in arrayOf call.

This commit is contained in:
Jinseong Jeon
2020-05-18 11:47:13 -07:00
committed by Mikhail Glukhikh
parent b93868c30b
commit ff509bdcd3
3 changed files with 25 additions and 7 deletions
@@ -108,3 +108,11 @@ fun IrType.getArrayElementType(irBuiltIns: IrBuiltIns): IrType =
irBuiltIns.primitiveArrayElementTypes[classifier]
?: throw AssertionError("Primitive array expected: $classifier")
}
fun IrType.toArrayOrPrimitiveArrayType(irBuiltIns: IrBuiltIns): IrType =
if (isPrimitiveType()) {
irBuiltIns.primitiveArrayForType[this]?.defaultType
?: throw AssertionError("$this not in primitiveArrayForType")
} else {
irBuiltIns.arrayClass.typeWith(this)
}