Skip to content

Regression of #133: --reorder-code empties a file whose sole content is a class-level @abstract annotation #256

Description

@minami110

Tested on gdscript-formatter 0.21.0 (Pre-release 0.21.0-beta, published 2026-07-12), Linux x86_64. Upstream main checked up to 248fa13b (2026-07-12 09:20 UTC) — no fix commit found.

Appears to be a regression of the previously-fixed issue #133 "Reorder mode drops the @abstract script annotation" (closed COMPLETED 2025-10-16). The exact scenario reproduces again on 0.21.0-beta.

Impact (critical — silent semantic change)

Before formatting, SomeClass.new() is illegal (script is @abstract). After --reorder-code the file is empty, so SomeClass.new() becomes legal and produces an incomplete instance. No parse error, no warning — the class becomes a plain RefCounted. Any codebase using the "abstract base only, subclasses live in other files" pattern silently loses its abstract guard.

Repro

Entire .gd file:

@abstract

Command:

gdscript-formatter --stdout --reorder-code bug.gd

Actual output with --reorder-code

(empty file)

Actual output without --reorder-code

@abstract

Expected

@abstract preserved in both modes (same as the non---reorder-code behaviour).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions