You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
t27o: the oracle samples texts that never reach a match arm, so text predicates pass vacuously #9102
Part of the t27o epic (see #8998). Found by the dogfood run of tri t27o on bootstrap/src/compiler.rs (see #9090, see #9093).
The oracle passes a text parameter the same fixed samples every time: "", "a", "abc", "0", "42", "0x1f", "a b" and "-7". compiler.rs is full of predicates that match a type name or an operator. For every one of them, all 8 vectors reach the default arm. Of the 15 compiler.rs helpers that t27o converted, the 7 with a text parameter all have only default-arm vectors:
zig_uint_bits, int_value_bits, int_rank and is_integer_type_suffix;
compound_binop, is_icarus_builtin and has_empty_operand.
So "oracle-equivalent" says nothing about the arms. A body with every arm but the default deleted passes the same 8 asserts. In #9093 the port had to add 26 hand-picked vectors per function (from the Rust, on the lab) before the tests meant anything.
User Scenarios
Given fn int_rank(ty: &str) -> u32 { match ty.trim() { "u8" | "i8" => 8, ..., _ => 0 } }, when tri t27o --oracle writes the harness, then the samples for ty include every string literal the body compares ty (or a value derived from it) against, those literals with surrounding whitespace, and the fixed samples.
Given a predicate over bytes (matches!(b[i], b'+' | b'-' | ...)), when the harness samples a text parameter, then the samples include texts that contain those byte literals.
Given a converted body with one arm deleted, when tri t27o --check runs, then a test oracle_* block FAILs.
Requirements
FR-001: The oracle harness MUST add, for each text parameter, the string literals of the body's match arms, == comparisons and starts_with / ends_with / contains arguments, each alone and wrapped in one space, plus the body's byte and char literals as one-byte texts.
FR-002: For integer parameters it MUST add the integer literals the body compares against, and those values plus and minus one.
FR-003: The number of samples MUST stay bounded (at most 64 per parameter), and the choice MUST be deterministic.
Success Criteria
tri t27o --check on a file holding compiler.rs's compound_binop writes an oracle_compound_binop test with at least one assert whose expected value is not null.
tri t27o --check on the same file, with the "/=" arm deleted from the Rust copy and the converted spec built from the unmodified Rust, exits non-zero.
Activity
wip: t27o oracle samples every match arm (#9102)
t27o: the oracle samples every match arm, so text predicates can no l…
t27o: the oracle samples every match arm, so text predicates can no l…