Skip to content

compiler: the references decoy builds on its own; a type no protocol reaches has to be bounded - #18

Merged
Kinflou merged 1 commit into
mainfrom
compiler/decoy-bounded
Nov 16, 2026
Merged

Kinflou merged 1 commit into
mainfrom
compiler/decoy-bounded

Conversation

@Kinflou

@Kinflou Kinflou commented Nov 16, 2026

Copy link
Copy Markdown
Member

Follow-up to #17. core#297 implements the references cases and 32 of 37 pass; the five resolved-* cases fail because of the fixture, not the rule.

The problem

The decoy archive schema (struct Invoice { data: string }) was refused on its own: the language requires a position no protocol reaches to be bounded (core#98; docs guides/idl/types.md: "A position no protocol reaches ... has to be bounded"). So archive gave bounds::unbounded whatever api wrote. The spec had no case for that rule, which is how the fixture slipped through.

The decoy now

Still struct Invoice { data: string }, in archive, now with a marked protocol that reaches it, as in bounded/other-schema-marked and core#297's own test:

struct Invoice {
    data: string
}

@unverified = "the archive keeps what it is given"
protocol Dump {
    function put(i: Invoice);
}

The resolved-* packages set settings = { annotations = { unverified = { allowed = true } } } and expect Dump (gives up bounded_size, acknowledged at protocol scope with that reason) and Orders (gives up nothing), with the warning unverified::bounded-size. A spelling that wrongly reaches the decoy from the unmarked Orders is still bounds::unbounded, which is what resolved-decoy expects (unchanged outcome).

The language has no other way for a type nothing reaches: a protocol marker only covers what the protocol reaches. (core also has markers at inner scopes; the spec's cases for them are still to come, so the decoy doesn't use them.)

New bounded cases

  • unreached-unmarked: a struct no protocol reaches, with a string without a maximum, is bounds::unbounded.
  • unreached-list-unmarked: the same with a list (u8[]).
  • unreached-allowed-still-unmarked: the same where the package allows @unverified; nothing marked it.
  • unreached-bounded: a struct no protocol reaches, bounded, builds with no protocols.

The marked form for a type no protocol reaches is the marked protocol that reaches it, already covered by bounded/other-schema-marked.

compiler/readme.md's bounded row says so. specs/check.sh --check is clean.

…tocol reaches has to be bounded

The resolved-* cases' decoy Invoice (archive) held a string without a maximum and nothing marked it, so archive was refused on its own, whatever api wrote. The decoy now has a marked protocol Dump reaching it, as in bounded/other-schema-marked, and each case expects Dump's given-up bounded_size and acknowledgement. resolved-decoy still fails with bounds::unbounded. New bounded cases: unreached-unmarked, unreached-list-unmarked, unreached-allowed-still-unmarked, unreached-bounded.
@Kinflou
Kinflou marked this pull request as ready for review November 16, 2026 03:14
@Kinflou
Kinflou merged commit 8a9d47d into main Nov 16, 2026
7 checks passed
@Kinflou
Kinflou deleted the compiler/decoy-bounded branch November 16, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant