Copy sam wrappers during inline
#KT-21671 Fixed
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// FILE: 1.kt
|
||||
// FULL_JDK
|
||||
|
||||
package test
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
inline fun doWork(noinline job: ()-> Unit) {
|
||||
Executors.callable(job).call()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box() : String {
|
||||
var result = "fail"
|
||||
doWork { result = "OK" }
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// FILE: 1.kt
|
||||
// FULL_JDK
|
||||
|
||||
package test
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
inline fun doWork(noinline job: ()-> Unit) {
|
||||
Executors.callable(job).call()
|
||||
Executors.callable(job).call()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box() : String {
|
||||
var result = ""
|
||||
var value = 1
|
||||
doWork { result += if (value++ == 1) "O" else "K" }
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// FILE: 1.kt
|
||||
// FULL_JDK
|
||||
|
||||
package test
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
inline fun doWork(noinline job: ()-> Unit) {
|
||||
{ Executors.callable(job).call() } ()
|
||||
Executors.callable(job).call()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box() : String {
|
||||
var result = ""
|
||||
var value = 1
|
||||
doWork { result += if (value++ == 1) "O" else "K" }
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// FILE: 1.kt
|
||||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
inline fun doWork(job: ()-> Unit) {
|
||||
job()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
//NO_CHECK_LAMBDA_INLINING
|
||||
import test.*
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
fun box() : String {
|
||||
var result = "fail"
|
||||
doWork {
|
||||
val job = { result = "OK" }
|
||||
Executors.callable(job).call()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// FILE: A.kt
|
||||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
class A(val callable: Callable<String>)
|
||||
|
||||
inline fun doWork(noinline job: () -> String): Callable<String> {
|
||||
val a = A(Callable(job))
|
||||
return a.callable
|
||||
}
|
||||
|
||||
var sameModule = doWork { "O" }
|
||||
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val anotherModule = doWork { "K" }
|
||||
|
||||
if (sameModule.javaClass.name == anotherModule.javaClass.name) return "class should be regenerated, but ${anotherModule.javaClass.name}"
|
||||
if (sameModule.javaClass.name.contains("inlined")) return "Sam in same module shouldn't be copied, but ${sameModule.javaClass.name}"
|
||||
if (!anotherModule.javaClass.name.contains("inlined")) return "Sam in another module should be copied, but ${sameModule.javaClass.name}"
|
||||
|
||||
return sameModule.call() + anotherModule.call()
|
||||
}
|
||||
Reference in New Issue
Block a user