{
"@context": "https://nxdlang.org/schema",
"doc_id": "PT017",
"title": "strings",
"description": "NXD Compiler Testing Notes - Nim",
"layer": "Passed Tests",
"category": "Passed Tests",
"keywords": [Transpilation, Compiler, Nim],
"doc_version": "1.0",
"status": "active"
}
# PT017 (micro test) STRINGS
### NXD Sample:
```nxd
MODULE TEST
FUNC MAIN()
LET X SET 2
MATCH X:
CASE 1:
PRINTLN("ONE")
CASE 2:
PRINTLN("TWO")
OTHERWISE:
PRINTLN("OTHER")
```
### Result:
COMPILER: PASS *(see notes)
SEMANTICS: PASS
Expected Output:
### Actual Output:
```json
{
"module": {
"name": "TEST",
"imports": []
},
"types": [],
"traits": [],
"impls": [],
"functions": [
{
"name": "MAIN",
"params": [],
"return_type": null,
"body": [
{
"Let": {
"name": "X",
"value": {
"Literal": {
"Int": 2
}
}
}
},
{
"Match": {
"scrutinee": {
"Var": "X"
},
"arms": [
{
"pattern": 1,
"body": [
{
"Expr": {
"Call": {
"func": "PRINTLN",
"args": [
{
"Literal": {
"String": "ONE"
}
}
]
}
}
}
]
},
{
"pattern": 2,
"body": [
{
"Expr": {
"Call": {
"func": "PRINTLN",
"args": [
{
"Literal": {
"String": "TWO"
}
}
]
}
}
}
]
}
],
"otherwise": [
{
"Expr": {
"Call": {
"func": "PRINTLN",
"args": [
{
"Literal": {
"String": "OTHER"
}
}
]
}
}
}
]
}
}
]
}
],
"statements": []
}
```
### Notes:
#### Validation Notes
MATCH keyword parsed successfully.
CASE clauses parsed successfully.
OTHERWISE clause parsed successfully.
AST generation completed.
IR generation completed.
JSON emitted successfully.
Rust backend rejected the pattern type during deserialization.
#### Technical Significance
This demonstrates that MATCH/CASE constructs are recognized by the NXD frontend and can be represented in generated IR. The current failure occurs at the Rust handoff stage due to a mismatch between the frontend JSON pattern representation and the Rust IR contract.
Documentation