frontend: collect independent source diagnostics without cascades
This commit is contained in:
1 parent
2c6c7a3dcd
commit
4cda44823d
47 files changed
+697
-44
No files matched your search
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7002 E7002
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn bad() -> u64 effects [] { let shadow = 1u64; return missing; }
|
||||
fn next() -> u64 effects [] { return shadow; }
|
||||
fn main() -> void effects [] {}
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn bad(n: u64) -> u32 effects [] { return n as u32; }
|
||||
fn main() -> u32 effects [] { return bad(1u64); }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7005 E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn bad(n: u64) -> u32 effects [] { return n as u32; }
|
||||
fn main() -> bool effects [] { return bad(1u64); }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001 E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> u64 effects [] { return 1u64 }
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { return !false; }}
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7002
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn bad<T>(x: T) -> T effects [] { return missing; }
|
||||
fn main() -> void effects [] { let a = bad::<u64>(1u64); let b = bad::<u32>(1u32); }
|
||||
@@ -0,0 +1,5 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001 E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a(s: mut slice<u8>) -> void effects [] {}
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
import lib.bad
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { return @false; }
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,40 @@
|
||||
// expect: reject E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005 E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn f0(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f1(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f2(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f3(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f4(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f5(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f6(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f7(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f8(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f9(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f10(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f11(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f12(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f13(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f14(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f15(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f16(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f17(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f18(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f19(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f20(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f21(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f22(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f23(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f24(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f25(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f26(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f27(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f28(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f29(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f30(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f31(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f32(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f33(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn f34(x: u64) -> u32 effects [] { return x as u32; }
|
||||
fn main() -> void effects [] {}
|
||||
@@ -0,0 +1,40 @@
|
||||
// expect: reject E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001 E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn f0() -> bool effects [] { return !false; }
|
||||
fn f1() -> bool effects [] { return !false; }
|
||||
fn f2() -> bool effects [] { return !false; }
|
||||
fn f3() -> bool effects [] { return !false; }
|
||||
fn f4() -> bool effects [] { return !false; }
|
||||
fn f5() -> bool effects [] { return !false; }
|
||||
fn f6() -> bool effects [] { return !false; }
|
||||
fn f7() -> bool effects [] { return !false; }
|
||||
fn f8() -> bool effects [] { return !false; }
|
||||
fn f9() -> bool effects [] { return !false; }
|
||||
fn f10() -> bool effects [] { return !false; }
|
||||
fn f11() -> bool effects [] { return !false; }
|
||||
fn f12() -> bool effects [] { return !false; }
|
||||
fn f13() -> bool effects [] { return !false; }
|
||||
fn f14() -> bool effects [] { return !false; }
|
||||
fn f15() -> bool effects [] { return !false; }
|
||||
fn f16() -> bool effects [] { return !false; }
|
||||
fn f17() -> bool effects [] { return !false; }
|
||||
fn f18() -> bool effects [] { return !false; }
|
||||
fn f19() -> bool effects [] { return !false; }
|
||||
fn f20() -> bool effects [] { return !false; }
|
||||
fn f21() -> bool effects [] { return !false; }
|
||||
fn f22() -> bool effects [] { return !false; }
|
||||
fn f23() -> bool effects [] { return !false; }
|
||||
fn f24() -> bool effects [] { return !false; }
|
||||
fn f25() -> bool effects [] { return !false; }
|
||||
fn f26() -> bool effects [] { return !false; }
|
||||
fn f27() -> bool effects [] { return !false; }
|
||||
fn f28() -> bool effects [] { return !false; }
|
||||
fn f29() -> bool effects [] { return !false; }
|
||||
fn f30() -> bool effects [] { return !false; }
|
||||
fn f31() -> bool effects [] { return !false; }
|
||||
fn f32() -> bool effects [] { return !false; }
|
||||
fn f33() -> bool effects [] { return !false; }
|
||||
fn f34() -> bool effects [] { return !false; }
|
||||
fn main() -> void effects [] {}
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { return (!false]; }
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects []
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { return !false;
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7001 E7001 E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
struct A { x: mut slice<u8> }
|
||||
enum B { C(ref slice<u8>) }
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,5 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn main() -> bool effects [] { return !false and !true; }
|
||||
@@ -0,0 +1 @@
|
||||
[{"kind":"boolean_negation","hint":"Aji boolean negation is `not`; integer complement is not boolean negation."}]
|
||||
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7002
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn bad(n: Missing) -> u32 effects [] { return n as u32; }
|
||||
fn other(n: u64) -> u32 effects [] { return n as u32; }
|
||||
fn main() -> void effects [] {}
|
||||
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7002 E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn bad() -> void effects [] { for i in 0u64..2u64 { let text = b"abc"; let x = missing; } }
|
||||
fn next(n: u64) -> u32 effects [] { return n as u32; }
|
||||
fn main() -> void effects [] {}
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001 E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a<F: fn(u64) -> u64 effects []>() -> bool effects [] { return !false; }
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7001 E7001 E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { return !false; }
|
||||
fn b() -> u64 effects [] { var x = 1u64; return x; }
|
||||
fn main() -> void effects [] { let x = [zero; 3]; }
|
||||
@@ -0,0 +1,3 @@
|
||||
[{"kind":"boolean_negation","hint":"Aji boolean negation is `not`; integer complement is not boolean negation."}]
|
||||
[{"kind":"annotate_var_type","hint":"Write an explicit type: `var name: T = expression;`. `let` may infer its type."}]
|
||||
[{"kind":"zero_storage","hint":"`zero` is only a whole var initializer: `var name: T = zero;`; T must be zeroable."}]
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
use other;
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,6 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { return !false; };
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7005 E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a(n: u64) -> u32 effects [] { return n as u32; }
|
||||
fn b(n: u64) -> u16 effects [] { return n as u16; }
|
||||
fn main() -> void effects [] {}
|
||||
@@ -0,0 +1,2 @@
|
||||
[{"kind":"numeric_cast_modes","hint":"Choose `as!` for a checked conversion (T0006 on overflow) or `as%` for a wrapping conversion.","alternatives":["as!","as%"]}]
|
||||
[{"kind":"numeric_cast_modes","hint":"Choose `as!` for a checked conversion (T0006 on overflow) or `as%` for a wrapping conversion.","alternatives":["as!","as%"]}]
|
||||
@@ -0,0 +1,7 @@
|
||||
// expect: reject E7001
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10
|
||||
module collection
|
||||
fn a() -> bool effects [] { let text = b"unterminated
|
||||
return !false; }
|
||||
fn main() -> bool effects [] { return !true; }
|
||||
@@ -26,7 +26,6 @@ with tempfile.TemporaryDirectory(prefix='aji-reasons-') as d:
|
||||
('move_copy', 'struct S{x:u64} fn main()->u64 effects [] {let x=S{x:1u64};let y=move x;return 0u64;}'),
|
||||
('move_copy', 'fn main()->u64 effects [] {let x=[1u64;2];let y=move x;return 0u64;}'),
|
||||
('move_borrow', 'fn main()->u64 effects [] {let x=1u64;ref p=x;return move p;}'),
|
||||
('invalid_move', 'fn f(x:void)->u64 effects [] {return move x;} fn main()->u64 effects [] {0u64}'),
|
||||
('loop_control_outside_loop', 'fn main()->void effects [] {break;}'),
|
||||
('zero_not_zeroable', 'fn main()->u64 effects [] {var x:own<u64> = zero;return 0u64;}'),
|
||||
('value_block_statement', 'fn main()->i64 effects [] {{2i64} -3i64}'),
|
||||
@@ -48,6 +47,15 @@ with tempfile.TemporaryDirectory(prefix='aji-reasons-') as d:
|
||||
assert json.loads(invoke('lower', path, code=1)) == error
|
||||
assert invoke('check', path, code=1) == invoke('check', path, code=1)
|
||||
|
||||
# Void parameters are rejected by annotation validation before body
|
||||
# lowering; this must never be attributed to an invalid_move body error.
|
||||
invalid_parameter = root / 'void-parameter.aji'
|
||||
invalid_parameter.write_text('module reasons\nfn f(x:void)->u64 effects [] {return move x;} '
|
||||
'fn main()->u64 effects [] {0u64}\n')
|
||||
error = json.loads(invoke('check', invalid_parameter, code=1))
|
||||
assert (error['code'], error['position'], error['type_constructor']) == ('E7005', 'param', 'void'), error
|
||||
assert 'reason' not in error and json.loads(invoke('lower', invalid_parameter, code=1)) == error
|
||||
|
||||
# Copy substitution in a generic transfer is permitted, not a Copy-move
|
||||
# diagnostic. Borrowed substitution still rejects with its own reason.
|
||||
valid = root / 'generic.aji'
|
||||
@@ -82,7 +90,8 @@ with tempfile.TemporaryDirectory(prefix='aji-reasons-') as d:
|
||||
# Exercise all public standalone E7006 fixtures, without visiting any
|
||||
# benchmark corpus or unrelated untracked directory.
|
||||
registry = (REPO / 'docs/reference/error-codes.md').read_text()
|
||||
reasons = set(re.findall(r'^\| `([a-z_]+)` \|', registry, re.M))
|
||||
reason_section = registry.split('## E7006 reasons\n', 1)[1].split('\n## ', 1)[0]
|
||||
reasons = set(re.findall(r'^\| `([a-z_]+)` \|', reason_section, re.M))
|
||||
fixtures = 0
|
||||
for path in sorted((REPO / 'tests/conformance/source').rglob('*.aji')):
|
||||
if not re.search(r'^// expect: reject E7006\s*$', path.read_text(), re.M):
|
||||
|
||||
@@ -212,7 +212,10 @@ with tempfile.TemporaryDirectory(prefix="aji-format-") as directory:
|
||||
result = subprocess.run([str(AJI), "fmt", str(path)], capture_output=True)
|
||||
checks += 1
|
||||
if result.returncode == 1:
|
||||
assert json.loads(result.stdout)["code"] == "E7001", (path, result.stdout, result.stderr)
|
||||
diagnostics = [json.loads(line) for line in result.stdout.splitlines()]
|
||||
assert diagnostics and len(diagnostics) <= 32, (path, result.stdout, result.stderr)
|
||||
assert all(d["code"] == "E7001" for d in diagnostics), (path, diagnostics)
|
||||
assert [json.loads(line) for line in cli("lower", path, code=1).splitlines()] == diagnostics, path
|
||||
syntax_errors += 1
|
||||
else:
|
||||
assert result.returncode == 0, (path, result.returncode, result.stdout, result.stderr)
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Independent source errors, conservative boundaries, limits and no partial AIR."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
REPO = Path(__file__).resolve().parents[2]
|
||||
AJI = REPO / 'zig-out/bin/aji'
|
||||
CORPUS = REPO / 'tests/conformance/source/independent_errors'
|
||||
checks = 0
|
||||
|
||||
|
||||
def cli(*args, code=1):
|
||||
global checks
|
||||
result = subprocess.run([str(AJI), *map(str, args)], capture_output=True, text=True)
|
||||
assert result.returncode == code, (args, result.returncode, result.stdout[:4000], result.stderr[:4000])
|
||||
checks += 1
|
||||
return result.stdout
|
||||
|
||||
|
||||
def records(output):
|
||||
return [json.loads(line) for line in output.splitlines()]
|
||||
|
||||
|
||||
cache = REPO / '.zig-cache/contract-gate'
|
||||
cache.mkdir(parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix='independent-', dir=cache) as directory:
|
||||
root = Path(directory)
|
||||
lib, entry, manifest = (root / name for name in ('lib.aji', 'main.aji', 'aji.toml'))
|
||||
entry.write_text('module app\nimport lib.collection;\nfn main() -> void effects [] {}\n')
|
||||
manifest.write_text('[package]\nname = "collection"\nversion = "1"\nentry = "main.aji"\n'
|
||||
'[modules]\nlib.collection = "lib.aji"\n')
|
||||
for path in sorted(CORPUS.glob('*.aji')):
|
||||
source = path.read_text()
|
||||
ds = records(cli('check', path))
|
||||
wanted = re.search(r'// expect: reject (.+)', source)[1].split()
|
||||
assert sorted(d['code'] for d in ds) == sorted(wanted), (path, ds)
|
||||
assert len(ds) <= 32 and ds, ds
|
||||
assert all(d['file'] == str(path) and 'air_line' not in d and 'air_code' not in d for d in ds), ds
|
||||
# Exactly one diagnostic per code and source location, in declaration order.
|
||||
assert len({(d['code'], d['file'], d['line'], d['col']) for d in ds}) == len(ds), ds
|
||||
assert [(d['line'], d['col']) for d in ds] == sorted((d['line'], d['col']) for d in ds), ds
|
||||
for command in ('lower', 'run', 'report', 'explore'):
|
||||
assert records(cli(command, path)) == ds
|
||||
assert records(cli('check', path)) == ds
|
||||
if ds[0]['code'] == 'E7001':
|
||||
for mode in ((), ('--check',), ('--write',)):
|
||||
assert records(cli('fmt', *mode, path)) == ds
|
||||
assert path.read_text() == source # failed fmt --write cannot modify input
|
||||
if path.stem == 'three_syntax':
|
||||
assert [d['repair_candidates'][0]['kind'] for d in ds] == [
|
||||
'boolean_negation', 'annotate_var_type', 'zero_storage'], ds
|
||||
elif path.stem in ('limit_syntax', 'limit_bodies'):
|
||||
assert len(ds) == 32 and ds[-1]['line'] == 36, ds
|
||||
elif path.stem == 'generic_body':
|
||||
assert len(ds) == 1 and ds[0]['name'] == 'missing', ds
|
||||
# Imported parser/body failures preserve the list, spans and advice.
|
||||
if path.stem in ('three_syntax', 'two_types', 'callee', 'generic_body', 'state_reset'):
|
||||
lib.write_text(source.replace('module collection', 'module lib.collection')
|
||||
.replace('fn main(', 'fn user('))
|
||||
package = records(cli('check', '--manifest', manifest))
|
||||
assert package == [dict(d, file='lib.aji') for d in ds], package
|
||||
for command in ('lower', 'run', 'report', 'explore'):
|
||||
assert records(cli(command, '--manifest', manifest)) == package
|
||||
|
||||
# The first failed imported module stops traversal of siblings. Its syntax
|
||||
# list is retained; a root syntax failure instead stops before imports.
|
||||
second = root / 'other.aji'
|
||||
second.write_text('module lib.other\nfn bad() -> bool effects [] { return !false; }\n')
|
||||
lib.write_text('module lib.collection\nfn a() -> bool effects [] { return !false; }\n'
|
||||
'fn b() -> bool effects [] { return !true; }\n')
|
||||
entry.write_text('module app\nimport lib.collection;\nimport lib.other;\n'
|
||||
'fn main() -> void effects [] {}\n')
|
||||
manifest.write_text(manifest.read_text() + 'lib.other = "other.aji"\n')
|
||||
ds = records(cli('check', '--manifest', manifest))
|
||||
assert len(ds) == 2 and all(d['file'] == 'lib.aji' for d in ds), ds
|
||||
entry.write_text(entry.read_text().replace('effects [] {}', 'effects [] { let x = !false; }'))
|
||||
ds = records(cli('check', '--manifest', manifest))
|
||||
assert len(ds) == 1 and ds[0]['file'] == str(entry), ds
|
||||
|
||||
# Unimplemented preserves the previous phase outcome when first, but does
|
||||
# not suppress independent errors once body collection has begun.
|
||||
probe = root / 'probe.aji'
|
||||
unsupported = 'fn unsupported() -> void effects [] { 1u64(); }\n'
|
||||
bad = 'fn bad(n: u64) -> u32 effects [] { return n as u32; }\n'
|
||||
main = 'fn main() -> void effects [] {}\n'
|
||||
probe.write_text('module probe\n' + unsupported + bad + main)
|
||||
assert cli('check', probe, code=3) == ''
|
||||
probe.write_text('module probe\n' + bad + unsupported +
|
||||
'fn later(n: u64) -> u16 effects [] { return n as u16; }\n' + main)
|
||||
ds = records(cli('check', probe))
|
||||
assert [d['code'] for d in ds] == ['E7005', 'E7005'], ds
|
||||
for command in ('lower', 'run', 'report', 'explore'):
|
||||
assert records(cli(command, probe)) == ds
|
||||
|
||||
print(f'independent source errors: {checks} checks passed')
|
||||
@@ -96,6 +96,8 @@ with tempfile.TemporaryDirectory(prefix='source-advice-', dir=cache) as director
|
||||
'fn main() -> void effects [] { let mut x = 1u64; }',
|
||||
'fn f(s: mut u64) -> void effects [] {}',
|
||||
'fn f(s: ref [u8; 3]) -> void effects [] {}',
|
||||
'fn f(s: mut.Other slice<u8>) -> void effects [] {}',
|
||||
'fn f(s: ref.Other slice<u8>) -> void effects [] {}',
|
||||
'fn f(s: &[u8; 3]) -> void effects [] {}',
|
||||
'fn f(s: slice<u8>) -> void effects [] { ref t = s[..2usize]; }',
|
||||
'fn f(s: slice<u8>) -> void effects [] { ref t = s[0usize..=2usize]; }',
|
||||
|
||||
Reference in new issue
Block a user