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-12354] [5.2] [regression] Types no longer conform to protocol #54788

Closed
swift-ci opened this issue Mar 12, 2020 · 3 comments
Closed

[SR-12354] [5.2] [regression] Types no longer conform to protocol #54788

swift-ci opened this issue Mar 12, 2020 · 3 comments
Labels
associated type inference bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.2

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12354
Radar rdar://problem/60383688
Original Reporter tannernelson (JIRA User)
Type Bug
Environment

Xcode Version 11.4 beta 3 (11N132i)
macOS 10.15

Additional Detail from JIRA
Votes 6
Component/s Compiler
Labels Bug, 5.2Regression, AssociatedTypeInference
Assignee None
Priority Medium

md5: bdc582c5c5b3ebba399c6dbb3afaae12

Issue Description:

https://github.com/vapor/api-template @ af8148b447a16f22db819737ad97da9beef634f5
https://github.com/nodes-vapor/jwt-keychain @ 55dd5703e90c8c673ac62051aca312541a8c40f2

These two projects show examples of a regression in the Swift 5.2 compiler causing many Vapor 3 projects to not compile. To reproduce the bug, compile those commit hashes with Swift 5.2.

The regression is based around this code:

public protocol Model {
    associatedtype Database
}

Each database package introduces types like:

public protocol MySQLModel: Model
    where Self.Database == MySQLDatabase 
{ }

In 5.1 and earlier this allowed for declarations of models to look like:

final class Todo: SQLiteModel {
    ...
}

However, with 5.2, the `Database` typealias must be provided even though it is constrained to a specific type by the protocol being conformed to.

final class Todo: SQLiteModel {
    // Swift 5.2 requires this even though SQLiteModel constrains Database
    // to this exact type. 
    typealias Database = SQLiteDatabase
    ...
}
@weissi
Copy link
Member

weissi commented Mar 12, 2020

@swift-ci create

@weissi
Copy link
Member

weissi commented Mar 12, 2020

CC @DougGregor

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

This is fixed from what I could gather, probably by #32945.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
associated type inference bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.2
Projects
None yet
Development

No branches or pull requests

3 participants