Native: support Objective-C instancetype in more cases in cinterop
Objective-C has a special type, "instancetype". Generally, it is a type that matches the method receiver type. So, if `Foo.foo` method returns `instancetype`, then `Foo.foo()` would be of type `Foo`, while `Bar.foo()` would be of type `Bar` (where `Bar` is a subclass of `Foo`). Surprisingly, `instancetype` can be used not only as a return type, but also somewhere inside a return type. cinterop wasn't ready for this. This commit expands implementation of `instancetype` in cinterop to cover more cases. ^KT-59597 Fixed
This commit is contained in:
committed by
Space Team
parent
149e1e02f6
commit
2cdf8cd7b1
+1
-1
@@ -388,7 +388,7 @@ internal abstract class ObjCContainerStubBuilder(
|
||||
methods -= superMethods
|
||||
|
||||
// Add some special methods from super types:
|
||||
methods += superMethods.filter { it.returnsInstancetype() || it.isInit }
|
||||
methods += superMethods.filter { it.containsInstancetype() || it.isInit }
|
||||
|
||||
// Add methods from adopted protocols that must be implemented according to Kotlin rules:
|
||||
if (container is ObjCClass) {
|
||||
|
||||
Reference in New Issue
Block a user