Skip to content

D104: comptime-callability is inferred; a plain function runs at compile time, a comptime fn is checked at its declaration, every refusal names the chain (#2213) - #2245

Merged
ehartford merged 2 commits into
nullable-evidencefrom
comptime-infer
Oct 7, 2026
Merged

ehartford merged 2 commits into
nullable-evidencefrom
comptime-infer

Conversation

@ehartford

@ehartford ehartford commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Implements D104 (2026-10-07): the evaluator runs any function with a With body when a compile-time call reaches it and refuses only a body-less callee; every evaluator refusal carries the witness chain (; reached through fib -> helper, recursion collapsed). A comptime fn is checked at its declaration: comptime_callable_chain walks each plain callee's body to the first forbidden operation and names the chain; a call through a function value is refused. Four pins; the old refusal text is gone. #2220 (comptime allocator) is the next request.

Fixes #2213. Draft until the stack's battery is green.

@ehartford
ehartford added this pull request to stack #2246 October 7, 2026 07:15
@ehartford ehartford changed the title comptime infer D104: comptime-callability is inferred; a plain function runs at compile time, a comptime fn is checked at its declaration, every refusal names the chain (#2213) Oct 7, 2026
…ile time, a comptime fn is checked at its declaration, every refusal names the chain (#2213)

The evaluator runs any function with a With body when a compile-time call
reaches it and refuses only a callee with no body (an extern, a runtime
intrinsic); every evaluator refusal carries the witness chain, outermost
first, recursion collapsed (`; reached through fib -> helper`). A
`comptime fn` body is checked at its declaration: Sema's
`comptime_callable_chain` walks each plain callee's body — the call nodes
in its file span, resolved through the signature, the generic selection,
or the spelled extern/intrinsic name — to the first forbidden operation
and names the chain ("'helper' is not comptime-callable: it reaches
helper -> getpid (an extern)"); a call through a function value has no
static callee and is refused. The old refusal ("comptime can only call
comptime functions") is gone from both sites.

Pins: fib at both times; the evaluator chain; the static chain; the old
fixture re-pinned to the declaration-time chain. The D104 entry records
the implementation. The comptime allocator (#2220) is the next request.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on the stack top 990d183 (comptime-infer, D107 #2243 under it): gate 67s, uat 25s, battery-checks 352s. Driven by the pinned seed; logs in out/battery/.

@ehartford
ehartford marked this pull request as ready for review October 7, 2026 09:44
@ehartford
ehartford merged commit b03a8ab into main Oct 7, 2026
@ehartford
ehartford deleted the comptime-infer branch October 7, 2026 09:44
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.

comptime: infer comptime-safety so ordinary functions run at compile time (remove comptime fn coloring)

1 participant