Repository navigation
v0.2.0
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;serverInfonow reports0.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 infersint(hover + inlay hint) instead of the bare type parameterT, even on a non-generic receiver. - Relative return types resolve to the receiver — a method declared
: static/: self(e.g. a fluentfresh(): static) on aBuilder<int>receiver now showsBuilder<int>, not the literalstatic. - 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/-Tparameter 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.versioncorrectly reports0.2.0.
Performance
PositionMapis memoized per(uri, version), avoiding repeated rebuilds on hot paths (hover, definition, diagnostics).
Under the hood
- Bounds are now read through a
BoundExprview (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.