Intrinsify some mismatching range/element combinations for in/in!

It's safe to upcast integer types to Long,
floating-point types to Double.
So we don't have to create a range instance for cases such as

fun testLongInInt(x: Long, a: Int, b: Int) =
    x in a .. b

which is equivalent to

fun testLongInInt(x: Long, a: Int, b: Int) =
    x in a.toLong() .. b.toLong()
This commit is contained in:
Dmitry Petrov
2017-07-06 17:11:21 +03:00
parent d137b04b0a
commit 9d1901fc7c
10 changed files with 130 additions and 20 deletions
@@ -14869,6 +14869,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
doTest(fileName);
}
@TestMetadata("inNonMatchingRange.kt")
public void testInNonMatchingRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inNonMatchingRange.kt");
doTest(fileName);
}
@TestMetadata("inOptimizableDoubleRange.kt")
public void testInOptimizableDoubleRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inOptimizableDoubleRange.kt");