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-13341] Conditional conformance causes seemingly spurious compiler error #55781

Open
jeremyabannister opened this issue Aug 4, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@jeremyabannister
Copy link

Previous ID SR-13341
Radar rdar://problem/74854312
Original Reporter @jeremyabannister
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 0f46ba06f9d8df993aab17b87a2440a7

Issue Description:

Below is the somewhat complex setup which yields the compiler error that I am stuck with:

protocol A {
    associatedtype T
}


protocol B: A where T: B, T.U == U {
    associatedtype U
}


protocol C: B where T: C, U: Numeric {
    
}


protocol D: C where T: D, U == Int {
    
}


struct X <U>: B {
    typealias T = X<U>
}


extension X: C where U: Numeric {
    
}


extension X: D where U == Int {
    
}


struct Y: C {
    typealias U = Double
    typealias T = X<U>
}

The error occurs on the line:

struct Y: C {

and reads:

'B' requires the types 'Y.U' (aka 'Double') and 'Int' be equivalent

Simply removing this conditional conformance:

extension X: D where U == Int {
    
}

allows the code to compile successfully. This seems to me like a compiler bug, but I realize that I may be missing something here. Thanks!

@slavapestov
Copy link
Member

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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.
Projects
None yet
Development

No branches or pull requests

2 participants