JS: fix Long inlining (private, companion) (KT-24189 fixed).

This commit is contained in:
Anton Bannykh
2018-05-07 20:17:28 +03:00
parent da92c844a6
commit 23fb5107c7
3 changed files with 41 additions and 4 deletions
@@ -26,13 +26,25 @@ fun testLongVal() {
assertEquals(46L, twiceLongValue)
}
private const val privateLongConst = 10 * 10L
internal const val internalLongConst = 10 * 100L
const val longConst = 42L
// PROPERTY_READ_COUNT: name=privateLongConst count=1 scope=testLongConst
// PROPERTY_READ_COUNT: name=L100 count=1 scope=testLongConst
// PROPERTY_READ_COUNT: name=internalLongConst count=1 scope=testLongConst
// PROPERTY_READ_COUNT: name=L1000 count=1 scope=testLongConst
// PROPERTY_READ_COUNT: name=longConst count=1 scope=testLongConst
// PROPERTY_READ_COUNT: name=L42 count=1 scope=testLongConst
// PROPERTY_READ_COUNT: name=L_42 count=4 scope=testLongConst
// PROPERTY_READ_COUNT: name=L84 count=2 scope=testLongConst
fun testLongConst() {
assertEquals(100L, privateLongConst)
assertEquals(1000L, internalLongConst)
val longConstCopy = longConst
assertEquals(42L, longConstCopy)
@@ -144,6 +156,23 @@ private fun testImportedLongConstInlinedLocally() {
testImportedLongConstInlineFunLib1()
}
class A {
companion object {
private const val a = 10L
const val b = 20L
}
fun testCompanion() {
assertEquals(10L, a)
assertEquals(20L, b)
}
}
fun testCompanionVal() {
A().testCompanion()
}
fun testLib1() {
testLongVal()
testLongConst()
@@ -154,6 +183,8 @@ fun testLib1() {
testIntMaxMinValue()
testImportedLongConstInlinedLocally()
testCompanionVal()
}
// MODULE: lib2(lib1)
@@ -230,6 +261,8 @@ fun testLib2() {
testImportedLongConst()
testImportedLongConstInlinedLocallyFromOtherModule()
assertEquals(20L, A.b)
}
// MODULE: main(lib2)