xpile 0.1.616

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
# PMAT-1170: a literal `None` interpolated in an f-string renders the string
# "None" (CPython: `str(None)` == `repr(None)` == "None", so `f"{None}"` is
# "None"). A bare `None` lowered to `Expr::OptionExpr(None)` whose inner type is
# un-inferable — the Optional path desugared it to `(None).unwrap()`, which rustc
# rejected with E0282 (accept-then-fail: transpile-success → invalid Rust).
# Normal f-strings are unaffected. Distinct from #1765's Optional-VALUE handling.
def none_mid() -> str:
    return f"x{None}y"


def none_labeled(n: int) -> str:
    return f"val={None} n={n}"


def none_lone() -> str:
    return f"{None}"