016 optional parent

✓ Passing This code compiles and runs correctly.

Code

input.kz

Must fail at frontend compile:

Parsing or type-checking must reject the program.

Expected compiler error

error[PARSE003]: import path too deep: 'app/test_lib/net/tcp' has 3 segments after alias (max: 2)
  To fix: add a new alias to koru.json, e.g.:
    "paths": { "mylib": "./path/to/lib" }
  Then use: ~import "mylib/..." (Suggested: extract 'app' as its own alias)
  --> tests/regression/100_MODULE_SYSTEM/110_IMPORTS/110_016_optional_parent/input.kz:18:1
    |
 18 | ~import app/test_lib/net/tcp
    | ^

Error Verification

Expected Error Pattern

This test demonstrates the import depth limit enforcement.

Import paths are limited to maximum 2 segments after the alias:
  ✅ ~import "$alias"
  ✅ ~import "$alias/module"
  ✅ ~import "$alias/module/submodule"
  ❌ ~import "$alias/a/b/c"  (TOO DEEP!)

The error message suggests extracting deeply nested paths as their own aliases in koru.json.

Expected error: PARSE003 - import path too deep

Actual Compiler Output

error[PARSE003]: import path too deep: 'app/test_lib/net/tcp' has 3 segments after alias (max: 2)
  To fix: add a new alias to koru.json, e.g.:
    "paths": { "mylib": "./path/to/lib" }
  Then use: ~import "mylib/..." (Suggested: extract 'app' as its own alias)
  --> tests/regression/100_MODULE_SYSTEM/110_IMPORTS/110_016_optional_parent/input.kz:18:1
    |
 18 | ~import app/test_lib/net/tcp
    | ^

Imported Files

test_lib/net/tcp.kz

Test Configuration

MUST_FAIL