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-1037 guard: a field-subscript STORE through one alias of a struct
# while the other alias is still observed — Python shares the object (c
# sees 99); Rust's value model would clone. Must REFUSE, not miscompile
# (collect_obj_mutated counts `c2.counts[0] = v` as object mutation via
# subscript_chain_attr_base).
class C:
    counts: list[int]

    def __init__(self) -> None:
        self.counts = [1, 2]


def main() -> None:
    c = C()
    c2 = c
    c2.counts[0] = 99
    print(c.counts[0])