Implement the following plan:
Fix: Channel array slices incompatible with direction-restricted params (#57)
Context
When a proc parameter is []CHAN BYTE in?, codegen emits in []<-chan byte. Callers passing []chan byte fail to compile because Go slices are not covariant — []chan byte cannot be assigned to []<-chan byte. This blocks transpilation of sort_pump.occ and other programs that pass channel arrays to direction-annotated params.
Approach: Drop direction from channel array params
Generate []chan T instead of []<-chan T / []chan<- T for channel array parameters. Single-channel params (CHAN OF INT c?) continue to use direction prefixes since Go individual channels ARE covariant.
Rationale: The codegen has no type-tracking system to know whether an argument is already directional, making call-site conversion loops impractical. Occam enforces direction safety at the source level, so the transpiler doesn't need to re-enforce it in Go. This is a one-line fix with no risk of regression.
Changes
1. codegen/codegen.go line 2039 — Drop direction for channel arrays
// Before:
goType = "[]" + chanDirPrefix(p.ChanDir) + g.occamTypeToGo(p.ChanElemType)
// After:
goType = "[]chan " + g.occamTypeToGo(p.ChanElemType)
2. codegen/codegen_test.go lines 617-629 — Update unit test assertions
Update TestChanArrayDirParamGen to expect []chan int for both ? and ! directions.
3. codegen/e2e_array_test.go — Add e2e test
Add TestE2E_ChanArrayDirParam that passes a [n]CHAN OF INT array to a proc with []CHAN OF INT in? and []CHAN OF INT out! params. Verifies the transpiled code compiles and runs correctly.
4. CLAUDE.md — Update mapping table
Add row documenting that direction is dropped for channel array params.
Verification
go test ./codegen -run TestChanArrayDirParamGen # updated unit test
go test ./codegen -run TestE2E_ChanArrayDirParam # new e2e test
go test ./... # full suite
# Course module regression check:
./occam2go -I kroc/modules/course/libsrc -D TARGET.BITS.PER.WORD=32 -o /tmp/course_out.go kroc/modules/course/libsrc/course.module && go vet /tmp/course_out.go
# Repro from issue:
./occam2go -I kroc/modules/course/libsrc -D TARGET.BITS.PER.WORD=32 -o /tmp/sort_pump.go kroc/modules/course/examples/sort_pump.occ && go vet /tmp/sort_pump.go
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /home/david/.claude/projects/-home-david-projects-code-associates-occam2go/2e133da4-2875-49f0-ade2-e7a0ac8c9763.jsonl