Skip to content

Report malformed Object::Pad BUILD declarations clearly #1808

Closed

Description

@fglock

Context

PR #1804 added support for valid Object::Pad BUILD { ... } blocks, including execution after field initialization, and passed the CAD::OpenSCAD 0.14 acceptance tests on both JVM and interpreter backends. The original parser failure is fixed.

Remaining diagnostic gap

Malformed or misplaced BUILD syntax should receive a focused compile-time diagnostic. Today, an incomplete class block can fall through into ordinary expression parsing and fail later with a confusing runtime error.

For example, against the merged implementation:

use Object::Pad;
class BadBuild { BUILD method value {} }

currently reports Can't call method "value" on unblessed reference instead of identifying the malformed BUILD declaration.

Follow-up

  • Detect BUILD in a class block when it is not followed by a block body and report a targeted syntax diagnostic.
  • Add project-owned coverage for malformed and out-of-class BUILD declarations.
  • Keep valid Object::Pad BUILD blocks and their constructor behavior unchanged.

Related: #1450, PR #1804.

Activity

  1. added
    area:parserParsing compilation AST and eval behavior
    enhancementNew feature or request
    on Oct 23, 2026
  2. fglock commented on Oct 26, 2026

    @fglock
    OwnerAuthor

    Resolved by PR #1883, merged as 9ce6897. The PR adds malformed and out-of-class Object::Pad BUILD diagnostics with focused regression coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:parserParsing compilation AST and eval behaviorenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions