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.
This commit is contained in:
10
issues/0019-import-non-transitive-c-scope/c_wrapper.sx
Normal file
10
issues/0019-import-non-transitive-c-scope/c_wrapper.sx
Normal file
@@ -0,0 +1,10 @@
|
||||
// This module imports C functions and provides wrappers
|
||||
#import c {
|
||||
#include "vendors/test_c/test.h";
|
||||
#source "vendors/test_c/test.c";
|
||||
};
|
||||
|
||||
// Wrapper function that calls the C function
|
||||
wrapped_add :: (a: s32, b: s32) -> s32 {
|
||||
add_numbers(a, b);
|
||||
}
|
||||
18
issues/0019-import-non-transitive-c-scope/main_bad.sx
Normal file
18
issues/0019-import-non-transitive-c-scope/main_bad.sx
Normal file
@@ -0,0 +1,18 @@
|
||||
// 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;
|
||||
}
|
||||
10
issues/0019-import-non-transitive-c-scope/main_good.sx
Normal file
10
issues/0019-import-non-transitive-c-scope/main_good.sx
Normal file
@@ -0,0 +1,10 @@
|
||||
// Test: calling wrapper functions works (we import the module)
|
||||
#import "../modules/std.sx";
|
||||
#import "c_wrapper.sx";
|
||||
|
||||
main :: () -> s32 {
|
||||
// This should work: calling the sx wrapper
|
||||
result := wrapped_add(10, 20);
|
||||
print("wrapped_add(10, 20) = {}\n", result);
|
||||
0;
|
||||
}
|
||||
6
issues/0019-import-non-transitive-c-scope/other.sx
Normal file
6
issues/0019-import-non-transitive-c-scope/other.sx
Normal file
@@ -0,0 +1,6 @@
|
||||
// This file does NOT import c_wrapper.sx
|
||||
// It should NOT be able to call add_numbers
|
||||
|
||||
use_c_directly :: () -> s32 {
|
||||
add_numbers(5, 3);
|
||||
}
|
||||
Reference in New Issue
Block a user