Documentation

PT123 Intentional Failure

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

# PT123 Intentional Failure

### NXD Sample:

```nxd
MODULE TEST

FUNC MAIN()
    CONST NAME SET "gabriel"
    LET AGE SET 42
    LET SCORE SET 99.5
    LET ACTIVE SET TRUE

    PRINTLN(NAME)
    PRINTLN(AGE)
    PRINTLN(SCORE)
    PRINTLN(ACTIVE)
```

### 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": [
        {
          "Const": {
            "name": "NAME",
            "value": {
              "Literal": {
                "String": "gabriel"
              }
            }
          }
        },
        {
          "Let": {
            "name": "AGE",
            "value": {
              "Literal": {
                "Int": 42
              }
            }
          }
        },
        {
          "Let": {
            "name": "SCORE",
            "value": {
              "Literal": {
                "Float": 99.5
              }
            }
          }
        },
        {
          "Let": {
            "name": "ACTIVE",
            "value": {
              "Literal": {
                "Bool": true
              }
            }
          }
        },
        {
          "Expr": {
            "Call": {
              "func": "PRINTLN",
              "args": [
                {
                  "Var": "NAME"
                }
              ]
            }
          }
        },
        {
          "Expr": {
            "Call": {
              "func": "PRINTLN",
              "args": [
                {
                  "Var": "AGE"
                }
              ]
            }
          }
        },
        {
          "Expr": {
            "Call": {
              "func": "PRINTLN",
              "args": [
                {
                  "Var": "SCORE"
                }
              ]
            }
          }
        },
        {
          "Expr": {
            "Call": {
              "func": "PRINTLN",
              "args": [
                {
                  "Var": "ACTIVE"
                }
              ]
            }
          }
        }
      ]
    }
  ],
  "statements": []
}
```

### Notes:

intentional semantics failure. The lexer and parser accepted `TRUE` as an identifier rather than recognizing it as a Boolean literal. AST construction, IR lowering, and JSON generation completed successfully.
The Rust semantic analyzer attempted to resolve `TRUE` as a declared symbol and rejected the program with:
`UndefinedSymbol { name: "TRUE" }` All NXD boolean values are lowercase.