Skip to content

zig fmt - weird behavior with multiline strings and lists #3739

@kristoff-it

Description

@kristoff-it

Run zig fmt on the following snippet to reproduce:

fn main() void {
    myFunc(.{ "SET", "divine",
            \\When half way through the journey of our life
            \\I found that I was in a gloomy wood,
            \\because the path which led aright was lost.
            \\And ah, how hard it is to say just what
            \\this wild and rough and stubborn woodland was,
            \\the very thought of which renews my fear!
    });
}

Current result:

fn main() void {
    myFunc(.{
        "SET",                                                                                                                                                                                                                                                                                                                             "divine",
            \\When half way through the journey of our life
            \\I found that I was in a gloomy wood,
            \\because the path which led aright was lost.
            \\And ah, how hard it is to say just what
            \\this wild and rough and stubborn woodland was,
            \\the very thought of which renews my fear!
        });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.frontendTokenization, parsing, AstGen, Sema, and Liveness.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions