Skip to content

s2/tlevel: type decls applied before typing; all s1 tests pass through s2c - #27

Merged
vic merged 1 commit into
mainfrom
s2-tlevel
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
s2-tlevel

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

s2/tlevel.srs ports s1/types.srs:1-134 as an Ast-to-Ast pass. It runs before Ty.check on every type of the program:

  • type F [A: Type] = T: F[X] is T with A := X.
  • A match type reduces by its first case whose pattern equals the scrutinee.
  • A value match (type B (n: I64) = n match ...) reduces by its first case that the value arg fits. The value arg is evaluated at compile time: literals, the enclosing value params, operators, if, blocks of vals and calls of defs.
  • Each step and each evaluated call costs fuel, so a loop is a reject. Errors are data (Tl.Err); s2c prints them and exits 1.

Gate (241 ok, 0 FAIL): S2C_TODO is empty, so all 33 tests/*.srs compile with s2c1 and match their .out. New lines: a looping alias runs out of fuel, and a value match with no case is a reject.

Mutant: the _ value pattern stops matching, and type_values is rejected ("no case of the match type matches in Bits"): killed.

…lue matches with a fuel-bound evaluator); all s1 tests pass through s2c
@vic
vic merged commit 327a635 into main Nov 9, 2026
3 checks passed
@vic
vic deleted the s2-tlevel 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