Issue #1789: an assert over a method’s self field is not a precondition, but the same…

Open and answer this issue on GitHub.

decision, bugs · opened 2026-11-16 · updated 2026-11-16 · 0 comments

Filed by the driver from the Found: of the run of issue-1766 (#1766) (owner, 2026-11-06).

Found

an assert over a method’s self field is not a precondition, but the same assert over a free function’s parameter field is; no decision yet (ADR-269 D5 says a claim that names only parameters is a precondition, D20 says methods have preconditions like any other function; the #1476 comment reads otherwise). Probe, nikaia run scripts/probe.nika -- --file p.nika: struct Bag {\n items: Vec[i64],\n}\n\nimpl Bag {\n fn first(self) -> i64 {\n assert(self.items.len() > 0)\n return self.items[0]\n }\n}\n\nfn main() throws {\n let b = Bag { items: [] }\n println(b.first())\n} gives NK1300: assert(self.items.len() > 0) is not proved: nothing before it shows it at 7:9; the free twin fn first(b: Bag) -> i64 { assert(b.items.len() > 0) ... } gives NK1300: assert(b.items.len() > 0), the precondition of first, is not proved: one call does not prove it. Expected by D5/D20: the method’s assert is its precondition, refused only at a call that does not prove it. Suspected cause: the precondition computation (D15) does not count self among the parameters (prover_*.nika), unknown which function

To build

Done when

The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the issue is closed as by design, naming the function or ADR.


Generated by Claude Code

Back to Open Issues