Positive values use no unary plus Adopted November 7, 2026 · 6.0.0 · Being verified
Problem A leading + could be written before a positive number or another operand. Removing it left the value unchanged.
Decision Remove unary +. Write the operand directly.
Examples
Rejecting unary plus before an integer reject · parsing · Verification · not-run
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Rejecting unary plus before a bound value reject · parsing · Verification · not-run
example.tpz Rejecting unary plus before a bound value Open in Playground → let value = 1 let copy = + value Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Rejecting unary plus before a float reject · parsing · Verification · not-run
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Using ordinary values, negation, and binary addition run · runtime · Verification · not-run
example.tpz Using ordinary values, negation, and binary addition Open in Playground → import std.io let value = 3 io. writeLine ( "{ 1 }" ) io. writeLine ( "{ 1.5 }" ) io. writeLine ( "{value}" ) io. writeLine ( "{ - value}" ) io. writeLine ( "{value + 2 }" ) Expected output Exit code 0
1
1.5
3
-3
5
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Keep unary +. It would give the same value a second spelling.Why A unary operator signals an operation on the value.
Changed rules Unary operators →
In tests membership in arrays, sets and ranges Adopted November 7, 2026 · 6.0.0 · In progress
Problem An operator and a method could both answer whether a collection contains an element. A substring search or a map lookup asks a different question.
Decision Use in to test membership in arrays, sets and ranges. Set. contains is removed. Substring tests and map key lookups retain their own operations. Examples
Use in for arrays, sets, and ranges run · runtime · Verification · not-run
example.tpz Use in for arrays, sets, and ranges Open in Playground → import std.io let values = [ 1 , 3 ] let members = set { 1 , 3 } let odds = 1 ..< 5 by 2 io. writeLine ( "{ 1 in values}:{ 2 in values}" ) io. writeLine ( "{ 1 in members}:{ 2 in members}" ) io. writeLine ( "{ 1 in odds}:{ 2 in odds}" ) Expected output Exit code 0
true:false
true:false
true:false
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout true:false true:false true:false This exact example has not been executed.
A Map is not an element-membership container reject · checking · Verification · not-run
example.tpz A Map is not an element-membership container Open in Playground → let found = "key" in map { "key" : 1 } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
Substring search is not element membership reject · checking · Verification · not-run
example.tpz Substring search is not element membership Open in Playground → Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
Alternatives considered Keep both contains and in. One membership test would have two spellings.Why The operation shows whether code is testing an element, a substring or a key.
Changed rules Comparison and membership →
An absent optional receiver skips method arguments Adopted November 18, 2026 · 6.0.0 · Being verified
Problem An argument can print or fail even when there is no receiver. If it ran on that path, skipping the call would have an unexpected effect.
Decision Evaluate the receiver once. For None() or null, skip lookup, arguments, spreads, callback construction and omitted defaults. Return the same absence. For a present value, find the method on the unwrapped value and use ordinary call order. Check the signature and arguments statically even when the receiver is absent. An Option result is not wrapped twice. A nullable receiver keeps null distinct. Only read methods of a built-in type can be taken as values. Taking a mutating method as a value is rejected. Examples
Option receiver, present check · checking · Verification · not-run
example.tpz Option receiver, present record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: Option < P > = Some( P { x: 1 }) let result: Option < int > = p ?. plus ( 2 ) Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
This exact example has not been executed.
Option receiver, absent check · checking · Verification · not-run
example.tpz Option receiver, absent record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: Option < P > = None() let result: Option < int > = p ?. plus ( 2 ) Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
This exact example has not been executed.
Option result stays one layer check · checking · Verification · not-run
example.tpz Option result stays one layer record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: Option < P > = Some( P { x: 1 }) let result: Option < int > = p ?. next () Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
This exact example has not been executed.
Nullable receiver, present check · checking · Verification · not-run
example.tpz Nullable receiver, present record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: P | null = P { x: 1 } let result: int | null = p ?. plus ( 2 ) Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
This exact example has not been executed.
Nullable receiver, absent check · checking · Verification · not-run
example.tpz Nullable receiver, absent record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: P | null = null let result: int | null = p ?. plus ( 2 ) Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
This exact example has not been executed.
Nullable receiver with Option return check · checking · Verification · not-run
example.tpz Nullable receiver with Option return record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: P | null = P { x: 1 } let result: Option < int > | null = p ?. next () Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
This exact example has not been executed.
Absent receiver still checks member reject · checking · Verification · not-run
example.tpz Absent receiver still checks member Open in Playground → record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } function next (self) -> Option < int > { Some(self.x + 1 ) } } let p: Option < P > = None() let result = p ?. missing ( 1 ) Expected output Nonzero exit
Expected result Expected result Rejection during check. Nonzero exit.
The required primary-location contract is Pending.
This exact example has not been executed.
Absent receiver skips argument expression run · runtime · Verification · not-run
example.tpz Absent receiver skips argument expression import std.io record P { x: int } impl P { function plus (self, n: int ) -> int { self.x + n } } function argument () -> int { io. writeLine ( "arg" ) 2 } let p: Option < P > = None() let result = p ?. plus ( argument ()) io. writeLine ( "done" ) Expected output Exit code 0
done
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Optional union checks every arm reject · checking · Verification · not-run
example.tpz Optional union checks every arm record A { x: int } record B { x: int } impl A { function plus (self, n: int ) -> int { self.x + n } } impl B { function plus (self, n: string ) -> int { self.x } } let value: ( A | B ) | null = null let result = value ?. plus ( 2 ) Expected output Nonzero exit
Expected result Expected result Rejection during check. Nonzero exit.
The required primary-location contract is Pending.
This exact example has not been executed.
Alternatives considered Keep blocking ?. only for user methods, as now. Built-in and user methods would follow different call rules, and the same intent would need a longer if let or match.Block ?. for built-in methods too. The specification already treats optional access with the general member rule.Why The receiver determines whether arguments run, for both built-in and user methods.
Changed rules Member, index, and optional access →
Ordinary calls and bindings express data flow Adopted November 7, 2026 · 6.0.0 · Being verified
Problem A value could be passed to a function with either call syntax or a pipeline. Reusing an intermediate result or ordering effects also needed a clear spelling.
Decision Remove |>, >> and expression-position _. Compose work with ordinary calls and functions. Use let to show evaluation order and reuse intermediate values. Examples
Reject a pipeline placeholder reject · parse · Verification · not-run
example.tpz Reject a pipeline placeholder Open in Playground → function subtract (a: int , b: int ) -> int { a - b } let value = 3 |> subtract ( 10 , _) Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
Reject the composition operator reject · parse · Verification · not-run
example.tpz Reject the composition operator Open in Playground → function increment (n: int ) -> int { n + 1 } function double (n: int ) -> int { n * 2 } let composed = increment >> double Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
Reject a standalone expression placeholder reject · parse · Verification · not-run
example.tpz Reject a standalone expression placeholder Open in Playground → Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
Save values to preserve call and composition effects run · runtime · Verification · not-run
example.tpz Save values to preserve call and composition effects Open in Playground → import std.io function input () -> int { io. writeLine ( "input" ) 3 } function subtract (a: int , b: int ) -> int { a - b } function stage () -> ( int , int ) -> int { io. writeLine ( "callee" ) subtract } function argument () -> int { io. writeLine ( "argument" ) 10 } let saved = input () let callee = stage () let written = argument () io. writeLine ( "{ callee (written, saved)}" ) function increment (n: int ) -> int { n + 1 } function double (n: int ) -> int { n * 2 } function first () -> ( int ) -> int { io. writeLine ( "first" ) increment } function second () -> ( int ) -> int { io. writeLine ( "second" ) double } let left = first () let right = second () let composed = (n: int ) => right ( left (n)) io. writeLine ( "{ composed ( 3 )}:{ composed ( 5 )}" ) Expected output Exit code 0
input
callee
argument
7
first
second
8:12
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout input callee argument 7 first second 8:12 This exact example has not been executed.
Alternatives considered Keep some pipeline and composition operators. Ordinary calls and operator syntax would still express the same calls in different forms.Keep all the operators. One call should have one way to write it.Why Calls and bindings show where a value goes and when it is evaluated.
Changed rules Ordinary calls and saved values →Compose calls in a function body →
Parentheses delimit control operands Adopted November 7, 2026 · 6.0.0 · Being verified
Problem A record or lambda in a control header can make its boundary unclear. A separate grammar for headers also complicates moving an ordinary expression into one.
Decision Wrap control operands and guards in parentheses, as in if (test), match (value) and while (test). Write range patterns as (low . . high). Inside the parentheses, use ordinary expression syntax. Examples
Reject an undelimited if operand reject · parse · Verification · not-run
example.tpz Reject an undelimited if operand Open in Playground → let value = if true { 1 } else { 0 } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
No stdout.
This exact example has not been executed.
Record construction and update use ordinary operand grammar run · execution · Verification · not-run
example.tpz Record construction and update use ordinary operand grammar Open in Playground → import std.io record Flag { enabled: bool } let state = { enabled: true } let first = if ( Flag { enabled: true }.enabled) { 1 } else { 0 } let second = if (state { enabled: false }.enabled) { 1 } else { 2 } let third = match ( Flag { enabled: true }) { case Flag { enabled: true } => true case _ => false } io. writeLine ( "{first},{second},{third}" ) Expected output Exit code 0
1,2,true
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Reject an unwrapped range pattern reject · parse · Verification · not-run
example.tpz Reject an unwrapped range pattern Open in Playground → let value = match ( 2 ) { case 1 .. 3 => 1 case _ => 0 } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
No stdout.
This exact example has not been executed.
A delimited range precedes a lambda-valued arm run · execution · Verification · not-run
example.tpz A delimited range precedes a lambda-valued arm Open in Playground → import std.io let low = 1 let high = 3 let chosen = match ( 2 ) { case (low .. high) => (value: int ) => value + 1 case _ => (value: int ) => value } io. writeLine ( "{ chosen ( 6 )}" ) Expected output Exit code 0
7
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Keep a dedicated grammar for control headers. Expressions would follow different rules when moved into a header.Change the record and lambda shorthand grammar instead. Expression grammar would still differ by context.Why The boundary is visible, and the same expression syntax works throughout the program.
Changed rules Explicit control operands →Range pattern boundaries →
Operands evaluate from left to right Adopted November 9, 2026 · 6.0.0 · Being verified
Problem If both operands can print or fail, the first evaluation can change the observable result. A defined order tells developers which fault appears.
Decision Evaluate binary operands and nested operands from left to right. Report the first runtime fault. Short-circuit operators evaluate only the operands they need. Call arguments and collection and record elements follow source order. Examples
Binary and nested operands print from left to right run · runtime · Verification · not-run
example.tpz Binary and nested operands print from left to right Open in Playground → import std.io function value (label: string , number: int ) -> int { io. writeLine (label) number } let result = value ( "left" , 1 ) + value ( "middle" , 2 ) * value ( "right" , 3 ) io. writeLine ( "{result}" ) Expected output Exit code 0
left
middle
right
7
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
The left operand faults before the right operand runs run · runtime · Verification · not-run
example.tpz The left operand faults before the right operand runs Open in Playground → import std.io function left (divisor: int ) -> int { io. writeLine ( "left" ) 1 / divisor } function right (number: int ) -> int { io. writeLine ( "right" ) 9223372036854775807 + number } left ( 0 ) + right ( 1 ) Expected output Nonzero exit
left
Expected result Expected result Rejection during run. Nonzero exit.
Expected stdout This exact example has not been executed.
Alternatives considered Leave evaluation order unspecified. The same program could print a different order or report a different first fault.Why Output and failure order follow directly from the source.
Changed rules Operand and assignment evaluation order →
Resolved pending items Pending: remaining evaluation-order guarantees →
A write targets the binding after the right-hand value is evaluated Adopted November 16, 2026 · 6.0.0 · Being verified
Problem The right-hand side of an indexed assignment or an argument to a mutating method can rebind the receiver. The result depends on which value receives the write.
Decision Indexed assignment and mutating methods write to the binding’s current value after evaluating the right-hand side or arguments. The slot is checked again just before the write. If shrink rebinds xs to [7] and returns 5, xs[0] = shrink() leaves [5]. Examples
A write uses the receiver after the arguments rebind it run · runtime · Verification · not-run
main.tpz A write uses the receiver after the arguments rebind it Open in Playground → import std.io let mut xs = [ 1 , 2 ] function shrink () -> int { xs = [ 7 ] 5 } xs[ 0 ] = shrink () io. writeLine ( "{xs}" ) let mut ys = [ 3 ] function reset () -> int { ys = [ 0 ] 4 } ys. push ( reset ()) io. writeLine ( "{ys}" ) Expected output Exit code 0
[5]
[0, 4]
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Write to the value seen at the start of evaluation. The binding already points to a new value, so the write affects a discarded value.Why The last step of the expression has a predictable target even when evaluation rebinds the receiver.
Changed rules Operand and assignment evaluation order →
Numeric patterns accept negative literals Adopted November 18, 2026 · 6.0.0 · Being verified
Problem Writing positive cases directly and negative cases as ranges or guards makes the same test look different. Signed zero also needs a consistent comparison rule.
Decision A numeric literal pattern can have one leading -. A name such as - x and a standalone grouped pattern are unavailable. The pattern has the value and diagnostics of the same spelling in an expression. Numeric equality treats - 0. 0 and 0. 0 as equal. A negative-zero arm fully covered by an earlier unguarded zero arm produces TPZ5713 during checking. Examples
Negative numeric literal patterns preserve expression values run · runtime · Verification · not-run
example.tpz Negative numeric literal patterns preserve expression values import std.io function integer (value: int ) -> int { match (value) { case - 1 => 1 case - 0 x8000000000000000 => 2 case - 1 _000 => 3 case - 0 => 4 case _ => 0 } } function floating (value: float ) -> int { match (value) { case - 1.5 => 5 case - 0.0 => 6 case _ => 0 } } io. writeLine ( "{ integer ( - 1 )}" ) io. writeLine ( "{ integer ( - 9223372036854775808 )}" ) io. writeLine ( "{ integer ( - 1000 )}" ) io. writeLine ( "{ integer ( 0 )}" ) io. writeLine ( "{ floating ( - 1.5 )}" ) io. writeLine ( "{ floating ( 0.0 )}" ) Expected output Exit code 0
1
2
3
4
5
6
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
An earlier float zero case covers negative float zero reject · check · Verification · not-run
example.tpz An earlier float zero case covers negative float zero function classify (value: float ) -> int { match (value) { case 0.0 => 1 case - 0.0 => 2 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
An earlier zero case covers negative zero reject · check · Verification · not-run
example.tpz An earlier zero case covers negative zero function classify (value: int ) -> int { match (value) { case 0 => 1 case - 0 => 2 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
A standalone grouped negative literal pattern is rejected reject · parse · Verification · not-run
example.tpz A standalone grouped negative literal pattern is rejected Open in Playground → function classify (value: int ) -> int { match (value) { case ( - 1 ) => 1 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
A repeated minus does not form a literal pattern reject · parse · Verification · not-run
example.tpz A repeated minus does not form a literal pattern Open in Playground → function classify (value: int ) -> int { match (value) { case -- 1 => 1 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
Alternatives considered Make developers use ranges or guards for negatives. Testing one numeric value would use different spellings for positive and negative numbers.Compare the two zeros by their bits. Pattern matching would disagree with ==.Why The same literal and equality rules apply regardless of sign.
Changed rules Pattern forms and name interpretation →
Record patterns name both the field and its pattern Adopted November 7, 2026 · 6.0.0 · Being verified
Problem Destructuring can give a value the same name as its field. A bare name does not show which part names the field and which part binds the value.
Decision Write every record pattern field as field: pattern.
Examples
Rejecting a structural field shorthand reject · parsing · Verification · not-run
example.tpz Rejecting a structural field shorthand Open in Playground → let { value } = { value: 1 } Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Rejecting a nominal field shorthand reject · parsing · Verification · not-run
example.tpz Rejecting a nominal field shorthand Open in Playground → record Point { x: int } let Point { x } = Point { x: 1 } Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Binding and renaming fields explicitly run · runtime · Verification · not-run
example.tpz Binding and renaming fields explicitly Open in Playground → import std.io record Point { x: int , y: int } let { value: value } = { value: 7 } let Point { x: first, y: second } = Point { x: 2 , y: 3 } io. writeLine ( "{value} {first} {second}" ) Expected output Exit code 0
7 2 3
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Keep field shorthand with special restrictions. The same binding would have two forms and shorthand would need its own rules.Why Readers can see the field being matched and the pattern that handles its value.
Changed rules Pattern forms and name interpretation →
A missing colon in a record pattern is a parse error Adopted November 7, 2026 · 6.0.0 · Being verified
Problem A missing separator between a field and its pattern is already rejected by the parser. A separate checker diagnostic would need a new reachable condition.
Decision Keep TPZ5611 reserved for defensive checks. A missing colon produces TPZ2001 during parsing.
Examples Rejecting a structural field shorthand →
Rejecting a nominal field shorthand →
Alternatives considered Define a new user-facing TPZ5611 checker condition. The same invalid spelling already fails during parsing.Why The field's syntax error is reported while reading the source.
Changed rules Pattern forms and name interpretation →
A match arm uses a block to return from its function Adopted November 7, 2026 · 6.0.0 · Being verified
Problem An arm has a result expression, yet it sometimes needs to return from the enclosing function. A bare return would blur the boundary between expressions and statements.
Decision Put return inside a block when using it in a match arm.
Examples
Rejecting a return without an arm block reject · parsing · Verification · not-run
example.tpz Rejecting a return without an arm block Open in Playground → function choose (flag: bool ) -> int { while ( true ) { let value = match (flag) { case true => return 7 case false => 3 } return value } 0 } Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Returning through a match arm block run · runtime · Verification · not-run
example.tpz Returning through a match arm block Open in Playground → import std.io function choose (flag: bool ) -> int { while ( true ) { let value = match (flag) { case true => { return 7 } case false => 3 } return value } 0 } io. writeLine ( "{ choose ( true )}" ) io. writeLine ( "{ choose ( false )}" ) Expected output Exit code 0
7
3
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Allow a bare return as a special arm expression. A return statement would have a special form in match arms.Allow return as an expression everywhere. One rule should hold that return is a statement.Why Returns in arm blocks follow the same statement rules as other returns.
Changed rules Case selection and guards →
Match picks the first successful arm and rejects covered arms Adopted November 8, 2026 · 6.0.0 · In progress · Version 2
Problem A special case often comes before a general rule. Rejecting every overlap forces that intent into a guard or a different structure.
Decision Try match arms in source order and select the first arm whose pattern and guard both succeed. A later general pattern can overlap an earlier special one. Reject an arm during checking if earlier unguarded arms cover every value it could match. Examples
A repeated unguarded literal case is unreachable reject · checking · Verification · not-run
example.tpz A repeated unguarded literal case is unreachable function choose (value: int ) -> int { match (value) { case 1 => 10 case 1 => 20 case _ => 0 } } Expected output Nonzero exit
Expected result Expected result Rejection during check. Nonzero exit.
This exact example has not been executed.
Overlapping guarded cases follow source order run · runtime · Verification · not-run
example.tpz Overlapping guarded cases follow source order Open in Playground → import std.io function choose (value: int ) -> string { match (value) { case number if (number > 0 ) => "positive" case number if (number <= 0 ) => "nonpositive" case _ => "other" } } io. writeLine ( choose ( 4 )) io. writeLine ( choose ( 0 )) Expected output Exit code 0
positive
nonpositive
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
A later wildcard is covered by two earlier unguarded cases reject · checking · Verification · not-run
example.tpz A later wildcard is covered by two earlier unguarded cases let value: bool = true let result = match (value) { case true => "yes" case false => "no" case _ => "hidden" } Expected output Nonzero exit
Expected result Expected result Rejection during check. Nonzero exit.
This exact example has not been executed.
Cover all payloads of a constructor with two bool fields check · check · Verification · not-run
example.tpz Cover all payloads of a constructor with two bool fields enum E { Pair ( bool , bool ), Empty } function f (e: E ) -> int { match (e) { case Pair (_, true ) => 1 case Pair (_, false ) => 2 case Empty () => 3 } } Expected output Exit code 0
No stdout. Expected result Expected result Checking accepts the program. Exit code 0.
No stderr.
No stdout.
This exact example has not been executed.
Alternatives considered Reject overlap independently of arm order. Developers could no longer show that an exception should be handled first by writing it first.Why Special cases can come first, while checking exposes arms that can never run.
Changed rules Case selection and guards →Reachable overlapping cases →
Version history A range pattern with two literal endpoints that matches no value fails checking Adopted November 18, 2026 · 6.0.0 · Being verified
Problem Confusing . . with . . < can produce a range that matches nothing. An enclosing arm may still be reachable, so the mistake is easy to miss.
Decision Apply the usual integer literal checks first when both endpoints are literals. Checking reports TPZ5714 for (a . . < b) when a >= b or (a . . b) when a > b. Grouped literals and nested patterns follow the same rule. A range with computed endpoints simply fails to match if it is empty at runtime. Examples
An exclusive literal range with equal endpoints is rejected reject · check · Verification · not-run
example.tpz An exclusive literal range with equal endpoints is rejected function classify (value: int ) -> int { match (value) { case ( 0 ..< 0 ) => 1 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
A reversed inclusive literal range is rejected reject · check · Verification · not-run
example.tpz A reversed inclusive literal range is rejected function classify (value: int ) -> int { match (value) { case ( 5 .. 1 ) => 1 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
An empty range is rejected inside a reachable alternative reject · check · Verification · not-run
example.tpz An empty range is rejected inside a reachable alternative function classify (value: int ) -> int { match (value) { case ( 0 ..< 0 ) | 1 => 1 case _ => 0 } } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
A for pattern rejects a static empty range reject · check · Verification · not-run
example.tpz A for pattern rejects a static empty range for ( 0 ..< 0 ) in ([ 0 ]) { } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
A computed empty range fails to match at runtime run · runtime · Verification · not-run
example.tpz A computed empty range fails to match at runtime Open in Playground → import std.io function endpoint (value: int ) -> int { value } let result = match ( 0 ) { case ( endpoint ( 0 ) ..< endpoint ( 0 )) => 1 case _ => 2 } io. writeLine ( "{result}" ) Expected output Exit code 0
2
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Reuse TPZ5713, the diagnostic for an arm already covered. An empty pattern could wrongly be blamed on an earlier arm.Treat an empty literal range as an ordinary non-match. A mistaken boundary could silently leave dead code.Why The diagnostic identifies the actual range even inside an otherwise reachable arm.
Changed rules Integer range patterns →
Computed endpoints run each time matching reaches a range Adopted November 17, 2026 · 6.0.0 · Being verified
Problem A later alternative can contain a failing call even when an earlier one already matches. Evaluating endpoints in advance can stop a program in work that should be skipped.
Decision On reaching a range, evaluate the computed lower endpoint before the upper one. Recompute them on each attempt. Test outer patterns first and alternatives from left to right. Stop at the first matching alternative and try the next arm if the guard fails. Use this order in match, for and destructuring. Faults and ? from a reached endpoint follow their ordinary control flow. Examples
A successful range alternative skips later endpoints run · runtime · Verification · not-run
example.tpz A successful range alternative skips later endpoints import std.io function bound (value: int ) -> int { value } function boom (divisor: int ) -> int { 1 / divisor } let chosen = match ( 0 ) { case ( 0 .. bound ( 1 )) | ( 0 .. boom ( 0 )) => 7 case _ => 9 } io. writeLine ( "{chosen}" ) Expected output Exit code 0
7
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
A false guard continues with the next case run · runtime · Verification · not-run
example.tpz A false guard continues with the next case import std.io function end (label: string ) -> int { io. writeLine (label) 1 } let chosen = match ( 0 ) { case ( 0 .. 1 ) | ( 0 .. end ( "or" )) if ( false ) => 1 case ( 0 .. end ( "next" )) => 2 case _ => 9 } io. writeLine ( "{chosen}" ) Expected output Exit code 0
next
2
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
A for pattern evaluates endpoints for each element run · runtime · Verification · not-run
example.tpz A for pattern evaluates endpoints for each element import std.io function high () -> int { io. writeLine ( "high" ) 1 } for ( 0 .. high ()) in ([ 1 , 1 ]) { io. writeLine ( "matched" ) } Expected output Exit code 0
high
matched
high
matched
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
A reached endpoint failure stops matching run · runtime · Verification · not-run
example.tpz A reached endpoint failure stops matching Open in Playground → import std.io function boom (divisor: int ) -> int { io. writeLine ( "boom" ) 1 / divisor } let chosen = match ( 0 ) { case ( 0 .. boom ( 0 )) => 7 case _ => 9 } io. writeLine ( "{chosen}" ) Expected output Nonzero exit
boom
Expected result Expected result Rejection during run. Nonzero exit.
The required primary-location contract is Pending.
Expected stdout This exact example has not been executed.
Alternatives considered Evaluate all endpoints of an arm before matching. Failure in an unused alternative could interrupt the selected path.Allow only constant endpoints. Existing programs that calculate their range bounds would be rejected.Why The matching order tells readers which expressions run and which failures can occur.
Changed rules Integer range patterns →
A list rest has an explicit pattern Adopted November 7, 2026 · 6.0.0 · Being verified
Problem A list pattern may use a prefix and ignore the rest. A bare . . leaves it unclear whether a pattern was omitted intentionally.
Decision Always follow . . with a pattern. Use . . _ to discard the rest.
Examples
Rejecting a rest marker without a pattern reject · parsing · Verification · not-run
example.tpz Rejecting a rest marker without a pattern Open in Playground → let count = match ([ 1 , 2 ]) { case [ .. ] => 2 } Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Rejecting an omitted middle rest pattern reject · parsing · Verification · not-run
example.tpz Rejecting an omitted middle rest pattern Open in Playground → let total = match ([ 1 , 2 , 3 ]) { case [first, .. , last] => first + last case _ => 0 } Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Ignoring a rest with an explicit wildcard run · runtime · Verification · not-run
example.tpz Ignoring a rest with an explicit wildcard Open in Playground → import std.io let middle = match ([ 1 , 2 , 3 , 4 ]) { case [first, .. _, last] => "{first} {last}" case _ => "miss" } let leading = match ([ 1 , 2 , 3 , 4 ]) { case [ .. _, last] => last case _ => 0 } let trailing = match ([ 1 , 2 , 3 , 4 ]) { case [first, .. _] => first case _ => 0 } let empty: Array < int > = [] let ignored = match (empty) { case [ .. _] if (empty.length == 0 ) => true case _ => false } io. writeLine (middle) io. writeLine ( "{leading}" ) io. writeLine ( "{trailing}" ) io. writeLine ( "{ignored}" ) Expected output Exit code 0
1 4
4
1
true
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Discard the rest with bare . . only and reject . . _. Binding (. . rest) and discarding (. . _) should follow one rule.Allow both bare . . and . . _. There would be two ways to discard the rest.Why . . rest and . . _ share one syntax and show what happens to the remaining items.
Changed rules A single list rest and its surrounding elements →
Constructors use parentheses even without arguments Adopted November 7, 2026 · 6.0.0 · Being verified
Problem If parentheses depend on whether a constructor carries data, readers must look up its declaration. A bare name in a pattern could also be mistaken for a new binding.
Decision Use parentheses for constructors in values and patterns, as in None(), Empty() and Some(x). Reject a binding that conflicts with a constructor name. Examples
Constructor patterns keep parentheses at every arity run · runtime · Verification · not-run
example.tpz Constructor patterns keep parentheses at every arity Open in Playground → import std.io enum Choice { Empty , Filled ( int ), Pair ( int , int ) } function read (value: Choice ) -> int { match (value) { case Empty () => 0 case Filled (number) => number case Pair (left, right) => left + right } } function nested (value: Option < Choice > ) -> int { match (value) { case None() => - 1 case Some( Empty ()) => 0 case Some( Filled (number)) => number case Some( Pair (left, right)) => left + right } } io. writeLine ( "{ read ( Choice . Empty ())}" ) io. writeLine ( "{ read ( Choice . Filled ( 7 ))}" ) io. writeLine ( "{ read ( Choice . Pair ( 2 , 3 ))}" ) io. writeLine ( "{ nested (None())}" ) io. writeLine ( "{ nested (Some( Choice . Empty ()))}" ) Expected output Exit code 0
0
7
5
-1
0
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
None needs parentheses in a constructor pattern reject · parsing · Verification · not-run
example.tpz None needs parentheses in a constructor pattern Open in Playground → function read (value: Option < int > ) -> int { match (value) { case Some(number) => number case None => 0 } } Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
None needs parentheses in a constructor value reject · parsing · Verification · not-run
example.tpz None needs parentheses in a constructor value Open in Playground → let maybe: Option < int > = None Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Qualified constructor patterns are rejected reject · parsing · Verification · not-run
example.tpz Qualified constructor patterns are rejected Open in Playground → enum Choice { Empty } let value: Choice = Choice . Empty () let result = match (value) { case Choice . Empty => 1 } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during parse. Nonzero exit.
The required primary-location contract is Pending.
No stdout.
This exact example has not been executed.
A qualified nullary constructor keeps its parentheses check · checking · Verification · not-run
example.tpz A qualified nullary constructor keeps its parentheses Open in Playground → enum Choice { Empty } let value: Choice = Choice . Empty () Expected output Exit code 0
Expected result Expected result Checking accepts the program. Exit code 0.
No stderr.
This exact example has not been executed.
Alternatives considered Write nullary constructors as bare names. The role of a name would depend on its declaration and where it was used.Allow both spellings. The same constructor would have two spellings.Require parentheses only in patterns. The same name would look different depending on where it appears.Why Constructors keep one spelling in both values and patterns, whatever their arity.
Changed rules Constructor syntax and binding names →Variants without payloads →
Every match covers all possible values Adopted November 9, 2026 · 6.0.0 · In progress
Problem A match over an open type like an integer or a string could omit some inputs. Checks still passed, and execution stopped when one of those inputs arrived.
Decision The checker requires every match to cover every possible value. Cover all cases of enums, Option, Result, bool and closed unions. Coverage extends to any closed type held inside a constructor. Open types such as integers, floats, strings, arrays, ranges and type parameters require a final unguarded arm. A guarded arm contributes nothing to coverage. Missing coverage produces TPZ5021 during checking. Topaz 6.0.0 retires the runtime diagnostic TPZ4006. Examples
Option bool covers both payloads and None run · runtime · Verification · not-run
example.tpz Option bool covers both payloads and None Open in Playground → import std.io function read (value: Option < bool > ) -> int { match (value) { case Some( true ) => 1 case Some( false ) => 0 case None() => - 1 } } let flags = map { "on" : true , "off" : false } io. writeLine ( "{ read (flags. get ("on"))}" ) io. writeLine ( "{ read (flags. get ("off"))}" ) io. writeLine ( "{ read (flags. get ("missing"))}" ) Expected output Exit code 0
1
0
-1
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Cover all payloads of a constructor with two bool fields →
Alternatives considered Check closed types and allow open types to fail at runtime. A missing case could pass checking and stop a program on an uncommon input.Specify coverage for bool and leave other types open. Developers would lack a common rule for which arms to write for enums and unions.Why Checking catches missing cases before the match runs. A match over an open type needs one final unconditional arm that takes every remaining value.
Changed rules Every match is exhaustive →Reserved runtime code and current checking diagnostic →Non-exhaustive match →
Resolved pending items Complete exhaustiveness contract →
For performs effects and a comprehension collects values Adopted November 7, 2026 · 6.0.0 · Being verified
Problem Putting a loop in a value position used to turn it into array collection. Moving the same loop could change the type of its result.
Decision A for loop performs effects and returns () in every context. Use a comprehension to collect results into an array. Examples
For results stay unit in grouped and bound positions run · runtime · Verification · not-run
example.tpz For results stay unit in grouped and bound positions import std.io function items (label: string ) -> Array < int > { io. writeLine (label) [ 1 , 2 ] } let bound = for item in ( items ( "bound" )) { io. writeLine ( "{item}" ) item * 2 } let grouped = ( for item in ( items ( "grouped" )) { io. writeLine ( "{item}" ) item * 3 }) let emptyItems: Array < int > = [] let empty = for item in (emptyItems) { item } io. writeLine ( "{bound} {grouped} {empty}" ) Expected output Exit code 0
bound
1
2
grouped
1
2
() () ()
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
For cannot supply an array result reject · checking · Verification · not-run
example.tpz For cannot supply an array result let values: Array < int > = for item in ([ 1 , 2 ]) { item * 2 } Expected output Nonzero exit
No stdout. Expected result Expected result Rejection during check. Nonzero exit.
No stdout.
This exact example has not been executed.
Collect values with an array comprehension run · runtime · Verification · not-run
example.tpz Collect values with an array comprehension Open in Playground → import std.io let values: Array < int > = [ for item in ([ 1 , 2 ]) => item * 2 ] io. writeLine ( "{values[ 0 ]} {values[ 1 ]}" ) Expected output Exit code 0
2 4
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Let for collect an array in value positions. The same loop would do different work depending on where it appears.Why Readers can tell from the syntax whether the loop collects values or runs for effects. Collecting with an early stop uses an accumulator and break. Collecting without a stop uses a comprehension.
Changed rules Statement and value uses of for →
The defer diagnostic asks for a block Adopted November 16, 2026 · 6.0.0 · In progress
Problem A rejected defer f() could still produce a message that suggested a bare call. Following that advice did not fix the program.
Decision During parsing, TPZ2004 says that defer takes a block and points to the start of the body expression. Keep the repair example in the diagnostic's documentation. Examples
Rejecting a deferred call without a block reject · parsing · Verification · not-run
example.tpz Rejecting a deferred call without a block Open in Playground → import std.io function finish () -> () { defer io. writeLine ( "cleanup" ) } finish () Expected output Nonzero exit
Expected result Expected result Rejection during parse. Nonzero exit.
This exact example has not been executed.
Alternatives considered Retain the message saying that a block or a call is allowed. The message would recommend a form the language rejects.Put a rewritten example inside the message. The diagnostic description already has the fix, so the same guidance would appear twice.Why The error tells the reader to put the deferred work in a block.
Changed rules Registering a deferred block →
Defer puts deferred work in a block Adopted November 7, 2026 · 6.0.0 · Being verified
Problem Deferred work could be written as a block or as a bare call. One operation had two spellings.
Decision Follow defer with a block. The parser rejects a bare call such as defer f().
Examples Rejecting a deferred call without a block →
Running a deferred block at scope exit run · runtime · Verification · not-run
example.tpz Running a deferred block at scope exit Open in Playground → import std.io function finish () -> () { defer { io. writeLine ( "cleanup" ) } io. writeLine ( "body" ) } finish () Expected output Exit code 0
body
cleanup
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout This exact example has not been executed.
Alternatives considered Keep both blocks and bare calls. The same deferred work would still have two forms.Why A block makes the boundary of the deferred work visible. The call form evaluated its arguments at registration, not at cleanup. To keep a current value, bind it with let first.
Changed rules Registering a deferred block →
Control flow cannot jump across a defer boundary Adopted November 19, 2026 · 6.0.0 · Being verified
Problem A return from cleanup can collide with a return already in progress. Previously, an invalid jump could pass checking and report an error only during execution.
Decision A return, break, continue, or ? crossing a defer body produces TPZ5001 at the expression during checking, even in unreachable code. A return or error propagation inside a function defined in cleanup, and control transfers inside a loop defined in cleanup, are permitted when they stay inside the boundary. Nested cleanup applies the rule at every defer boundary. Alternatives considered Assign priorities to jumps during cleanup. A jump could overwrite the return already in progress or conceal another cleanup action.Why Invalid jumps are caught before execution, and cleanup cannot redirect the surrounding function.
Changed rules Cleanup order on normal completion and control transfer →Runtime faults skip remaining cleanup →
Returning an error value still runs registered cleanup Adopted November 7, 2026 · 6.0.0 · Being verified
Problem Propagating Err with ? leaves a function before it reaches the end of the block. Registered cleanup needs a defined order on this path.
Decision When ? returns Err, run defer blocks in reverse registration order in scopes being exited. Ok does not leave a scope. The automatic close from using follows the same exit rule. Examples
Cleaning up scopes during error propagation run · runtime · Verification · not-run
example.tpz Cleaning up scopes during error propagation Open in Playground → import std.io function fail () -> Result < int , string > { io. writeLine ( "operand" ) Err( "stop" ) } function finish () -> Result < int , string > { defer { io. writeLine ( "outer" ) } let value = { defer { io. writeLine ( "inner-first" ) } defer { io. writeLine ( "inner-second" ) } fail () ? } io. writeLine ( "unreachable" ) Ok(value) } io. writeLine ( match ( finish ()) { case Ok(value) => "value={value}" case Err(error) => error }) Expected output Exit code 0
operand
inner-second
inner-first
outer
stop
Expected result Expected result Execution completes. Exit code 0.
No stderr.
Expected stdout operand inner-second inner-first outer stop This exact example has not been executed.
Alternatives considered Skip defer when ? propagates an error. The same cleanup would behave differently on a structured early return.Clean up only using as a special case. Cleanup needs one rule however the scope is left.Why One registration covers ordinary and structured exits from its scope.
Changed rules Cleanup order on normal completion and control transfer →Using acquisition and cleanup order →
An unrecoverable runtime fault skips remaining cleanup Adopted November 9, 2026 · 6.0.0 · Being verified
Problem A program can still have cleanup registered when it stops with a runtime fault. Cleanup can print or fail in its own right.
Decision An ordinary runtime fault terminates execution and cannot be caught to resume it. Skip remaining defer and using cleanup.
Examples
A runtime fault leaves defer output absent run · runtime · Verification · not-run
example.tpz A runtime fault leaves defer output absent Open in Playground → import std.io function divide (divisor: int ) -> int { defer { io. writeLine ( "cleanup" ) } io. writeLine ( "before fault" ) 12 / divisor } io. writeLine ( "{ divide ( 0 )}" ) Expected output Nonzero exit
before fault
Expected result Expected result Rejection during run. Nonzero exit.
Expected stdout This exact example has not been executed.
Alternatives considered Continue running cleanup after the fault. New output or a second failure could follow the first fault.Leave cleanup during a fault unspecified. The behavior must be fixed so the same program repeats its output.Why Readers can identify the fault at which execution stops.
Changed rules Runtime faults skip remaining cleanup →
Partly answered pending items Pending: complete defer contexts and abrupt exits →
Version history