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-13400] Generic placeholders have broken for Any's metatypes. #55841

Open
swift-ci opened this issue Aug 15, 2020 · 6 comments
Open

[SR-13400] Generic placeholders have broken for Any's metatypes. #55841

swift-ci opened this issue Aug 15, 2020 · 6 comments
Labels

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Aug 15, 2020

Previous ID SR-13400
Radar rdar://problem/67363029
Original Reporter Jessy (JIRA User)
Type Bug
Status Reopened
Resolution

Attachment: Download

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

md5: 549e44f9d5ee54d214bfb263868ecd0f

Issue Description:

Any.Type.self and Parameter.Type.self should be the same, but they are not. It's causing me some problems.

@typesanitizer
Copy link

@typesanitizer typesanitizer commented Aug 19, 2020

@swift-ci create

@rjmccall
Copy link
Member

@rjmccall rjmccall commented Aug 28, 2020

They're not the same. `Any.Type` is the type of all types that conform to `Any`, whereas `Parameter.Type` is `Any.Protocol`, which is just the type `Any` itself. The syntax is a bit unfortunate.

@typesanitizer
Copy link

@typesanitizer typesanitizer commented Aug 28, 2020

Jessy (JIRA User) do you have a specific example where you were trying to use this and it didn't work? Maybe we can improve the diagnostic for that case to explain the difference.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Aug 28, 2020

Comment by Jessy Catterwaul (JIRA)

Sorry, maybe I got it wrong. Here's the simplest example of the breaking change:

```swift
struct Error: Swift.Error { }
func succeed<Source, Cast>(if _: Source.Type, is _: Cast.Type) throws {
guard Source.self is Cast.Type else {
throw Error()
}
}

protocol Protocol { }
final class Class: Protocol { }

// These succeed in Xcode 11 but fail in Xcode 12.
try? succeed(if: Class.self, is: Protocol.self)
try? succeed(if: String.self, is: Any.self)
```

What is the real issue? Do you need a new bug report? Feel free to edit this one's title.

@typesanitizer
Copy link

@typesanitizer typesanitizer commented Aug 29, 2020

Jessy (JIRA User) I've reopened the bug report. I tried reproducing the issue with v2 of the playground on Xcode 11 beta 7 and Xcode 12 beta 4 and got a success for both of them.

Could you give more precise Xcode versions? Alternatively, if you could share the output of `xcrun swiftc --version` for each Xcode, that would help.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Aug 29, 2020

Comment by Jessy Catterwaul (JIRA)

Xcode 12 beta 5 and 6 is where I noticed the problem. Here's what I've got in beta 6: Apple Swift version 5.3 (swiftlang-1200.0.28.1 clang-1200.0.30.1)

@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
Projects
None yet
Development

No branches or pull requests

3 participants