Repository navigation
Conversation
added 2 commits
October 3, 2026 05:01
…e, verify, render, accept, audit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements D85 (spec §16.2b.6, #2003):
returns borrow T from parent T of param N.Design
from parent <Resource> of param <ref>; the RETURNS_BORROW clause carries a 4th op, the parent symbol (0 for the existing forms).verify_facade_parent_borrow): the parent is resolved through the argument resource's declaredborrowsclauses. Errors: the resource declares noborrowsparent; it declares none of the named type; the borrowed type is not the parent's type; a producer of the argument's resource does not state exactly one parent of that type (no parent field to read on every value). The C return must be the parent's representation. A parent borrow and afrom paramborrow of the same resource are not mixed (oneBorrowed<R>, one origin rule).Borrowed<R>holdsorigin: &Rand the presented method fills it from the argument's parent field (self.parent). Dependency derivation is now one function (facade_render_item_deps) read by both the resource's type and the parent field.facade_declare_view_through_param, kept across the body check), so the borrow's origin is the parent's origin, not the statement:st.step()no longer poisons it, and it may outlive the statement but not the connection. Operations through it are operations on the parent's origin: a call whose touched argument is a parent borrow also poisons the views of what it views (facade_apply_call_touches). A parent borrow is not itself poisoned by calls on the parent (it is the parent, living as long as its origin). The fact is the stated clause (facade_type_is_parent_borrowreads the contract), never the type's shape.returnsrow name the parent and the param it is read through; the audit fails when a parent-borrow item's presented method does not view through that param (the fact acceptance reads).lib/facades/sqlite3.wis unchanged: it has nosqlite3_db_handleitem, no program needs one, and adding it would edit the byte-identical copy inexamples/c-interop(an example is Eric's contract). The clause is exercised by fixtures.Tests (each failed on the base stage1 first)
test/behavior/behav_c_facade_parent_borrow.w(runs over inline C):b.changes()afterst.step(); the borrow returned past the statement's scope.test/contract/ok_parent_borrow.w+.expected(sqlite-shaped,sqlite3_db_handle).test/compile_errors/err_c_facade_parent_borrow_{undeclared,wrong_parent,type_mismatch,producer_without_parent,mixed_forms}.w— the refusals.test/compile_errors/err_c_facade_parent_borrow_statement_view_dies.w— acolumn_textview of the statement still dies acrossstep.test/compile_errors/err_c_facade_parent_borrow_invalidates_parent_views.w—b.changes()invalidates anerrmsgview ofdb.test/compile_errors/err_c_facade_parent_borrow_outlives_parent.w— the borrow cannot outlive the connection.err_1977_borrowed_resource_after_step.w(thefrom paramform) still refused.Verification
src/main build :gate(pinned seed): green.:contract-view-testscannot run on main under any driver (:contract-view-tests is red on main: build.w's tuple-destructuring let is not comptime-evaluable (NK_LET_ELSE) #2026: build.w's tuple let is not comptime-evaluable); its checks were run by hand over test/contract/*.w with the fresh release binary — every audit verdict, needle and snapshot agrees, existing snapshots unchanged.