Don't try to transform sam wrappers in same module

#KT-22304 Fixed
This commit is contained in:
Mikhael Bogdanov
2018-03-07 12:34:45 +01:00
parent 2a6f1d7731
commit c1c8660e55
15 changed files with 110 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/kt22304_1.kt
$TESTDATA_DIR$/kt22304_2.kt
$TESTDATA_DIR$/kt22304_3.kt
-d
$TEMP_DIR$
+1
View File
@@ -0,0 +1 @@
OK
+11
View File
@@ -0,0 +1,11 @@
package test
import java.util.concurrent.Callable
fun test(): String = ""
inline fun String.switchMapOnce(crossinline mapper: (String) -> String): String {
Callable(::test)
return { mapper(this) }()
}
+12
View File
@@ -0,0 +1,12 @@
package beforeTest //package name should be less than imported one
import test.*
fun main(args: Array<String>) {
"O".switchMapOnce {
"K".switchMapOnce {
"OK"
}
}
}
+12
View File
@@ -0,0 +1,12 @@
package ttest //package name should be more than imported one
import test.*
fun foo(): String {
return "O".switchMapOnce {
"K".switchMapOnce {
"OK"
}
}
}
@@ -0,0 +1,26 @@
// FILE: 1.kt
// FULL_JDK
package test
import java.util.concurrent.Callable
fun test(): String = ""
inline fun String.switchMapOnce(crossinline mapper: (String) -> String): String {
Callable(::test)
return { mapper(this) }()
}
// FILE: 2.kt
import test.*
fun box() : String {
return "O".switchMapOnce {
"K".switchMapOnce {
"OK"
}
}
}
@@ -16,7 +16,7 @@ import test.*
fun box(): String {
val anotherModule = doWork { "K" }
if (anotherModule.javaClass.name != "BKt\$box$\$inlined\$doWork$1") return "class should be regenerated, but ${anotherModule.javaClass.name}"
if (anotherModule.javaClass.name != "BKt\$inlined\$sam\$i\$java_util_concurrent_Callable\$0") return "class should be regenerated, but ${anotherModule.javaClass.name}"
return "OK"
}