Files
sx/examples/diagnostics/1117-diagnostics-value-const-as-type-rejected.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

19 lines
714 B
Plaintext

// A top-level VALUE constant name used in a type position is rejected. Without
// the fix the unknown-type pass added every `const_decl` name to its declared-
// type set, so a value const (`NotAType :: 123`) satisfied the check and the
// type resolver's unknown-name fallback then fabricated an empty struct — the
// program ran and printed `NotAType{}`. Now only consts whose value introduces a
// type (declarations / type-expression aliases) count as type names.
// Regression (issue 0068).
// Expected: a clean "unknown type 'NotAType'" error at the annotation; exit 1.
#import "modules/std.sx";
NotAType :: 123;
main :: () -> i32 {
v: NotAType = ---;
print("value = {}\n", v);
return 0;
}