Skip to content

v0.6.14

Choose a tag to compare

@github-actions github-actions released this 29 Apr 04:31
· 37 commits to main since this release
v0.6.14
0ab7fc4

v0.6.14 — codegen module-level: cmp assignment

Date: 2026-04-29
Spec: notes/Spec/1500/1524_gocopy_v0614_codegen_cmp_assign.md
Roadmap: notes/Spec/1500/1523_gocopy_v06x_part2_roadmap.md (band A)
CPython parity: Python/codegen.c (3.14.0): module-level
compiler_visit_expr1 / compiler_compare, driven by a
top-level Assign.

The v0.6.14 release is the first sub-release in band A of the
v0.6.x part 2 roadmap. It teaches the codegen package the
modCmpAssign shape: a single <target> = <left> <cmp> <right>
statement where target, left, and right are all Names of 1..15
ASCII chars and <cmp> is one of the ten comparison operators
the classifier supports.

The bytecode is RESUME, LOAD_NAME left, LOAD_NAME right, the
comparison instruction (COMPARE_OP + cache word for the six
rich comparisons, IS_OP for is/is not, CONTAINS_OP +
cache word for in/not in), STORE_NAME target, LOAD_CONST
None, RETURN_VALUE. co_consts = [None]; co_names = [left,
right, target]; co.StackSize = 2.

The 246/246 oracle stays byte-identical. The parallel-output
gate (TestCodegenParity) automatically lights up fixtures
104-113 (10 cmp-assign fixtures spanning every comparison
operator the classifier supports).

Added

  • compiler/codegen/visit_cmp_assign.go — cmpAssignModule
    type, cmpOpFromAstOp operator-mapping helper, and
    classifyCmpAssignModule + buildCmpAssignModule. The
    classifier accepts only single-statement modules so the
    parity gate stays byte-equal with the classifier's
    compileCmpAssign (which has no slot for trailing no-ops).

Changed

  • compiler/codegen/codegen.go — Build recognizes the
    modCmpAssign shape after modUnaryAssign, ahead of the
    ErrUnsupported fallback.

  • compiler/codegen_parity_test.go — compileViaClassifier
    picks up the modCmpAssign classifier path so the parity
    gate validates the new codegen-owned fixtures against the
    classifier reference.

Tests

  • 246/246 fixtures byte-identical (tests/run.sh).
  • compiler/codegen/codegen_test.go adds:
    TestBuildCmpAssignLt,
    TestBuildCmpAssignEq,
    TestBuildCmpAssignIs,
    TestBuildCmpAssignIsNot,
    TestBuildCmpAssignIn,
    TestBuildCmpAssignNotIn,
    TestBuildCmpAssignMultiCharNames,
    TestBuildCmpAssignWithTailFallsThrough.
  • compiler/codegen_parity_test.go automatically validates
    fixtures 104-113 via the new arm.

Out of scope

  • Chained comparisons (a < b < c) — modGenExpr (band A
    v0.6.21).
  • Compare with constants on either side — folded into
    modAssign (v0.6.9) when both sides are constant, modGenExpr
    otherwise.
  • modBoolOp, modTernary — v0.6.15 / v0.6.16.
  • modCollection, modSubscript*, modAttr*, modCallAssign — later
    sub-releases in band A.
  • Function definitions, classes, comprehensions, try/except —
    bands B and C.
  • Optimizer passes, classifier funeral, perf — closing band.