Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12653] Module interface error: not override a designated initializer #55096

Closed
swift-ci opened this issue Apr 22, 2020 · 2 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12653
Radar None
Original Reporter leavez (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

xcode 11.4

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 485d122dc3a2637b646b6e8fa436f14c

Issue Description:

Problem

The generated module interface file below will got an error when parsed by xcode.

// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
// swift-module-flags: -target x86_64-apple-ios8.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Onone -module-name A
@_exported import A
import Foundation
import Swift
@_hasMissingDesignatedInitializers public class Base {
  @objc deinit
}
@_inheritsConvenienceInitializers public class Child : A.Base {
  override public init()
  @objc deinit
}

("A" is the name of the framework)

Source code

public class Base {
    init() {}
}

public class Child: Base {
    public override init() {
        super.init()
    }
}

Steps to Reproduce

  1. build a framework with the source above, with "Build Libraries for Distribution" enabled

  2. delete the .swiftinterface files in the framework

  3. add the generated framework to another project, import and build

Why Important

The module interface cannot be used , which means module stability never achieve its goal.

@slavapestov
Copy link
Member

This was fixed on master already by @nkcsgexi:

commit 75abee8f4588d2b120b2cd7a7c7e74fe2079dddd
Author: Xi Ge <xi_ge@apple.com>
Date:   Thu Mar 19 11:41:07 2020 -0700

    ModuleInterface: skip override keywords when overriding an invisible decl from super class
    
    When we are printing Swift interface, we have to skip the override keyword
    if the overriden decl is invisible from the interface. Otherwise, an error
    will occur while building the Swift module because the overriding decl
    doesn't override anything.
    
    We couldn't skip every `override` keywords because they change the
    ABI if the overriden decl is also publicly visible.
    
    For public-override-internal case, having `override` doesn't have ABI
    implication. Thus we can skip them.
    
    rdar://58562780

@typesanitizer
Copy link

Small addition to Slava's comment: since this was fixed in March, this fix is present on the Swift 5.3 branch.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants