Skip to content

Issue sweep: 31 bugs across front end, coercion, calls and class resolution - #655

Merged
blacktrs merged 16 commits into
mainfrom
fix/issue-sweep-2026-11
Nov 12, 2026
Merged

blacktrs merged 16 commits into
mainfrom
fix/issue-sweep-2026-11

Conversation

@blacktrs

@blacktrs blacktrs commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A sweep of the open bug tracker: 31 issues fixed (plus get_parent_class() on built-in classes, which had no issue) in four groups, each repro promoted from tests/aot/repro to tests/aot/cases (php is the oracle), plus new cases for the siblings found on the way.

Front end and tooling

  • break(1); / continue((2)); parse; $x instanceof self::$prop names the class by a static property's value (shares new's new_variable parser).
  • #[\Override] accepts a method implementing an abstract method of a used trait (a concrete trait method still does not count, as in php).
  • static::$p = v in a parent that only its subclasses declare $p for lowers to php's run-time Error; the read of the same name now says "Access to undeclared static property" instead of "Undefined constant".
  • Declaration guards fold class constants: if (Logger::API >= 3) { trait Compat … } else { … }.
  • Tolerant-parser ranges start at a parenthesised receiver's (.
  • build refuses "stdlib": false on an app that does not compile the runtime source (it died in clang with an undefined IR value).
  • Library .sig exports class constants again — a front-end memory trim emptied them before the export read them.
  • Builtin name sets back in sync: runtime-name function_exists('stripos') / get_defined_functions() see every builtin; the analyzer indexes the intl prelude; calibrate.sh SYNC is green.
  • DateTime::createFromFormat: Z offsets, escaped literals, microseconds, the zone written in the string, otherwise wall-clock time in $timezone / the default zone.

int → float in union slots

An int landing in ?float / float|string (params, returns, instance and static props, hooks, promoted ctor params, variadics) becomes float, as in php's weak mode.

Calls, spread, variadics, callables

Spread binds string keys like php (variadic keys kept, "Unknown named parameter", positional-after-named), func_get_args() sees spread overflow, variadic __invoke, static methods through FCC / array callables / erased receivers, 'C::m' strings in callable slots, ctor name in ArgumentCountError.

Classes, names, reflection

Case-insensitive *_exists / is_a on runtime names, UnitEnum/BackedEnum for enum cases, get_parent_class() for runtime names and built-in classes, Generator name through mixed, TypeError for a scalar stored into an array property and for an array/object passed by runtime name to a stdlib string parameter, unset typed property read through an erased receiver throws, constant('X::C') names the missing class, invokeArgs on __construct, tentative internal return types.

Housekeeping

Drops the #407 repro (closed: not reproducible in AOT), links the #606 repro, adds the #653 repro and two new XFAIL repros found on the way (float_variadic_spread_int_stays_int, hook_set_union_float_string_garbage).

Left open (need design; root causes noted in the issues' follow-up)

#46 #47 (int/float typing), #475 #577 (scope-aware private slots), #597, #615, #589, #613.

Notes for review

Testing (macOS arm64)

  • Two consecutive self-host bin/build generations, CELLGUARD 0 violations.
  • tests/aot/run.sh -k over 25 related subsets (~2100 cases): all pass. Full suite, difftest and the Linux gate not run locally.
  • tests/aot/xfail.sh: 36 XFAIL, 0 XPASS. Parser golden 112/112, CLI golden ok, all four tools/lib*_smoke.sh ok, tools/audit/calibrate.sh SYNC ok.

Fixes #332
Fixes #490
Fixes #505
Fixes #506
Fixes #553
Fixes #554
Fixes #563
Fixes #570
Fixes #571
Fixes #572
Fixes #573
Fixes #574
Fixes #578
Fixes #579
Fixes #583
Fixes #584
Fixes #588
Fixes #593
Fixes #594
Fixes #595
Fixes #596
Fixes #603
Fixes #604
Fixes #617
Fixes #618
Fixes #619
Fixes #620
Fixes #621
Fixes #632
Fixes #646
Fixes #650

…anges start at a receiver's '('

break(1); / continue((2)); parse as php does; `$x instanceof self::$prop` (and `[...]` subscripts) names the class by a static property's value, sharing new's new_variable parser. In ranges mode a postfix or binary node on a parenthesised operand starts at the '('.

Fixes #618
Fixes #619
Fixes #505
…ed trait

php counts an abstract method of a trait the class uses (directly or via trait-uses-trait) as overridden; a concrete trait method still is not.

Fixes #617
…un-time Error

The parent-scope body is reached only by a direct call, where php throws "Access to undeclared static property C::$p"; the subclass-scope bodies keep their slots. The read of the same name said "Undefined constant C::$p"; both now share one helper with php's wording.

Fixes #620
`if (Logger::API >= 3) { trait Compat … } else { trait Compat … }` (sentry's Monolog compat traits) folds like a global constant guard.

Fixes #621
…he runtime source

The codegen calls runtime helpers (__mc_dtoa_core, …) directly, so such an app failed in clang with an undefined IR value. The option exists for the compiler, which compiles src/Runtime itself.

Fixes #506
…, and the parsed or given zone

P/O/p read 'Z' as UTC; an escaped format char must match the input. The object keeps the microseconds, takes the zone written in the string (or +00:00 for an epoch) and otherwise reads the fields as wall-clock time in $timezone or the default zone — it used to treat them as UTC and force +00:00. One helper serves DateTime and DateTimeImmutable.

Fixes #572
…functions, analyzer prelude

Analyze\Builtins (which seeds the runtime function_exists table and get_defined_functions) missed 61 dispatch names, so a runtime-name function_exists('stripos') / ('gc_enable') answered false. The emitter-inline list gains the 8 names whose literal answer leaned on a stdlib body. The analyzer now indexes the 16 intl prelude files. calibrate.sh no longer reads "runtime\\libc\\strlen" or $name === $target as dispatch names and skips the *_off.php driver stand-ins.

Fixes #646
releaseAllClassMetadata (front-end memory trim) emptied every ClassDecl's consts before the export fold and the .sig writer read them, so an app importing a library class saw "Undefined constant Acme\\Point::NAME". Exported types (Module::typeDecls, library builds only) keep their metadata. libclass_smoke.sh looked for the pre-#631 method symbol spelling.

Fixes #632
Weak-mode php turns an int landing in a ?float / float|string slot into a float; such a slot is a cell and kept the int tag. Params convert in a callee-side prologue (direct, dynamic, default, by-ref, ?float variadic), returns through the declared hint (functions, methods, closures, arrow fns, get hooks), instance and static property stores, and a float variadic pack built from int args.

Fixes #553
Fixes #554
Fixes #490
…able paths

- Spread arrays: the positional run is the int-keyed prefix (__mir_array_pos_prefix);
  a string key naming no parameter goes to the variadic under its key, or throws
  "Unknown named parameter" / "Cannot use positional argument after named argument";
  mixed-key literals count as keyed. The fixed+variadic split moves from lowering
  (positional array_slice) to the emitter, and a spread no longer refines the
  callee's params from the pack's array type.
- func_get_args() sees spread arguments: argc and overflow come from the pack at run time.
- ArgumentCountError names Class::method, not Class::::method.
- $obj() on a variadic __invoke packs its arguments.
- A variadic arm of an erased receiver packs the written arguments when lowering
  could not name the method.
- A static method reached through an object ($o->m(...), [$o, 'm'], erased receiver)
  gets no $this; ResolveMethodFcc forwards every param of a static target.
- A function-name string in a `callable` slot stays tagged, so the invoke resolves
  it by name instead of jumping to it as a closure.

Fixes #571
Fixes #573
Fixes #574
Fixes #583
Fixes #593
Fixes #595
Fixes #596
Fixes #650
…stant(), mark internal return types tentative in reflection

Fixes #603
Fixes #604
Fixes #563
…s_a, enum interfaces, Generator; type errors for array props and string args

get_parent_class answers for runtime names and built-in classes, is_a folds case,
UnitEnum/BackedEnum match enum cases, get_class names a Generator in a mixed slot,
ReflectionMethod::invoke of __construct runs on the given object, a scalar stored
into an array property and an array/object passed to a stdlib string parameter by
runtime name throw TypeError.

Fixes #332
Fixes #578
Fixes #579
Fixes #584
Fixes #588
Fixes #570
The #579 check wrapped the value in a __mir_assert_array_prop call that retained it and was listed as owned, so every store into an `array` property leaked one reference (mysqli stmt_procedural LEAK on CI). Classed as a borrow it freed the argument temp before the store retained it. The check now goes through a temp local (is_scalar / is_null -> TypeError, else the local), the shape the int->float coercion uses, and the builtin is gone.
@blacktrs
blacktrs merged commit b75c0c1 into main Nov 12, 2026
55 checks passed
@blacktrs
blacktrs deleted the fix/issue-sweep-2026-11 branch November 12, 2026 15:19
blacktrs added a commit that referenced this pull request Nov 13, 2026
blacktrs added a commit that referenced this pull request Nov 13, 2026
…rampolines (#611)

* A builtin shadows its in-program PHP twin at $mono$ calls and through name trampolines

When the stdlib twins are compiled into the program (the compiler's own build, the
semantic test binary), Monomorphize repointed `__mc_sort_native` to a `$mono$` clone,
so the emitter never asked the builtin: sort() ran the twin (always false) and its
fallback read cell words under a vec<string> claim (SIGSEGV). emitBuiltin now also
dispatches under the base name. `__mc_weak_arm`'s trampoline stored a pointer to
`__mc_weak_forget` without prelude/weak.php (link error); it is a no-op then.

Fixes #609

* Move the builtin-twin repros to a stdlib:false manifest smoke: a program that defines a stdlib symbol only links without the stdlib (GNU ld rejects the duplicate)

* Run the builtin-twins smoke in the gate

* Builtin-twins smoke: twins as a runtime library built --apps-only, past the stdlib:false guard from #655
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment