Skip to content

Instantly share code, notes, and snippets.

@JRHeaton
Created July 1, 2019 19:08
Show Gist options
  • Save JRHeaton/24837ac112d8bf6c1e35f19e43df0a6d to your computer and use it in GitHub Desktop.
Save JRHeaton/24837ac112d8bf6c1e35f19e43df0a6d to your computer and use it in GitHub Desktop.
Issue causing segmentation fault (Xcode 10.2.1, Swift 4.2.1)
/* === This code segfaults, and only through much trial & error + commenting out code did I narrow it down to this. === */
/*
protocol PaymentService {
typealias Error = Swift.Error & CustomStringConvertible & Equatable
associatedtype LogInError: PaymentService.Error
}
// MyPaymentService.LogInError does not conform to Swift.Error
*/
/* === This code compiles fine. I believe this is a bug in the compiler (conforming to the typealias,
unless changed deliberately, should behave as in prior Swift versions where it's equivalent to
conforming directly as is done below. === */
protocol PaymentService {
associatedtype LogInError: Swift.Error & CustomStringConvertible & Equatable
}
// MyPaymentService.LogInError DOES conform to Swift.Error
@JRHeaton
Copy link
Author

JRHeaton commented Jul 1, 2019

NOTE: The segfaulting code does compile and run on Xcode 10.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment