Repository navigation
feat(option): complete logical Option and no-null RSS boundaries - #38
Merged
Merged
Conversation
…wire consumers Add distinct compiler and host Option/Unit schemas, exhaustive constructor and match lowering, Unit facts for empty and no-tail callables, and typed GuestOption conversions. Extend the current VMBC format to version 14 with host schema tags 15/16 and compiler schema tags 19/20, and teach no-std consumers the Option cleanup and nested paths. Cover ordinary, VM-aware and generated host callbacks, resources, Trace JIT, AOT/loaded AOT, nested wire schemas and the actual wasm ABI, with product documentation and macro UI fixtures.
Rust fn() is the same function type as fn() -> (). The shared shape walk and callable label helper now both spell the default return as logical Unit, so GuestOption/GuestResult callable schemas and proc-macro/build descriptors admit no-tail RSS callables. Add generated-host invocation, descriptor equality and typed Store callback coverage for the omitted spelling.
Resolve Option map/and_then/or_else/unwrap_or/unwrap_or_else, ok_or/ok_or_else and Result ok/err through the existing typed match lowering. Extend ? to Option-returning callables, keep Result error exactness, and make RustScript ?. produce a logical Option with single-layer receiver projection, missing-key/present-None distinction, Unit payload preservation, and typed resource ownership. Update the replaced foundation tests and document the delivered behavior.
…ection Record the delivered combinators, lexical Option ? rules, explicit Result conversions, safe ?. projection states, ownership limits and remaining no-null boundary work.
Normalize permitted omitted logical Option fields at construction so both projection and direct field access observe Option::None. Required fields remain checked and legacy nullable fields keep their existing boundary.
Option and Result method lowering stored the inferred present-key object on the hidden callback/fallback let, so a known named return lost its omitted Option field before normalization. Retain the already validated contextual result/payload/error schema on the hidden argument while preserving actual callback parameters, arity, captures and exact-E checks.
Checkpoint the no-null continuation with a compiler-private map edit so unit inserts stay present, RSS remove returns the updated map, and LRU/collection deletion no longer stores null.
Unaccepted checkpoint for the current JSON/generic delta. Named expansion stops on declaration re-entry, including Option-wrapped parameters, and typed objects drop unknown keys while still requiring declared fields. This is not an isolated map fix and does not accept full G.
Unaccepted G-P checkpoint. print, println, type, and format use the source-order checked schema instead of the final local slot. This does not accept full G and does not fix the remaining map/JSON defects.
Restore the id24 non-optional local and declared-return negatives so they exercise the current unit-to-int compile diagnostics.
A same-arity catalog print or println is the selected host call. Language format sugar stays on the intrinsic and on nonmatching overloads.
Sqlite and wasm examples compile in their bundled catalogs. Docs drop stale RSS T? and null callback bodies. Presentation keeps checked source-position schemas.
Option and Result constructors read the captured slot, so the resolver now maps declaration-position outer schemas onto FunctionImpl.capture_copies in both the main typing pass and omitted-field normalization. Nested captures resolve after their owner declarations; later assignments do not replace the captured fact.
An explicit direct import or a single matching wildcard member now selects its host target before language print formatting. A source-defined implementation still wins, and an unmatched wildcard member or non-matching bare catalog arity keeps intrinsic print.
Dynamic host returns are now rejected across every structured expression position, while guest-to-host consumption and the timer callback result exception stay allowed. RustScript source JSON must use the typed route: untyped public decode/encode fail at the call span, inferred concrete encodes are lowered, and nested method callbacks keep natural JSON. Logical presentation and JSON policy now follow actual source ids and function ownership, so plugin frontends keep their legacy nullable and public JSON capabilities.
A canonical host or SDK writer may omit the Null-valued Unit payload. Logical display, declared Option<Unit> field encoding, and REPL formatting now restore Some(()) for that authoritative schema only; tag-only Some under any other payload schema still fails.
The Option reference now states the shipped RustScript policy: explicit null literals and legacy nullable annotations are rejected in source, source JSON calls use the typed route, typed hosts publish GuestOption and Unit, and ambiguous value-position Unit JSON remains rejected. Internal VM and other-frontend legacy contracts are called out separately.
A real dep.rss export carrying a legacy T? return is rejected at its own module parse with the module path, while the same import with a concrete int export compiles and runs.
The lint fixture now uses typed decode and typed encode with the declared Profile schema, preserving the no-unknown-warning oracle without relying on the removed untyped RSS JSON route.
RSS rejects the null literal these VM close tests used only to construct a machine. Use () so the existing pending, permit, reentry and reclaim assertions actually run.
The installed sqlite::close contract returns logical Unit. The exact catalog pin still expected Null while the same test's resolver pin already expected Unit.
RustScript JSON calls require a concrete type argument. Keep the regex match, schema annotation, encode/decode round trip, output and stack oracles, and spell the calls with the current typed form.
A deadline-bounded busy timeout is an integer millisecond wait, so commit can return SQLITE_BUSY just before the Instant deadline. Keep the 100 ms deadline, late reader release, rollback, and busy-timeout restoration, and report that wait as the configured deadline error.
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.
Summary
OptionandUnitcontracts across host schemas, guest SDK conversions, wire values, no-std and Wasm consumers.?, typed optional projections and omitted-field construction, including named records and callable payloads alongside existing Result propagation.nullliteral and enforce typed JSON and dynamic host-output admission boundaries, preserving VM-internal Null and the semantics owned by other frontends.Validation
Local execution evidence is bound to
e034f69ac4f6658a48632c350d1e1f61305f8b4f.Local strict checks select eligible libraries/tests/binaries and do not claim local example/bench or all-target coverage. Cache prewarming is compilation-only and is not counted as business-test execution.