Fix return type of private members that return anonymous object
#KT-16813 Fixed Anonymous objects returned from private-in-file members should behave as for private class members
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
interface IFoo {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
interface IBar
|
||||
|
||||
private fun createAnonObject() =
|
||||
object : IFoo, IBar {
|
||||
override fun foo() = "foo"
|
||||
fun qux(): String = "qux"
|
||||
}
|
||||
|
||||
fun useAnonObject() {
|
||||
createAnonObject().foo()
|
||||
createAnonObject().qux()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (createAnonObject().foo() != "foo") return "fail 1"
|
||||
if (createAnonObject().qux() != "qux") return "fail 2"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user