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-10239] Superclass constraint 'Self.A' : 'Generic<Self.A>' is recursive #52639

Closed
DevAndArtist mannequin opened this issue Mar 30, 2019 · 2 comments
Closed

[SR-10239] Superclass constraint 'Self.A' : 'Generic<Self.A>' is recursive #52639

DevAndArtist mannequin opened this issue Mar 30, 2019 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Mar 30, 2019

Previous ID SR-10239
Radar None
Original Reporter @DevAndArtist
Type Bug
Status In Progress
Resolution
Environment

Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.2.0

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

md5: f91bc71aa7e500ee429bed09cb3a6ba2

Issue Description:

Swift 5 now allows CRTP. It would be great if CRTP constraints could be formed with associated types of a protocol.

class Generic<T> {}

protocol P {
  // CRTP with the associated type.
  // I read this as: the conforming type should have a type `A` that
  // is a sub-class of `Generic<A>` (CRTP).
  associatedtype A: Generic<A> // error: Superclass constraint 'Self.A' : 'Generic<Self.A>' is recursive
}

Forum thread: https://forums.swift.org/t/why-is-this-super-class-constraint-recursive/22340

@AnthonyLatsis
Copy link
Collaborator

This is for starters #31092

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

I don't think we're going to add this.

@slavapestov slavapestov closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2024
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

2 participants