cli: query expression types and callee paths iteratively

This commit is contained in:
dev committed 2026-10-10 17:21:30 +03:00
1 parent dd73b84085
commit e862e03f2b
5 files changed
+531 -102

No files matched your search

+20
View File
@@ -67,6 +67,26 @@ with tempfile.TemporaryDirectory(prefix='aji-expression-depth-') as directory:
for command in ('lower', 'run', 'report', 'explore'):
assert json.loads(cli(command, path, code=1)) == error
# A cast queries its operand before lowering it. This used to abort
# in peekType even after direct unary lowering had been repaired.
cast_header = header + '('
path = root / f'cast-deref-{depth}.aji'
path.write_text(cast_header + '* ' * depth + '1i64) as i64; }\n')
error = json.loads(cli('check', path, code=1))
col = len(cast_header) - len('module depth\n') + 1 + 2 * (depth - 1)
assert (error['code'], error['line'], error['col'], error['file']) == ('E7005', 2, col, str(path)), error
for command in ('lower', 'run', 'report', 'explore'):
assert json.loads(cli(command, path, code=1)) == error
# Callee lookup and bounded built-in path recognition also stay flat.
for depth in (16384, 65536):
path = root / f'callee-{depth}.aji'
path.write_text('module depth\nfn main() -> i64 effects [] { return ' + 'ns.' * depth + 'unknown() as i64; }\n')
error = json.loads(cli('check', path, code=1))
assert error['code'] == 'E7002' and error['file'] == str(path), error
for command in ('lower', 'run', 'report', 'explore'):
assert json.loads(cli(command, path, code=1)) == error
# Signed boundary literal remains one negative constant; the outer
# checked negation traps rather than changing literal acceptance.
minimum = root / 'minimum.aji'