[BE] Support until operator in back-ends

This commit is contained in:
Victor Petukhov
2022-05-24 10:15:03 +02:00
committed by teamcity
parent 2378979a99
commit 96d1f89836
17 changed files with 193 additions and 49 deletions
@@ -487,6 +487,7 @@ private val nameToOperationConventionOrigin = mutableMapOf(
OperatorNameConventions.MOD to IrStatementOrigin.PERC,
OperatorNameConventions.REM to IrStatementOrigin.PERC,
OperatorNameConventions.RANGE_TO to IrStatementOrigin.RANGE,
OperatorNameConventions.RANGE_UNTIL to IrStatementOrigin.RANGE_UNTIL,
OperatorNameConventions.CONTAINS to IrStatementOrigin.IN,
)
@@ -126,6 +126,7 @@ class IrBuiltInsOverFir(
createMemberFunction(OperatorNameConventions.MINUS, intType, "other" to charType, isOperator = true)
val charRange = referenceClassByClassId(StandardClassIds.CharRange)!!.owner.defaultType
createMemberFunction(OperatorNameConventions.RANGE_TO, charRange, "other" to charType, isIntrinsicConst = false)
createMemberFunction(OperatorNameConventions.RANGE_UNTIL, charRange, "other" to charType, isIntrinsicConst = false)
createIntrinsicConstOfToStringAndEquals()
finalizeClassDefinition()
}
@@ -32671,6 +32671,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
}
@Test
@TestMetadata("untilOperator.kt")
public void testUntilOperator() throws Exception {
runTest("compiler/testData/codegen/box/operatorConventions/untilOperator.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/operatorConventions/compareTo")
@TestDataPath("$PROJECT_ROOT")