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-11503] Regression on self-referential generic where clauses in Swift 5.1 #53904

Closed
swift-ci opened this issue Sep 21, 2019 · 5 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software generics Feature: generic declarations and types regression serialization Area → compiler: Serialization & deserialization swift 5.1

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11503
Radar rdar://problem/55625744
Original Reporter andrewchang-bird (JIRA User)
Type Bug
Environment
  • macOS 10.14.6 (18G95)

  • Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)

  • Xcode 11 (11A420a)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.1Regression, CompilerCrash, Generics, Serialization
Assignee None
Priority Medium

md5: a10484874437e4d02dc076e577990dae

Issue Description:

In Swift 5.0.1 this declaration compiled successfully:

protocol Type {
  associatedtype Element
}
class GenericType<T: Type> where T.Element == GenericType {}
// also fails: class GenericType<T> where T: Type, T.Element == GenericType {}
// also fails: class GenericType<T> where T: Type, T.Element: GenericType {}

But in Swift 5.1, it now results in an error:

error: Illegal instruction: 4
@theblixguy
Copy link
Collaborator

This doesn't crash for me on master and on Xcode 11 GM (I don't have GM2 installed yet, only GM1 aka build 11A419c).

@belkadan
Copy link
Contributor

It crashes in merge-modules, which makes sense given some of the changes in Serialization this release.

@belkadan
Copy link
Contributor

@swift-ci create

@harlanhaskins
Copy link
Collaborator

This is overflowing the stack trying to resolve these decls

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@slavapestov
Copy link
Member

This definition should never have been accepted. In 5.7 it is rejected, unfortunately we emit the diagnostic three times:

foo.swift:4:7: error: generic class 'GenericType' has self-referential generic requirements
class GenericType<T: Type> where T.Element == GenericType {}
      ^
foo.swift:4:7: error: generic class 'GenericType' has self-referential generic requirements
class GenericType<T: Type> where T.Element == GenericType {}
      ^
foo.swift:4:7: error: generic class 'GenericType' has self-referential generic requirements
class GenericType<T: Type> where T.Element == GenericType {}
      ^

@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
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 crash Bug: A crash, i.e., an abnormal termination of software generics Feature: generic declarations and types regression serialization Area → compiler: Serialization & deserialization swift 5.1
Projects
None yet
Development

No branches or pull requests

6 participants