Skip to content

bug(writer): every empty list property is stored as [""] rather than [] #1607

Description

@Shashankss1205

Split out of #1595 (report 3 of 9) — filed by @rrodriguesNutrium, credit to them.

writer.py:405 (and :409):

b[k] = [str(x) for x in v] if v else [""]

So a function with decorators: [] persists as [""], not []. This affects every language and every list-valued property, args included.

Confirmed still present on current main — an un-annotated Kotlin function stores f.decorators = [""].

It does not break find_dead_code ("" CONTAINS 'Preview' is false, so un-annotated functions are correctly retained), but [""] isn't what any caller means by "none", and it forces every consumer to special-case a one-element list containing the empty string.

Worth checking why the else branch exists before changing it — it may be working around a backend that rejects empty lists, in which case the fix belongs at the read boundary instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Backlog tasks
    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions