Files
sx/examples/types/0175-types-negative-literal-global.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

17 lines
552 B
Plaintext

// A negated literal is a compile-time constant for a global initializer:
// ints serialize directly, an integral negative float narrows into an
// integer global (non-integral errors), and boundary values fit exactly.
// Out-of-range negatives get the literal fits-check, not "non-constant".
// Regression (issue 0113): `g : i64 = -1;` was rejected as not a
// compile-time constant (globalInitValue had no unary_op arm).
#import "modules/std.sx";
g1 : i64 = -1;
g2 : i64 = -4.0;
g3 : i8 = -128;
main :: () {
print("{} {} {}\n", g1, g2, g3);
}