Skip to content

v0.2.0

Choose a tag to compare

@math3usmartins math3usmartins released this 12 Jun 10:48
· 25 commits to main since this release

v0.2.0

Full editor support for xphp v0.2.0 generics — the turbofish call syntax, composite bounds, and variance — plus a cross-editor "Show references" fix and sharper generic type inference.

Requires xphp ^v0.2.0. This release targets the generics-capable compiler; serverInfo now reports 0.2.0.

Highlights

Generics: the turbofish call syntax (Foo::<int>)

The server now recognizes xphp's turbofish call-site syntax everywhere — new Collection::<User>(), Util::identity::<int>(...), and $obj->method::<int>(...). Highlighting, completion, hover, signature help, go-to-definition, and diagnostics all understand it.

  • Instance-method turbofish resolves to concrete types — $x = $u->identity::<int>(99) now infers int (hover + inlay hint) instead of the bare type parameter T, even on a non-generic receiver.
  • Relative return types resolve to the receiver — a method declared : static / : self (e.g. a fluent fresh(): static) on a Builder<int> receiver now shows Builder<int>, not the literal static.
  • Omitted default type arguments are tolerated — no more spurious errors when defaults are left off.
  • Generic closures and arrow functions are highlighted.

Type-parameter bounds

  • Composite bounds (T: A & B) are understood end-to-end.
  • Bound-violation quick-fixes are composite-aware — the fix-it offers the right type(s) to satisfy a multi-bound parameter.

Hover

  • Variance is shown — hovering a +T / -T parameter explains its covariance / contravariance.
  • Generic instantiations and method calls render their specialized types.

"Show references" CodeLens

The lens command was reworked to a neutral, namespaced xphp.showReferences that different clients can handle correctly. e.g. PhpStorm opens its native usage popup, VS Code opens the references peek with no server round-trip. (Requires the matching VS Code extension / PhpStorm plugin update — older clients won't pick up the new command id.)

Fixes

  • Turbofish highlighting, type-argument arity checks, and bound fix-its corrected.
  • Semantic tokens no longer mistake a bareword comparison for a generic declaration.
  • serverInfo.version correctly reports 0.2.0.

Performance

  • PositionMap is memoized per (uri, version), avoiding repeated rebuilds on hot paths (hover, definition, diagnostics).

Under the hood

  • Bounds are now read through a BoundExpr view (cleaner composite-bound handling).
  • Expanded generics test coverage (self/static/parent turbofish, instance/variable argument checks, over-supplied turbofish) with mutation-test hardening; a filesystem-order-dependent diagnostics test was made deterministic for reliable CI.