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-4406] Unable to infer correct overload in constructor leads to infinite recursion #46985

Closed
NachoSoto opened this issue Mar 29, 2017 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@NachoSoto
Copy link
Contributor

Previous ID SR-4406
Radar None
Original Reporter @NachoSoto
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 3.1 (swiftlang-802.0.48 clang-802.0.48)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee @CodaFi
Priority Medium

md5: 99a873ab7d34931b437d707ec6bd15f2

relates to:

  • SR-626 No diagnostic for unconditional recursion

Issue Description:

class A {
  convenience init(a: Int) {
    // This should invoke the other initializer, but instead leads to infinite recursion, without even a warning
    // We need to make it explicit with `.some(a)`
    self.init(a: a)
  }
  init(a: Int?) {}
}

A(a: 1)
@belkadan
Copy link
Contributor

I dropped LanguageFeatureRequest because we'd probably just do a warning. A recursive call in an initializer with exactly the same arguments is always wrong.

@CodaFi
Copy link
Member

CodaFi commented Feb 27, 2018

Resolved by the merge of #11869.

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

3 participants