Files
sx/issues/0019-import-non-transitive-c-scope/main_bad.sx
agra 34819f05de issues: relocate legacy examples/issue-* repros into issues/
Clear the examples/issue-* namespace (new layout keeps open-issue repros under
issues/, co-located with their .md). Two legacy files:

- issue-0030 was a feature-request placeholder (trivial main, no real test).
  `extern G : T;` cross-file sx globals are still unimplemented (parse error),
  so it's an open feature request: issues/0030-extern-global-declarations.{md,sx}.
- issue-0019 was a broken/superseded multi-file fixture (relative imports, not
  runnable from root; the non-transitive-#import scenario is covered by the
  passing 0706-modules-import-non-transitive). Moved to
  issues/0019-import-non-transitive-c-scope/ with a status note; safe to delete.

Suite unchanged: 324 passed.
2026-06-01 19:38:09 +03:00

19 lines
642 B
Plaintext

// Test: other.sx calls C functions without importing the C module
// main imports both c_wrapper.sx and other.sx
// other.sx should NOT have access to C functions from c_wrapper
#import "../modules/std.sx";
#import "c_wrapper.sx";
#import "other.sx";
main :: () -> s32 {
// This works: we import c_wrapper so we have transitive access
result := wrapped_add(10, 20);
print("wrapped_add(10, 20) = {}\n", result);
// This calls other.sx's function which tries to call add_numbers
// other.sx did NOT import c_wrapper.sx, so this should fail
bad := use_c_directly();
print("use_c_directly() = {}\n", bad);
0;
}