You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An annotated operator corrupts a call to a relatively-imported def: Nat../../demos/python/scanner.pos_col #914
Context: we keep a public fork (phenomenon0/bend) and build a Python→Bend toolchain on it. We synced to 2.0.17; both sites below are verified byte-identical on main today (2.0.21).
The 2.0.16 rule that a spaced binary operator demands an enclosing ( .. : T) forced a sweep over our tree. Three call sites could not be repaired into the annotated-operator form and are written as Nat.add / Nat.mul calls instead (e.g. demos/python/lexer.bend:74, demos/python/lint.bend:50 in our fork), because the repair produced a corrupted reference:
parse_term_ns (bend2/bend.ts; the if (f.k[0] === ".") branch) prefixes any head Ref whose key starts with . with the annotation's type namespace: f.k = parse_reso(p, h.k + f.k);
Under the suites' relative imports a local call's key is e.g. ../../demos/python/scanner.pos_col — it starts with ., so wrapping it in an annotated operator produced Nat../../demos/python/scanner.pos_col and resolution failed.
The diagnostic nearby already knows the distinction — on main, bend2/bend.ts:725 tests tm.k[0] === "." && tm.k[1] !== "." (a single leading dot is a relative qualifier; .. is a path) — but the namespace walk applies no such guard.
Repro shape: load a module through a ../../-style path (as our suites do), then wrap a call to another def of that module in an annotated spaced operator:
# C = import ../../demos/python/scanner.bend as C
def g(lo: Char) -> Nat:
(C.pos_col(lo) + String.length(raw) : Nat)
Observed at 2.0.17: Nat../../demos/python/scanner.pos_col. (A minimal same-directory ./ import did not reproduce it for me — the ../../ key depth seems part of the trigger.)
Impact: annotated operators cannot wrap relative-imported calls; the workaround is the explicit Nat.add(...) form in three sites of our tree.
Fixed in 2.0.22: the namespace walk you point at now uses the same rule as the diagnostic, an operator placeholder is the name whose only dot leads it (k.lastIndexOf(".") === 0), so a ../../ import inside an annotated operator resolves. Your shape prints the right value on 2.0.22 and later; the three Nat.add sites in your tree can go back to the operator form. Thank you for the precise pointer.
Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself.
Activity
VictorTaelin commentedon Sep 21, 2026
Fixed in 2.0.22: the namespace walk you point at now uses the same rule as the diagnostic, an operator placeholder is the name whose only dot leads it (
k.lastIndexOf(".") === 0), so a../../import inside an annotated operator resolves. Your shape prints the right value on 2.0.22 and later; the threeNat.addsites in your tree can go back to the operator form. Thank you for the precise pointer.Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself.