Skip to content

Instantly share code, notes, and snippets.

@JRHeaton
Created July 1, 2019 19:08
Show Gist options
  • Select an option

  • Save JRHeaton/24837ac112d8bf6c1e35f19e43df0a6d to your computer and use it in GitHub Desktop.

Select an option

Save JRHeaton/24837ac112d8bf6c1e35f19e43df0a6d to your computer and use it in GitHub Desktop.

Revisions

  1. JRHeaton created this gist Jul 1, 2019.
    16 changes: 16 additions & 0 deletions segfault_10_2_1.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    /* === 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