Constant E0005_IF_EXPRESSION_BODIES_REQUIRE_BRACES

Source
pub const E0005_IF_EXPRESSION_BODIES_REQUIRE_BRACES: ErrorCode;
Expand description

§E0005: if expressions must use braces to delimit their body.

In Compose, the body of an if expression must be enclosed in {}. Unlike some languages that allow single-line, brace-less if statements, Compose requires explicit block delimiters to avoid ambiguity and enforce consistent syntax.


§Example

if true
    let a = true;
// autogenerated

Fix:

if true {
    let a = true;
};

This rule applies to all if, else if, and else blocks used as expressions or statements.

Enforcing block braces ensures a consistent syntax model and avoids subtle bugs related to indentation or accidental semicolon usage.