Skip to content

Collections, iterables, yield and tuples: sections 12, 17 and 30 - #135

Merged
heyJordanParker merged 36 commits into
masterfrom
feat/collections
Oct 16, 2026
Merged

heyJordanParker merged 36 commits into
masterfrom
feat/collections

Conversation

@heyJordanParker

@heyJordanParker heyJordanParker commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Completes: §12, §17, §30

Problem

Section 12 (collections), section 17's loop rules and section 30 (tuples) had seven spec examples in sharp/baseline/spec. PHP# had no Iterable<T>, no lazy operations, no yield and no tuples. It refused the List index write, getOrNull, toSet, a Map's values() and a method with no access modifier. It silently accepted items[5] ?? 0 and a List variable passed where a Set is expected. A loop over a Map with one variable gave the value instead of the entry, and a List read before is, as or ?. read a missing index as null instead of throwing.

Solution

Every rule of the three sections now compiles, refuses or runs as the spec annotates, in the checker, the bridge, the engine and the standard library. The design and the answers to its seven questions are in docs/architecture/slices/12-collections.md.

  • The List index. x[i] = v, +=, ++ and -- write a List element through Sharp\Collection::set, on a local, a property, a hooked property and a nested List, and throw OutOfRangeException past the end. A List read throws on a missing index whatever follows it, is, as and ?. included. getOrNull(i) is the safe read, and x[i] ?? fallback is a compile error that names it. List.get and List.set are deleted, with no alias. Engine: index_changes.phpt, collection_methods.phpt.
  • toSet, values and Set places. toSet() and a Map's values() exist. A List variable passed, stored or returned where a Set is expected is "A List is not a Set: write picked.toSet().", and a list literal still lands as a Set. Engine: collection_methods.phpt.
  • Collection keys. A List, Map or Set whose every type argument has == and hash() keys a Map and joins a Set.
  • => in a literal reads "PHP# writes a Map entry as key: value: => is the lambda arrow".
  • A method with no access modifier is private, as section 5 says. Only methods: properties belong to Run section 6's fields and properties on the engine #132 and constants to naming-cases. An internal method runs as PHP's public one. An abstract method with no public or protected is "A subclass implements an abstract method, so it is public or protected: write protected abstract.", as C#'s CS0621.
  • Errors that name the PHP# form. list[] = value names add, map[] = value names map[key] = value, and for (x in y) without const names of. const [a, b] = value takes only a tuple, and a List points to xs[0].
  • Iterable<T> and its lazy operations. Iterable<T> is PHP's iterable of T. filter, map and take read nothing until toList() or a loop reads the chain, which runs on the engine's new final class Sharp\Sequence. A lazy plain PHP source, typed iterable<T>, Generator<K, T>, an IteratorAggregate or Laravel's LazyCollection, is wrapped in a check stage where an Iterable<T> holds it, a parameter, a typed local or a return, so a bad element throws a TypeError where a loop reads it. Until then it keeps its own class and methods. A PHP# Iterable carries its element type whatever its body calls, so is Iterable<Order> reads no element, and a plain PHP Traversable is only an Iterable<Any?>. Engine: sequence.phpt and its two JIT variants, collection_crossings.phpt, yield.phpt.
  • yield. yield value; and yield ...other; produce an Iterable<T> lazily in a method that returns Iterable<T>, an extension method included, and Iterable<T>? can't yield. yield ...other; gives each element the generator's next automatic key, so plain PHP's iterator_to_array keeps every element. A PHP# generator carries the type it yields. string.parseCsv() joins the standard library beside trim(). Engine: yield.phpt, library_text.phpt.
  • A plain PHP array where PHP# reads a Map. A Map method that reads its receiver runs on the \Sharp\Map made of the array, a local without a type holds the Map, and a loop over an array keyed by string keeps each key a string, in the one-variable form too. Sharp_Collection::get reads only a Map. Engine: collection_crossings.phpt.
  • Tuples. [Money total, int count] is a tuple type, a nullable one keeps its element names, a loop variable takes one as in for (const [string, int] entry of stock), a list literal becomes a tuple where one is declared, const [total, count] = … unpacks one, and summary.total reads an element by its name. At run time a tuple is a PHP list. A value from plain PHP enters a tuple only as a PHP list of exactly its length whose elements hold their types, and the refusal names the bad element's position. Past four elements the checker suggests a struct. Engine: collections.phpt, collection_crossings.phpt.
  • A Map's entries. A Map<K, V> is an Iterable<[K, V]> of its entries. One loop variable over a Map is each entry, [a, b] over a Map reads its key and value, and [a, b] over any other collection unpacks each two-element tuple. A Map that lands in an Iterable place, a local, a return, a parameter or yield ..., is the Sharp\Sequence of its entries, from PHP# and from plain PHP. Engine: collection_crossings.phpt.
  • ?? continue in a loop's own condition skips to the loop's next check, as continue does anywhere in the loop, so the condition runs again. Section 17 gains that line.

Changes to the spec text

  • index-rules: the claim on lines[0] = line; reads "replaces the element at 0; throws OutOfRangeException when lines is empty", one claim the spec run checks, where it read "…, and throws …".
  • Section 17 gains the ?? continue line and its example continue-in-condition, with a row for while, do and for.
  • tuples: the example runs in Order, and its two method bodies read this.total, this.count and this.since. They read bare total, count and since, which section 4 makes locals, so the example could not compile. Its hidden setup declares the three fields, an order local and a stand-in Date class, because the standard library's Date is a static class with no instance.

Harness changes

  • Zend/tests/sharp/harness/Arrays.inc gains names_and($last), a plain PHP generator documented iterable<string>, and Names::$given, which counts the names it gave, so a test sees how far a loop read it. Its twins names_generator, name_rows and lazy_names give the same names as a Generator, an IteratorAggregate and a LazyCollection with its own count().
  • Zend/tests/sharp/harness/Prices.inc gains listed(), a list<int>, for for_of.phpt's value-only loop. A single loop variable over Prices::all(), a Map, is now the entry.
  • No file under sharp/harness/ changes.

Names beyond the design note

  • The CST nodes TupleHint, TupleElementHint, LocalTarget and LocalUnpack, with their NodeKind.php entries. LocalDeclaration.target replaces LocalDeclaration.name.
  • codex's TList.tuple_names, TIterable.holds_map_entries and TIterable::sharp_of.
  • ForOfTarget::Unpack and its node ForOfUnpackTarget, with the fields first and second, replace master's ForOfTarget::KeyValue and ForOfKeyValueTarget, with their NodeKind.php entry, walker and parser functions and fingerprint tag.
  • The parser state's members_name, the class-like whose members it reads, so [Deprecated] Report(…) is the constructor's attribute list and not a tuple return type.

Verification

  • sharp/bin/test --opcache --repeat Zend/tests/sharp: 287 of 287 pass in each of the four modes, with master merged at cb3f0940bf.
  • sharp/bin/spec: "Checked 198 examples, ignored 1, and 27 fail", equal to sharp/baseline/spec.
  • sharp/bin/spec --self-test: 18 of 18 self-test examples pass. The refusal example now writes a property with no access modifier, since a method with none is now private.
  • sharp/bin/spec --base origin/master: "0 entries join sharp/baseline/spec, 7 leave it."
  • mago: the syntax, names, semantics, codex (with property-tests), analyzer, sharp-bridge, fingerprint, formatter, hir and sharp-lean suites, the sharp (71) and compile (78) integration tests, clippy -D warnings on each changed crate, and cargo fmt --all --check. New tests run every line patch-coverage found unrun, among them plain PHP cases for the yield from paths that yield ... now shares.
  • A plain PHP project's analysis is unchanged: mago analyze of build/gen_stub.php, run-tests.php and the SDK's sources gave the same 2046 issues with this branch at 44424a188c and with its base c2aca5e564. The two later commits that touch mago code change only the .sharp dialect.
  • mago analyze of the standard library reports nothing at the note level.

Every rule of section 12 and section 17's collection rules, its state on master c2aca5e observed with a release mago and the engine built from it, the mechanism that serves it, the code it reuses, what the Slice ports from the two unmerged feat/slice-lazy-and-types branches, and seven questions for team-lead. Design only: team-lead approves it before any code.
- A method without an access modifier is private, as spec section 5 says.
- `x[i] = v`, `op=`, `++` and `--` on a List index run `Sharp\Collection::set`, which
  replaces the element, throws past either end, and gives the value it stores.
  `list[] = v` stays refused: appending is `add`.
- `List.get` and `List.set` are deleted. `getOrNull(i)` and `toSet()` lower to PHP on the
  array, and a Map's `values()` runs on the engine beside `keys()`.
- A List index before `?.`, and the index `is`, `as` and `match` test, is a bare read that
  throws on a missing index; `?.` skips only a null element. On a List of non-null elements
  the `?.` is the needless null check. A Map index keeps every quiet form.
- `x[i] ?? fallback` and `x[i] ??= v` on a List are compile errors whose help names
  `getOrNull`, for every element type.
- The bridge's ZEND_DIM_IS mark, the compiler's two arms for it and the engine's quiet
  collection read are deleted.
A `List` variable passed, stored or returned where a `Set` is expected is
a compile error whose help writes the conversion, as
"A `List` is not a `Set`: write `picked.toSet()`." A list literal still
lands as a `Set`, and plain PHP may still pass a list to a PHP# `Set`
parameter, which the method makes a `Set` before its body runs.

A `Map`'s key and a `Set`'s element take a `List`, `Set` or `Map` whose
every type argument has `==` and `hash()`, which the engine already
compares and hashes by elements. The rule's message names them.
PHP's `["key" => value]` read "`EqualGreaterThan` is PHP syntax that
PHP# does not have", which names a token. It now reads "PHP# writes a
`Map` entry as `key: value`: `=>` is the lambda arrow".
`lines[0] = line;   // replaces the element at 0, and throws
OutOfRangeException when lines is empty` read as prose, so the run
wrote the line bare on an empty list and its throw stopped the example.
With `;` before `throws` the claim is a checked `throws`, and the rule
reads the same.
`Iterable<T>` was "Cannot find type `Iterable`". It is now PHP's
`iterable` of `T`: a `List<T>`, a `Set<T>` and a plain PHP iterable
land in one, a loop reads `T`s, and `rows[0]` is "An `Iterable` has
no index: loop over `rows`, or read `rows.toList()`."

Its lazy operations, ported from feat/slice-lazy-and-types:
- `filter`, `map` and `take` return an `Iterable` and read nothing;
  `toList()` reads the chain into a `List<T>`
- the prelude's `Sharp\IterableMethods` types them, and a method an
  `Iterable` lacks names `Iterable<Order>` and the four it has
- a place declared `Iterable<T>` has only them, whatever it was given
  last: a `List`, or a plain PHP class with its own methods
- the bridge lowers a chain to one `\Sharp\Sequence::from(receiver)`
  and a call per operation, null-safe through the conditional

The engine's `Sharp\Sequence` runs them, ported with its tests. Every
PHP# Iterable carries its element type at run time:
- a lazy plain PHP source crossing into an `Iterable<T>` (an argument,
  a return into a typed place, a property, a struct's parse) is
  wrapped in a check stage, so a bad element throws a TypeError where
  a loop reads it, worded as the crossing's, and not before
- `is Iterable<T>` reads no element of a lazy source: a check stage
  carries `T`, a map stage its lambda's return type, the other stages
  their source's, and a plain PHP Traversable is only `Iterable<Any?>`
- a `Sharp\Set` held as an `Iterable<T>` is checked whole, as a list is
…ts type

App code streams large files and query results row by row, and PHP# had
no way to write such a method. A method that returns Iterable<T> now
produces its values with `yield value;` and `yield ...other;`, and runs
only when a loop reads it.

Yield:
- `yield ...other` parses in PHP# only, and runs as PHP's `yield from`
- each yielded value is checked against T, with the types named as
  PHP# writes them
- yield outside such a method, in a lambda, as a value, with a key, bare,
  as PHP's `yield from`, and `return value;` in a method that yields are
  refused, naming the PHP# form
- a method that yields compiles to a PHP generator

A generator carries its type:
- `is Iterable<Row>` on a PHP# generator reads the element type its
  method returns, spelled for its frame, and none of its elements
- a plain PHP generator, and a finished one, are Iterable<Any?>

string.parseCsv() reads one CSV line, and a blank line is one empty field.

sharp/mago/crates/
├── syntax/src/parser/internal/yield.rs*      <- `yield ...` and `yield from` in PHP#
├── syntax/src/cst, utils, walker*            <- Yield::Spread in every walk
├── semantics/src/internal/checker/sharp.rs*  <- where yield is allowed
├── analyzer/src/expression/yield.rs*         <- messages name PHP# types
├── sharp-bridge/src/lower.rs*                <- YIELD, YIELD_FROM, generator flag
└── fingerprint, formatter, hir*              <- the new node
ext/sharp/sharp.c*                            <- sharp_generator_yields
sharp/composer/library/Sharp/Text/Text.sharp* <- parseCsv
Zend/tests/sharp/
├── Import.sharp+                             <- yielding methods
└── yield.phpt+                               <- lazy runs and carried types
Spec section 30. `[Money total, int count]` is a tuple type, a list
literal becomes a tuple where one is declared, `const [total, count] = …`
unpacks one, and `summary.total` reads an element by its name. A tuple
runs as a PHP list: the named read is the index read of its position,
and the unpack is PHP's list assignment.

Spec sections 12 and 17. A Map<K, V> is an Iterable<[K, V]> of its
entries. One loop variable over a Map is each entry, `[a, b]` over a Map
reads its key and value, and `[a, b]` over any other collection unpacks
each two-element tuple. A Map that lands in an Iterable place, a local,
a return, a parameter or `yield ...`, is the Sharp\Sequence of its
entries.

The engine reads the type text `[A, B]`. A value from plain PHP enters a
tuple when it is a PHP list of exactly its length whose elements hold
their types, and a refusal names the bad element's position. A
Sharp\Map that enters an Iterable<T> is checked whole, entry by entry,
and is read through a Sequence of its entries.

Names beyond the design note's list: the CST's TupleHint,
TupleElementHint, LocalTarget and LocalUnpack (LocalDeclaration.name is
now LocalDeclaration.target), and codex's TList.tuple_names and
TIterable.map_entries.

The spec's tuples example now runs in Order, reads its fields through
`this.`, as section 4 requires of every member, and declares a stand-in
Date in its hidden setup, since the standard library's Date is a static
class. The fixtures that looped over a Map with one variable and used it
as the value now read the key and value, and harness/Prices.inc gains a
list<int> source for the value-only loop.
… attributes

An attribute list and a tuple type both open with `[`, so
`[Deprecated] Report(int count) { }` in class Report parsed as a method
named Report that returns the tuple `[Deprecated]`, and was refused as
"A method named after its class". The parser now keeps the name of the
class-like whose members it reads, and brackets before that name and `(`
are the attributes of its constructor. Before any other name and `(`
they stay a method's tuple return type.
…match the spec

Section 17 gains the line team-lead's answer to question 4 gives:
`?? continue` in a loop's own condition skips to the loop's next check,
as `continue` does anywhere in the loop, so the condition runs again.
Its example `continue-in-condition` has a row for `while`, `do` and
`for`, and counts the passes the null results skip.

Decision 026 now writes the index write, `getOrNull`, the `Map` read and
a `Map` loop's entries as the spec does, where it named `lines.set` and
a loop of values. Decision 033 makes a `Map` the `Iterable` of its
entries, and records that a PHP# `Iterable` carries its element type.

The design note records each question's answer and the shape that was
built.
The conflicts kept both sides: the method body text names tuple unpacks,
`yield` and `nameof`, ZEND_ACC_FIELD and ZEND_ACC_GENERATOR are both
flags, and a prefix or postfix step lowers a List index write and a
static accessor's step alike. sharp_arginfo.h is regenerated from the
merged stub.

#132's `internal` is an access modifier, so a method with `internal`
and none of `public`, `protected` or `private` runs as PHP's `public`
one, not as section 5's `private` default for a method with no
modifier.
patch-coverage found 28 changed lines that no test ran. Each now runs:

- `yield from` of an unknown iterator, and a value or key mismatch whose
  types are complex enough for a diff note, in three plain PHP cases.
  `analyze_yield_from` moved them when `yield ...` came to share them.
- an iterable an external analyzer sends back, which is PHP's iterable
- an assertion that meets a list type in each of its four shapes, and an
  `unset` of a list's last element, of a missing index and of a string
  key, the struct literals that gained `tuple_names`
- a method in braces on an `Iterable`, named as the analyzer read it
- a tuple element written, and a missing name on a tuple with one named
  element
- `[a, b]` over a `List` of three-element tuples
- `+=` on a `List<string>` element, which joins the strings

The bridge's tuple element lookup reads a member name the checker lets
through, so a name that is no identifier is `unreachable!`, as `member`
writes it.
The `refusal` example wrote `void bump() { }` for a "not supported yet"
refusal. Section 5 now makes a method with no access modifier private,
so the checker accepts it. A property with accessors and no modifier is
still refused that way, so the example writes one.
- `yield from` outside any function reports `yield-outside-function` and
  stops, as `yield` does.
- Two lists with known elements meet element by element only when
  neither holds the other. Two such lists at the top reach the earlier
  refinement instead, so the case asserts them as rows of a non-empty
  list.
- `TIterable.map_entries` is `holds_map_entries`.
- `TIterable::sharp` is `sharp_of`.
- `ForOfTarget::KeyValue` is `ForOfTarget::Unpack`, and its fields are
  `first` and `second`, as a loop unpacks a tuple's two elements as well
  as a `Map`'s key and value. Its struct `ForOfKeyValueTarget` is
  `ForOfUnpackTarget` with it, in `NodeKind`, the walker and the parser.
- `with_to_set_help` is `with_set_conversion_help`.
A method with no access modifier is private, so `abstract int size();`
compiled, and PHP's engine refused the private abstract method when the
file ran. A subclass implements an abstract method, so the checker now
refuses one that is private, written or by default, and names the
modifier to write, as C# refuses a private abstract member.
`for (const x in y)` was the one parse error that names `of`, but with
no `const` or `let` the header read as the expression `x in y` and gave
five generic parse errors and two undefined constants. The parser now
reports the error that names `of` at the `in`, and keeps the loop's body
as the statement it parses to, so the code after it still parses.
`check_slice` let a method that returns `Iterable<T>?` yield, and the
analyzer then refused it with "Remove the `?`". A method that yields
gives an `Iterable<T>`, which is never null, so `returns_iterable` loses
its `Iterable<T>?` arm and `yield` there is "`yield` needs a method that
returns `Iterable<T>`." `check_slice` refuses every PHP# method that
yields and returns another type, so the analyzer's PHP# branch of
`invalid-generator-return-type` is gone, and plain PHP keeps master's
message. The design note loses edge case 3.
The checker refused PHP's `x[] = v` as "This write target is not
supported yet in PHP#.", which no `compile error` line accepts, so the
analyzer's "A `List` grows with `add`" never showed. The checker now
passes an append to a place it writes, and the analyzer refuses it by
the collection: `add` for a `List`, "has no index" for a `Set`, and a
new message for a `Map`, which took an append silently when its key
type is `int`. A `Map` append is then read as a write of its own key
type, so a `Map<string, …>` is not refused a second time for an `int`
key. The test checks each message's text.
`List<int> xs = [1]; const [x, y] = xs;` compiled, and `y` was null at
run time where the checker said `int`. A tuple's type gives its length,
so an unpack now takes only a tuple: anything else is
`invalid-destructuring-source`, named by its declared collection, and a
`List` gets the help that reads it by index, as in `xs[0]`. The value is
analyzed once, before PHP's destructuring, so a `Map` is refused once
and not with PHP's `array_values` help, and the unpacked locals take no
type.
The combiner merged every list of a union into one shape, so
`[Item first, int count]?`, a tuple joined with `null`, became
`List<int|Item>?`: it lost its length and its names, `[5, 6, 7]` fit
it, and `given?.count` was a property access on a list. A tuple is no
list shape, so the combiner now keeps each tuple type as its own member
of the union, untouched, as it keeps a `Set`.
`for (const [string, int] entry of stock)` was a parse error: the
header read `[` as the start of `[key, count]`, which unpacks each
element. `is_at_tuple_hint`'s scan to the name after a tuple type is
now `peek_after_tuple_hint`, and the header asks it whether that name is
followed by `of` or `in`. Only then is the bracket a type. The scan
cannot take `of` in `is_at_tuple_hint` itself, which would read
`[Pure] string of(…)` as a tuple type. The analyzer checks the entry
against the written tuple as it checks any typed local.
`enclosing_iterator_method` looked for the method among its class's
members, so `yield` in an extension method that returns `Iterable<T>`
was "`yield` needs a method that returns `Iterable<T>`." It now looks
among the members of the extension block that holds the `yield` first,
and a value `return` there is refused as in a class method.
…y element

A plain PHP call typed `iterable<T>` was checked element by element, but
one typed by its class, `Generator<int, T>`, an `IteratorAggregate` or
Laravel's `LazyCollection`, got no check, so a bad element reached
PHP# code typed `T`.

The check is where an `Iterable<T>` holds the result, a typed local, a
return or a PHP# parameter, and not at the call: until then the value
keeps its own class and methods, as section 12 says, and a check at the
call would put a `Sharp\Sequence` where code calls the class's own
`count()` or `each()`. `Types::lazy_call_check` gives the place's text,
`crossed_value` checks a value that lands in a local or a return, and
`call` checks an argument it passes to a PHP# callee, whose parameters
the engine checks only for a plain PHP caller.

The harness gains a generator, an `IteratorAggregate` and a
`LazyCollection` twin of `names_and`, each yielding a bad element.
A generator's element type was read from its method's function type, and
a method whose body calls plain PHP no `extern` declares has no function
type, since no type can say its effects. So such a generator, and a map
stage whose lambda calls plain PHP, read as `Iterable<Any?>`, and
`is Iterable<Row>` was false.

A method or lambda with no function type now carries its result type
text alone in the same place, and `sharp_function_carried` reads either:
`sharp_closure_type` keeps only a function type, so `is Function<…>` is
unchanged, and `sharp_generator_yields` and the map stage read the
result type from both.

An extension method that yields was not flagged a generator, so the
engine crashed when it ran. `generator_flag` now flags both a class's
method and an extension's, and an extension method carries its result
type too.
`yield ...other;` ran as PHP's `yield from`, which gives each element
the key `other` gives it. So `yield ...pending; yield latest;` gave the
keys 0, 1, 0, and plain PHP's `iterator_to_array` kept two of three
elements.

It now runs as `foreach ($other as $element#N) { yield $element#N; }`,
so each element takes the generator's next automatic key, as
`yield value;` does. `check_slice` keeps `yield ...` a statement, so
the loop stands where the statement does.
…n it

A `Map` method on a plain PHP array ran on the array as if it were a
`List`: `has` and `keys` threw "runs on a Map or a Set", and `get` read
only an `int` key, through an `IS_ARRAY` arm left over from `List.get`.

A `Map` method that reads its receiver, which `Sharp\MapMethods`
declares mutation-free, now runs on the `\Sharp\Map` that
`crossed_value` makes of a value that can be a PHP array, null-safe or
not, so a key keeps its `string`. A local declared without a type takes
its value's type where that value crosses, as a typed local does, so
`remove` on it changes the local's `Map`. `Sharp_Collection::get` reads
the table, as `has` does, and its `IS_ARRAY` arm is deleted.
…tring

PHP holds an all-digit `string` key as an `int`, so a loop over a plain
PHP `array<string, int>` gave the key "5" as the `int` 5, in a `string`
loop variable, whichever variables the loop took.

`for_of` now runs over the `\Sharp\Map` that `crossed_value` makes of a
plain PHP array whose `Map` type is keyed by `string` and no `int`, or
by a backed enum, which takes each key back, as a typed local does. A
`Map` keyed by `int|string` keeps PHP's keys, which are already its
values.
`cargo fmt` lays out the lines the renames and fixes lengthened, and two
clippy findings change: `is_at_for_in_without_keyword` reads the next
token with `is_none_or`, and `enclosing_iterator_method` takes a class's
members without a borrow clippy calls needless.
An untyped local took its value's type only where the value could be a
PHP array, so a local that held a `Map` method's result stayed a local
that might hold a PHP array, and each `Map` method on it crossed it
again, which the opcodes test of `Roster` showed.

Every untyped local that holds a `Map` or a `Set` now takes its value's
type, as a typed local does: `crossed_value` still crosses only a value
that can be a PHP array, and a read of the local needs no crossing.
Two conflicts. The semantics checker runs master's `check_method_modifiers`
beside `check_abstract_access` and `check_iterator_returns`. The bridge
keeps master's `method_declaration`, which an interface's `signature`
shares, with this branch's `private` default for a method with no access
modifier and the PHP# callee its parent constructor call checks lazy
sources against.

Master's `super_of_call` passes its PHP# callee to `call` too, and two
of master's bridge tests show the result type a method with no function
type now carries.
patch-coverage found three lines no test ran.

- A `Map` append read its key type from the first keyed array of the
  written type, with an arm for any other member that no `Map` reaches.
  It now reads the one array of the type without null, so a nullable
  `Map<string, string>` gets the one error too, which a new row shows.
- `reads_map` looked the callee up again, with an arm no call reaches.
  It reads the method `collection_method` already named.
- `report_unpacked_non_tuple` shows a value no place declares by its own
  type, which a row unpacking a call's `List` result now runs.
@heyJordanParker
heyJordanParker merged commit 39b3053 into master Oct 16, 2026
24 of 26 checks passed
heyJordanParker added a commit that referenced this pull request Oct 16, 2026
Brings #135, which makes a method with no access modifier private.

# Conflicts:
#	Zend/tests/sharp/Members.inc
#	sharp/mago/crates/codex/src/scanner/function_like.rs
#	sharp/mago/crates/semantics/src/internal/checker/sharp.rs
#	sharp/mago/crates/semantics/tests/sharp.rs
#	sharp/mago/crates/sharp-bridge/src/lower.rs
#	sharp/mago/crates/sharp-bridge/src/lower/types.rs
#	sharp/spec-self-test.md
@heyJordanParker
heyJordanParker deleted the feat/collections branch November 3, 2026 22:08
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