Documentation

PT116 Intentiopnal Failure

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

# PT116 Intentiopnal Failure

NXD Sample:

```nxd
MODULE TEST

FUNC MAIN()
    LET COUNT SET 0

    LOOP:
        PRINTLN(COUNTX)
```

### Result:

FAIL

### Expected Output:

FAIL -

### 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": "COUNT",
            "value": {
              "Literal": {
                "Int": 0
              }
            }
          }
        },
        {
          "Loop": [
            {
              "Expr": {
                "Call": {
                  "func": "PRINTLN",
                  "args": [
                    {
                      "Var": "COUNTX"
                    }
                  ]
                }
              }
            }
          ]
        }
      ]
    }
  ],
  "statements": []
}
```

### Notes:

intentional Semantics failure. COUNT was declared and valid.
COUNTX was never declared.
Parser accepted the identifier reference and IR was successfully generated.
Semantic analysis failed with:
UndefinedSymbol { name: "COUNTX" }