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-15853] Re: SE-0299: Static member lookup fails in type that has two tuples. #58127

Open
swift-ci opened this issue Feb 11, 2022 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15853
Radar rdar://problem/88843506
Original Reporter lhunath (JIRA User)
Type Bug
Environment

swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Target: x86_64-apple-macosx12.0

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

md5: 9072a5e40a5bbf5e1fa2d49f3bd2e507

Issue Description:

Consider the following:

public protocol Tint {}
extension UIColor: Tint {}
public extension Tint where Self == UIColor {
    static var hsRed         : UIColor { .systemRed }
}

struct Model {
    let a:   (x: String, y: Tint)?
    let b:   (x: String, y: Tint)?
}

// type of expression is ambiguous without more context
let m = Model(
    a: (x: "", y: .hsRed),
    b: (x: "", y: .hsRed)
)

This code unexpectedly fails to resolve the static member .hsRed, claiming the type is ambiguous (it isn't).

1. Prefixing both or any 1 of the .hsRed with an explicit UIColor resolves the issue.
2. Reducing the members of Model down from 2 to 1 resolves the issue.
3. Reducing the type of the members from a tuple down to a plain Tint? resolves the issue.

It appears there is some interplay happening, perhaps some kind of hierarchical exhaustion, where multiple members and tuple types combine to cause SE-0299 to fail.

@CodaFi
Copy link
Member

CodaFi commented Feb 12, 2022

@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. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants