mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Previously we would copy this attribute from a superclass to the subclass when validating a subclass. However, this is only correct if the superclass is always guaranteed to have been validated before the subclass. Indeed, it appears this assumption is no longer true, so we would sometimes lose track of the attribute, which would result in SILGen failing to emit the ivar initializer entry point. Instead, check for the attribute as part of the superclass walk in checkAncestry(), ensuring the result is always up to date, correct, and cached. As a follow-up, we should also convert checkAncestry() into a request, but I'm not doing that here to keep the fix short. Fixes <rdar://problem/50845438>.
27 lines
801 B
Swift
27 lines
801 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %build-clang-importer-objc-overlays
|
|
|
|
// RUN: %target-swift-emit-silgen(mock-sdk: %clang-importer-sdk-nosource -I %t) -primary-file %s %S/Inputs/ivar_initializer_other.swift | %FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
@requires_stored_property_inits public class MyBase : NSObject {}
|
|
|
|
public class MyMiddle : MyBase {}
|
|
|
|
public class C {}
|
|
|
|
public class MyDerived : MyMiddle {
|
|
var c = C()
|
|
}
|
|
|
|
public class OtherDerived : OtherMiddle {
|
|
var c = C()
|
|
}
|
|
|
|
// CHECK-LABEL: sil hidden [ossa] @$s16ivar_initializer9MyDerivedCfeTo : $@convention(objc_method) (@owned MyDerived) -> @owned MyDerived {
|
|
|
|
// CHECK-LABEL: sil hidden [ossa] @$s16ivar_initializer12OtherDerivedCfeTo : $@convention(objc_method) (@owned OtherDerived) -> @owned OtherDerived {
|