xpile 0.1.615

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# PMAT-1047 (sweep #12): int/bool appended into a FLOAT-typed list slot —
# `xs: list[float]; xs.append(3)` (ListAppend) and `d[k].append(3)` over
# `dict[str, list[float]]` (IndexAppend) emitted the raw int (rustc E0308).
# Both paths now widen via to_f64_operand, mirroring the subscript-slot
# (PMAT-1040) and field-append (PMAT-1037 slice D) widening. Verified vs CPython.
def plain_append() -> float:
    xs: list[float] = [1.5]
    xs.append(3)
    return xs[0] + xs[1]


def dict_inner_append() -> float:
    d: dict[str, list[float]] = {}
    d["a"] = []
    d["a"].append(2)
    d["a"].append(0.5)
    return d["a"][0] + d["a"][1]