cli: write composed specialization identities iteratively
This commit is contained in:
1 parent
f5e2af15e8
commit
d98ddbc073
7 files changed
+284
-37
No files matched your search
@@ -0,0 +1,8 @@
|
||||
// expect: reject E7006
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §15.3
|
||||
// Substitution composes argument depth across active specializations.
|
||||
// The fixed expansion guard must reject before native stack exhaustion.
|
||||
module test.composed_growth
|
||||
fn grow<T>() -> void effects [] { grow::<[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[T; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]>(); }
|
||||
fn main() -> void effects [] { grow::<u8>(); }
|
||||
@@ -0,0 +1,8 @@
|
||||
// expect: reject E7006
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §15.3
|
||||
// Substitution composes argument depth across active specializations.
|
||||
// The fixed expansion guard must reject before native stack exhaustion.
|
||||
module test.composed_growth
|
||||
fn grow<T>() -> void effects [] { grow::<[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[T; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]; 1]>(); }
|
||||
fn main() -> void effects [] { grow::<u8>(); }
|
||||
@@ -100,4 +100,19 @@ fn main() -> u32 effects [] {
|
||||
entry.write_text("module app.entry\nimport app.lib;\nfn main() -> u64 effects [] { return app.lib.id::<u64>(); }\n")
|
||||
error = json.loads(cli("check", "--manifest", manifest, code=1))
|
||||
assert error["function"] == "app.lib.id<u64>"
|
||||
# Composed arguments can exceed one ty() traversal's depth while the active
|
||||
# specialization stack is still bounded. Every CLI entry rejects identically.
|
||||
for width in (31, 63):
|
||||
source = REPO / f"tests/conformance/source/generics/composed_identity_growth_{width}.aji"
|
||||
lines = source.read_text().splitlines()
|
||||
line = next(i for i, text in enumerate(lines, 1) if text.startswith("fn grow<"))
|
||||
col = lines[line - 1].index("grow::<") + 1
|
||||
expected = cli("check", source, code=1)
|
||||
diagnostics = [json.loads(text) for text in expected.splitlines()]
|
||||
assert len(diagnostics) == 1, diagnostics
|
||||
error = diagnostics[0]
|
||||
assert (error["code"], error["reason"], error["name"]) == ("E7006", "implementation_limit", "grow"), error
|
||||
assert (error["file"], error["line"], error["col"]) == (str(source), line, col), error
|
||||
for command in ("lower", "report", "run", "explore"):
|
||||
assert cli(command, source, code=1) == expected
|
||||
print(f"source generic CLI integration passed ({checks} checks)")
|
||||
Reference in new issue
Block a user