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:
agra
2026-06-01 19:38:09 +03:00
parent e12f817e52
commit 34819f05de
8 changed files with 104 additions and 57 deletions

View File

@@ -1,10 +0,0 @@
// 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);
}

View File

@@ -1,18 +0,0 @@
// 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;
}

View File

@@ -1,10 +0,0 @@
// 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;
}

View File

@@ -1,6 +0,0 @@
// 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);
}

View File

@@ -1,57 +0,0 @@
// issue-0030: Feature — support `extern` global declarations so a global
// declared in one sx source file can be referenced from another without
// parameter threading.
//
// ── Use case from the Metal port ──────────────────────────────────────────
//
// // game/main.sx
// g_metal_gpu : *MetalGPU = null;
//
// // game/chess/pieces.sx
// extern g_metal_gpu : *MetalGPU;
//
// load :: (self: *ChessPieces, path: [:0]u8) {
// ...
// inline if OS == .ios {
// tex := g_metal_gpu.create_texture(w, h, .rgba8, xx pixels);
// } else {
// // GL path
// }
// }
//
// Today, pieces.load takes `has_gpu: bool, gpu: GPU` parameters and
// game/main.sx threads them through. Cross-file `extern` globals would
// let us drop those parameters.
//
// ── Implementation sketch ─────────────────────────────────────────────────
//
// Mirror how foreign function declarations work — declared in one file,
// defined elsewhere, linker resolves. Globals already have first-class
// addresses in the IR; just add an "extern" flag that says "don't emit
// storage, emit a reference."
//
// Files:
// - parser (sx surface syntax for `extern G : T;`)
// - src/ir/lower.zig (record an extern global stub that resolves at
// module-link time)
// - src/ir/emit_llvm.zig (emit an `external` LLVM global)
//
// ── Syntax constraint ─────────────────────────────────────────────────────
//
// `extern G : T;` is a NEW top-level form. Must not clash with:
// - `G :: T;` (type alias)
// - `G : T = ---;` (uninitialized global with explicit type)
// - `G : T;` (does this currently parse as anything?)
//
// The parser MUST reject `extern G : T = expr;` — extern cannot have an
// initializer (the definition lives elsewhere).
//
// ── Caveat ────────────────────────────────────────────────────────────────
//
// Encourages spaghetti globals. Documentation should steer callers toward
// explicit parameter passing where reasonable. Useful for genuine
// process-singletons (the active GPU, the active platform, etc.) where
// threading them through every call site is more noise than signal.
#import "modules/std.sx";
main :: () -> s32 { 0; }