Repository navigation
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
Conversation
…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
force-pushed
the
comptime-infer
branch
from
October 7, 2026 09:12
e90edfb to
d28f2f8
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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). Acomptime fnis checked at its declaration:comptime_callable_chainwalks 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.