Skip to content

s2 parity 1: standalone tests/s2 suite; s2c checks names, facts, purity, givens, matches, shapes - #28

Merged
vic merged 1 commit into
mainfrom
s2c-parity1
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
s2c-parity1

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Only s2 survives, so tests/s2 must stand alone.

Tests:

  • The s1 suite moves to tests/s1, unchanged, for the s1 gate.
  • tests/s2/{prog,neg,hash,eval} hold full copies that s2c runs.
  • A neg test in tests/s2 expects the s2 message. The s1 text stays as // s1: at the end of the file, so line numbers do not change.
  • tests/s2/todo lists what s2c does not cover yet: 15 entries. A listed test that passes fails the gate, so the list can only shrink.

s2c phases, in order: names, facts, type level, types, flow, C.

  • Names (Datalog) now sees the [] binders of a def in its body. Before, a call type arg such as Coll.foldl[F, A, B] was flagged as an unknown type.
  • Fx (new, s2/facts.srs, Datalog): the fact groups and protocol rule defs are well-formed. This covers capabilities, states, ops, relation arity, unbound variables, exit facts, reserved names, rule arity and safety.
  • Pure (new, s2/pure.srs, s1/purity.srs rules on s2 D): a spec def calls only pure fns and opens no handler.
  • Ty additions:
    • Matches are exhaustive, and a pattern binds the right number of fields.
    • Trait goals: local evidence first, then givens ranked as Scala3 does, with fuel. The errors are none, ambiguous, two locals, out of fuel, chosen does not prove, and chosen count.
    • Shapes: evidence or a capability used as a value, a [] binder that hides a type, a capability as a value param, a given that does not fit its trait, and an extern slot at a non-pointer type.
  • Parse errors print path: line N:, like the other errors.

Speed:

  • D.advance no longer re-inserts relations that did not change. On the flow phase: 3.77 G to 2.70 G instructions (callgrind), 1.88 s to 1.30 s, and 1.25 GB to 0.84 GB.
  • Ty computes the purity set only when the program has a spec def. The s2 types test went from 1.11 s to 0.54 s.

Gate: 351 ok, 0 FAIL, 15 todo.

Still todo:

  • Type facts (tf_*).
  • Value args of type decls (tval_*).
  • Evidence on types (tev_*).
  • Escape through generic calls (tparam_escape*).
  • marks_two.
  • The --hash, --eval, --store-check and --lean flags.

… s2c checks names, facts, purity, givens, matches and shapes; D.advance keeps unchanged relations
@vic
vic merged commit 2554ef5 into main Nov 9, 2026
3 checks passed
@vic
vic deleted the s2c-parity1 branch November 17, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant