check: ? in a body whose result type is inferred #747
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language#747
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
docs/TYPECHECKER.mdsection 9 (spec gaps) records a hole and leaves it open: a function without a written result type whose body applies?, such asfn probe() { read()? }, is accepted with the resultVoid. The?has nowhere to return the error to, and no issue tracks the hole.Source
docs/project/2026-11-cleanup-audit.md.docs/TYPECHECKER.mdsection 9, the gap on a body whose result is inferred.Goal
One rule, decided in the spec gap and enforced:
?in a body whose result type is inferred is refused with a message that asks for the result type (the recommendation of the audit: inferring aResultfrom a?hides the error type from the signature, which CONCEPT's rule on written signatures of public functions argues against), or the result is inferred as the record of the gap decides.Design record point
docs/TYPECHECKER.mdsection 9; CONCEPT, the section on?and on inferred result types.Acceptance criteria
_Decision:line with the rulefn probe() { read()? }no longer type checks asVoidDependencies
None.
Seed
None, unless the compiler's own source relies on the hole; then the source is fixed in the same PR (the seed reads both).
Size
One PR, one commit.