Fix #2004
Fix delegation to constructor of the same class in Objective-C subclasses
This commit is contained in:
committed by
SvyatoslavScherbina
parent
918d131285
commit
49eee47d7e
+2
-1
@@ -2583,7 +2583,8 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
val constructedClass = functionGenerationContext.constructedClass!!
|
||||
val thisPtr = currentCodeContext.genGetValue(constructedClass.thisReceiver!!)
|
||||
|
||||
if (constructedClass.isObjCClass()) {
|
||||
if (descriptor.constructedClass.isExternalObjCClass()) {
|
||||
assert(args.isEmpty())
|
||||
return codegen.theUnitInstanceRef.llvm
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ fun run() {
|
||||
pair.swap()
|
||||
println("${pair.first}, ${pair.second}")
|
||||
|
||||
val defaultPair = MutablePairImpl()
|
||||
assertEquals(defaultPair.first(), 123)
|
||||
assertEquals(defaultPair.second(), 321)
|
||||
|
||||
// equals and hashCode (virtually):
|
||||
val map = mapOf(foo to pair, pair to foo)
|
||||
|
||||
@@ -105,6 +109,8 @@ class MutablePairImpl(first: Int, second: Int) : NSObject(), MutablePairProtocol
|
||||
override fun update(index: Int, sub: Int) {
|
||||
elements[index] -= sub
|
||||
}
|
||||
|
||||
constructor() : this(123, 321)
|
||||
}
|
||||
|
||||
fun testTypeOps() {
|
||||
|
||||
Reference in New Issue
Block a user