Skip to content

2.5.0 Changes to CSVWriter.write(row:_) Break Swift Compiler #126

@mgallegly

Description

@mgallegly

Changes made as part of the "Make CSVWriter.write(row:_) generic to accept any Sequence by @bouk in #113" change cause issues with the Swift Compiler.

The below code builds fine using CSV version 2.4.2 but fails using the new 2.5.0 version; with this error:

"The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions"

guard let stream = OutputStream(toFileAtPath: NSString("~/somefile.tsv").expandingTildeInPath, append: false) else { return }
let csvWriter = try CSVWriter(stream: stream, delimiter: "\t")

let v1: Int? = nil
let v2: String? = nil
let v3: String? = nil
let v4: String? = nil
let v5: String? = nil
let v6: String? = nil
let v7: String? = nil
let v8: String? = nil
try csvWriter.write(
    row:
        [
            v1 != nil ? String(v1!) : "",
            v2 ?? "",
            v3 ?? "",
            v4 ?? "",
            v5 ?? "",
            v6 ?? "",
            v7 ?? "",
            v8 ?? ""
        ]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions