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-10275] Typealias.Type Crashes when more than 2 protocols are used #52675

Closed
swift-ci opened this issue Apr 2, 2019 · 5 comments
Closed

[SR-10275] Typealias.Type Crashes when more than 2 protocols are used #52675

swift-ci opened this issue Apr 2, 2019 · 5 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Apr 2, 2019

Previous ID SR-10275
Radar None
Original Reporter wmike (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

MacBook Pro (15-inch, 2018)

Processor: 2.6 GHz Intel Core i7

Memory: 16GB 2400 MHz DDR4

Graphics: Radeon Pro 560X 4 GB

              Intel UHD Graphics 630 1536 MB

macOS 10.14.4

Xcode 10.1 (10B61)

Sample code produced and tested inside playground (issue originally discovered in project)

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

md5: 0458219e22269b8ce331a7dd3fa0b82d

Issue Description:

Creating a typealias that is composed of more than two protocols causes a crash when attempting to use an object, that conforms to all types, to a property of that type. Probably easier to understand with an example, so....

protocol One { var string1: String { get } }
extension One { var string1: String { return "string1" } }

protocol Two { var string2: String { get } }
extension Two { var string2: String { return "string2" } }

protocol Three { var string3: String { get } }
extension Three { var string3: String { return "string3" } }

typealias OneAndTwo = One & Two
typealias AllThree = One & Two & Three

class Stringy: One & Two {}
class Stringier: One & Two & Three {}

var firstTwo: OneAndTwo.Type = Stringy.self // Works fine
var allThree: AllThree.Type = Stringier.self // Crashes

Worth noting: if I use `Stringier` in place of `Stringy` on the "Works fine" line, it doesn't crash.

@theblixguy
Copy link
Collaborator

@theblixguy theblixguy commented Apr 3, 2019

This doesn't crash on 5.1 for me

@belkadan
Copy link
Contributor

@belkadan belkadan commented Apr 3, 2019

Doesn't crash on 5.0 for me either. Maybe we fixed it already!

@belkadan
Copy link
Contributor

@belkadan belkadan commented Apr 3, 2019

Mike, can you check with Xcode 10.2 when you get the chance?

@theblixguy
Copy link
Collaborator

@theblixguy theblixguy commented Apr 3, 2019

No crash for me either on 5.0 (Xcode 10.2) and 5.1 (near master).

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented May 14, 2019

Comment by Mike Ole (JIRA)

After upgrading to Xcode 10.2 and swift 5, this seems to no longer be an issue for me either. Thanks for your help.

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

No branches or pull requests

3 participants