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:
Mikhail Zarechenskiy
2017-04-11 16:25:18 +03:00
parent 44170f3357
commit e86d52b681
16 changed files with 202 additions and 108 deletions
@@ -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"
}