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-8763] Compiler hangs when passing inner enum as a generic base class parameter #51271

Closed
MaxDesiatov opened this issue Sep 15, 2018 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself

Comments

@MaxDesiatov
Copy link
Contributor

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

Xcode 9.4.1 Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2) and Xcode 10.0 GM (Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1) on mac 10.13.6

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

md5: eddb8fbacb12de4d44e8f1efd4b3473b

is duplicated by:

  • SR-9160 Nested enums, passed as generic to superclass, cannot conform to RawRepresentable (or inline conform to any other protocol)

Issue Description:

This code causes the compiler to hang in an infinite loop:

import Foundation

class Base<P> {
}

final class Derived: Base<Derived.Inner> {
  enum Inner: Hashable {
  }
}

Interestingly enough, removing `Hashable` makes a difference, this code compiles without a problem:

import Foundation

class Base<P> {
}

final class Derived: Base<Derived.Inner> {
  enum Inner {
  }
}
@belkadan
Copy link
Contributor

Seems to be fixed on master.

@belkadan
Copy link
Contributor

@rjmccall, I knew we had run-time issues with this at one point, but I didn't realize it made a compile-time difference too.

@rjmccall
Copy link
Contributor

Sure, it's not too hard to write naive recursion in the compiler.

@belkadan
Copy link
Contributor

Adding a test case in #23920

@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 itself
Projects
None yet
Development

No branches or pull requests

3 participants