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-10466] Accepts invalid because where clause seems to be ignored. #52866

Closed
jepers opened this issue Apr 12, 2019 · 4 comments
Closed

[SR-10466] Accepts invalid because where clause seems to be ignored. #52866

jepers opened this issue Apr 12, 2019 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@jepers
Copy link

jepers commented Apr 12, 2019

Previous ID SR-10466
Radar None
Original Reporter @jepers
Type Bug
Status Closed
Resolution Done
Environment

Xcode 10.2, macOS 10.14.4

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

md5: 6de39a7eeffdab4b0289c4abdfc194a9

relates to:

  • SR-5440 Typealias in constrained extension misinterprets the where clause

Issue Description:

The following (AFAICS invalid) program still compiles with Swift 5 / Xcode 10.2 and the latest dev snapshot (2019-04-10):

struct S<T> {
    var a : A
}
extension S where T == Never {
    typealias A = Int
}
let v = S<Int>(a: 123)
print(v)

Doesn't this imply/require Int == Never?

More details here:
https://forums.swift.org/t/22995

@belkadan
Copy link
Contributor

I'm pretty sure type lookup just doesn't respect constraints at all. (@slavapestov, this is why I get so surprised when people do clever things with constrained extensions—some of them don't work.)

Jens, I don't think we need two bugs for this; can we dup this to SR-5440?

@slavapestov
Copy link
Member

Yeah, we don't check constraints in all the places we should. Let's dupe this and once we fix it we can verify that all examples in the dupes are fixed.

@jepers
Copy link
Author

jepers commented Apr 12, 2019

Sure, I only filed this as an isolated simplified case of SR-5440, since SR-5440 got a bit too broad and is kind of partly fixed.

@slavapestov
Copy link
Member

#28275

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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

3 participants