Documentation

FT109 Intentional Failure

Back to documentation index
8{
  "@context": "https://nxdlang.org/schema",
  "doc_id": "PT109",
  "title": "PT109 - Intentional Failures",
  "description": "Intentional Test Failures",
  "layer": "Passed Tests",
  "category": "Passed Tests - Nim",
  "keywords": [Nim, Pass, Test],
  "doc_version": "1.0",
  "status": "active"
}

# FT109 Intentional Failure

### NXD Sample:

```nxd
MODULE TEST

FUNC MAIN()
    LET VALID SET TRUE

    IF VALID:
        PRINTLN("True")
```

### Result:

FAIL

### Expected Output:

FAIL - Undefined symbol

### Expected Rejection Stage:

[ ] Lexer
[ ] Parser
[ ] AST
[ ] IR
[X] Semantics
[ ] Backend

### Actual Output:

```json
{
  "module": {
    "name": "TEST",
    "imports": []
  },
  "types": [],
  "traits": [],
  "impls": [],
  "functions": [
    {
      "name": "MAIN",
      "params": [],
      "return_type": null,
      "body": [
        {
          "Let": {
            "name": "VALID",
            "value": {
              "Var": "TRUE"
            }
          }
        },
        {
          "If": {
            "condition": {
              "Var": "VALID"
            },
            "then_branch": [
              {
                "Expr": {
                  "Call": {
                    "func": "PRINTLN",
                    "args": [
                      {
                        "Literal": {
                          "String": "True"
                        }
                      }
                    ]
                  }
                }
              }
            ],
            "else_branch": []
          }
        }
      ]
    }
  ],
  "statements": []
}
```

### Notes:

intentional Semantics failure. NXD requires lowercase boolean literals.
TRUE is interpreted as an identifier rather than a boolean literal.
String literals are exempt from capitalization rules.
Example:
TRUE -> invalid symbol
"True" -> valid string literal
Compiler Result:
UndefinedSymbol { name: "TRUE" }