[FIR] Implement Int -> Long conversions for literals and operators over them

^KT-38895
^KT-50996 Fixed
^KT-51000 Fixed
^KT-51003 Fixed
^KT-51018 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-01-25 12:41:04 +03:00
committed by teamcity
parent cc86ca2a0f
commit 52b72a7dac
98 changed files with 1318 additions and 232 deletions
@@ -0,0 +1,24 @@
// FIR_IDENTICAL
// ISSUE: KT-51003
interface Assert<T>
fun <T> createAssert(value: T): Assert<T> = null!!
fun <A, B : Comparable<A>> Assert<B>.isGreaterThanOrEqualTo(other: A) {}
fun test_1(long: Long) {
// FE 1.0: OK
// FIR: ARGUMENT_TYPE_MISMATCH
createAssert(long).isGreaterThanOrEqualTo(10 * 10)
}
fun getNullableLong(): Long? = null
fun takeLong(x: Long) {}
fun test_2() {
val x = getNullableLong() ?: 10 * 60
takeLong(x)
// FE 1.0 infers type of `x` to `Long`
// FIR infers it to `Number` as `CST(Long, Int)`
}