mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Fix for KT-7557: NoSuchMethodError when capturing receiver in object expression
#KT-7557 Fixed #KT-7769 Fixed
This commit is contained in:
22
compiler/testData/codegen/bytecodeText/kt7769.kt
Normal file
22
compiler/testData/codegen/bytecodeText/kt7769.kt
Normal file
@@ -0,0 +1,22 @@
|
||||
interface B<T> {
|
||||
val bar: T
|
||||
}
|
||||
|
||||
class S(val value: String) {
|
||||
|
||||
fun bar() = value
|
||||
|
||||
fun foo(): B<String> {
|
||||
val p = S("OK");
|
||||
return object : B<String> {
|
||||
//we shouldn't capture this@S in such case
|
||||
override val bar: String = p.bar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return S("fail").foo().bar
|
||||
}
|
||||
|
||||
// 0 this$0
|
||||
Reference in New Issue
Block a user