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-10926] Abort trap with Error and conditional conformance #53317

Closed
swift-ci opened this issue Jun 13, 2019 · 13 comments
Closed

[SR-10926] Abort trap with Error and conditional conformance #53317

swift-ci opened this issue Jun 13, 2019 · 13 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10926
Radar rdar://problem/56787425
Original Reporter jandamm (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

I tested this code in a dynamic library (iOS) and in the Playground (iOS, macOS).

I'm using macOS 10.14.5
Xcode 10.2 (10E125)
Swift 5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @rjmccall
Priority Medium

md5: bb48ba104a046791cae92a8ebc115236

Issue Description:

Please checkout the attached Playground. There are two crashing examples and two working examples.

I get a compiler error when I have a type with two generic values (like `Result`) where one is constrained to `Error`.
Then I declare a function that takes in a `Result<A, B>` and returns a `Result<A, [B]>`.
And I also declared `Array: Error where Element: Error`.

In contrast I defined my own protocol and tried the same code but with `Array: Arb where Element: Arb` and everything works fine.

It also works until I try to call the function. Otherwise it also compiles fine (not in the Playground).

@belkadan
Copy link
Contributor

Still crashing in Xcode 11b1 too! Something's being mangled incorrectly. @rjmccall, does this look familiar?

@rjmccall
Copy link
Member

rjmccall commented Jul 9, 2019

Surprisingly, this wasn't actually about Error self-conformance; it was a much more general bug with function signatures that mention retroactive conditional conformances. #26019

@rjmccall
Copy link
Member

Fixes landed in master and 5.1.

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Aug 9, 2019

jandamm (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@swift-ci
Copy link
Collaborator Author

Comment by Jan Dammshäuser (JIRA)

I tried with Xcode 11b5 and still got a crash. See lldb-rpc-server_2019-08-16-231847_jans-mbp.crash.

Or do I have to download a Swift snapshot to test?

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Aug 19, 2019

@rjmccall, Could you check what is happening here?

@swift-ci
Copy link
Collaborator Author

Comment by Jan Dammshäuser (JIRA)

Today I got the time to test with the official Xcode 11.1 release and it is still crashing.

@swift-ci
Copy link
Collaborator Author

Comment by Jan Dammshäuser (JIRA)

Here is a small snippet that also produces the crash and has less noice around it:

extension Array: Error where Element: Error {}
func list<E>(_ errors: E...) -> Result<String, [E]> { .failure(errors) }

@belkadan
Copy link
Contributor

@swift-ci create

@theblixguy
Copy link
Collaborator

Works on master (I fixed the crash in appendConcreteProtocolConformance a while ago)

@theblixguy
Copy link
Collaborator

The snippet wasn't enough to produce the crash for me, I had to actually use the list method:

extension Array: Error where Element: Error {}
enum Foo: Error { case bar }
func list<E>(_ errors: E...) -> Result<String, [E]> { .failure(errors) }
print(list([Foo.bar, Foo.bar])) // prints failure([[test.Foo.bar, test.Foo.bar]]) on master

@rjmccall
Copy link
Member

Suyash, should this be resolved, then?

@theblixguy
Copy link
Collaborator

Yes, this should be marked as Resolved!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

5 participants