Прерывание прерывания: 6 в расширении протокола с определениями typealias

У меня есть следующий код, который компилируется и запускается в Xcode 9.2 Standard Build System и swift build -c release но не компилируется и дает abort trap: 6 когда строить проект с New Build System (Preview) или же swift build

import Foundation

protocol RestProtocol {
    associatedtype PostModelType: Codable
    associatedtype GetModelType: Codable
    associatedtype PostResponseType: Codable
}

extension RestProtocol {
    static func consume(with: [String: Any],
                        completion: @escaping (GetModelType?, Error?) -> Void) {
        completion(nil, nil)
    }

    static func produce(with: PostModelType,
                        completion: @escaping (PostResponseType?, Error?) -> Void) {
        completion(nil, nil)
    }
}

struct Model<T: Codable>: Codable {
    var code: Int?
    var message: String?
    var success: Bool?
    var result: T?
}

struct Service: RestProtocol {
    typealias PostModelType = DetailsModel
    typealias GetModelType = Model<DetailsModel>
    typealias PostResponseType = Model<DetailsModel>
}

struct DetailsModel: Codable {
    var response: String?
}

Service.consume(with: ["Key": "value"]) { (response, error) in
    print("This compiles in Xcode and swift build -c release but gives Abort trap: 6 in swift build")
}

Спасибо за помощь заранее.

1 ответ

Решение

Очевидно, это была проблема в системе сборки, которая путалась с именами файлов с учетом регистра в XCode. Наличие таких файлов, как Account.swift а также account.swift в том же модуле вызовет ошибку.

Другие вопросы по тегам