You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: comptime pipeline calls to primitive intrinsic methods are rejected #565
Pipeline syntax for primitive intrinsic methods works at runtime, but the same expression inside comptime is treated as a free-function call and rejected with comptime can only call comptime functions.
Spec reference
docs/with-specification.md §4.2.4 requires integer bit-manipulation methods to be comptime-evaluable when the receiver is constant.
Pipeline syntax should be equivalent method-call sugar where a pipeline method is resolved.
Reproduction
//! expect-stdout: ok
const PIPE_ROT: u8 = comptime ((0b10000001 as u8) |> rotate_left(1))
fn main:
assert(PIPE_ROT == 0b00000011 as u8)
print("ok")
Expected
The constant evaluates to 3 as u8, matching (0b10000001 as u8).rotate_left(1).
Actual
The checker/evaluator reports:
error: comptime can only call comptime functions
A runtime probe of ((0b10000001 as u8) |> rotate_left(1)) succeeds, so this is specific to the comptime pipeline dispatch path.
Notes
Found while implementing #422. Kept out of that commit because direct method-call comptime evaluation is the Phase 3 requirement, and this is a separate pipeline dispatch-state issue.
Fixed in fde7ed6; build + fixpoint + full suite green. Root cause: top-level comptime initializers are folded by the transform pass before sema types them, so pipeline_method_calls was never populated and eval_pipeline fell to the free-call path. The evaluator now resolves the method-call sugar itself on map miss (via pipeline_method_exists on the evaluated receiver's type) and the pipeline method dispatch gains the missing integer branch, so comptime (x |> rotate_left(1)) evaluates exactly like comptime (x.rotate_left(1)) (§4.2.4 equivalence). The issue's repro is the fixture: test/behavior/behav_comptime_pipeline_intrinsic.w.
Activity
ehartford commentedon Jul 4, 2026
Fixed in fde7ed6; build + fixpoint + full suite green. Root cause: top-level
comptimeinitializers are folded by the transform pass before sema types them, sopipeline_method_callswas never populated andeval_pipelinefell to the free-call path. The evaluator now resolves the method-call sugar itself on map miss (viapipeline_method_existson the evaluated receiver's type) and the pipeline method dispatch gains the missing integer branch, socomptime (x |> rotate_left(1))evaluates exactly likecomptime (x.rotate_left(1))(§4.2.4 equivalence). The issue's repro is the fixture:test/behavior/behav_comptime_pipeline_intrinsic.w.Fix #565: comptime pipelines evaluate primitive-intrinsic methods
comptime: pipeline collection sugar dispatches by value kind; D21 cha…