Repository navigation
fix(hy-emit): lower hy.pipe, hy.send_cap, and hy.recv_cap via channel capability prelude (fixes #4464) - #4468
Open
Khanhtnq wants to merge 1 commit into
Conversation
… capability prelude (fixes limitlessprojects#4464)
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.
Fixes #4464.
Problem
Programs using linear SPSC channel capabilities (
hy.pipe[T],hy.send_cap[T],hy.recv_cap[T]) passhy-check(Verdict::Accept), buthy-emitpreviously treatedhy.*as an external Go package import (import "hy") with unloweredhy.SendCap/hy.RecvCap/hy.Pipereferences, failinggo build(package hy is not in std, GUARANTEES Row 13).Solution
PIPE_PRELUDE): Emits generic Go directional channel capability types (hy_send_cap[t any],hy_recv_cap[t any]) with.send(v),.close(),.recv(),.drain(), andhy_pipe[t any](buf ...int)whenever capability pipes/types appear in emitted output, without registering"hy"as a Go import (while preserving unhijacked behavior if a local variable shadowshy).hy.send_cap[T]/hy.recv_cap[T]across parameters, results, locals, and type aliases, and lowershy.pipe[T](...)/hy.new_pipe[T](...)across bothExpr::IndexandExpr::FieldAST representations.BindingKind::Chanand element struct/foreign shapes across:=,=,rx.recv(), andfor v in rxrange bindings, and recordswitness_sendconcurrency witnesses fortx.send(v)underhyb build --emit-proof.Verification
compiler/crates/hy-emit/tests/pipe_capabilities_4464.rs(exact#4464cap.hyreproducer compiling viago buildand outputting0\n1\n2\n,P01/P07/P08/P10/P12/P13/P15/P16/P17/P20patterns, struct/slice elements, type aliases,--packagemode,--emit-proofwitnesses, and coldhybCLI execution).cargo test --workspace,tools/corpus_harness.py(139/139),tools/check_guarantees.py, andtools/check_conflict_markers.pyall pass cleanly.