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-13832] Swift 5.3 generates incorrect swift interface file for classes on non-inherited constructors #56231

Closed
swift-ci opened this issue Nov 6, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself library evolution Feature: library evolution (umbrella feature for features that facilitate resilient libraries)

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Nov 6, 2020

Previous ID SR-13832
Radar rdar://problem/71122015
Original Reporter plinth666 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, LibraryEvolution
Assignee None
Priority Medium

md5: 6ea16f102731f294174d3caaac759dd2

is duplicated by:

  • SR-14263 Missing designated init for constructor with default values

Issue Description:

Given a base class with 2 constructors and a subclass that overrides 1 of them, the swift interface file incorrectly shows the subclass as having 2 constructors.

compile with emit-module-interface and enable-library-evolution:

open class Bass {
        private var x:Int32;
        public init (a: Int32) {
                x = a
        }
        public init (a: Int32, b: Int32) {
                x = a + b
        }
        public func getX() -> Int32 {
                return x
        }
}
open class Mid : Bass {
        public override init (a: Int32, b: Int32) {
                super.init (a:a, b: b)
        }
}

with the resulting .swiftinterface file:

import Swift
open class Bass {
  public init(a: Swift.Int32)
  public init(a: Swift.Int32, b: Swift.Int32)
  public func getX() -> Swift.Int32
  @objc deinit
}
open class Mid : CompilerTests.Bass {
  override public init(a: Swift.Int32, b: Swift.Int32)
  @objc deinit
  override public init(a: Swift.Int32)
}

However `init(a: Swift.Int32)` is not part of `Mid` and will fail if you try to use it.

@typesanitizer
Copy link

@swift-ci create

@slavapestov
Copy link
Member

#36333

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 library evolution Feature: library evolution (umbrella feature for features that facilitate resilient libraries)
Projects
None yet
Development

No branches or pull requests

3 participants