julia
17515cf5 - Compiler: union-split methods with unmatched type parameters when trimming

Commit
46 days ago
Compiler: union-split methods with unmatched type parameters when trimming When a call site has several matching methods and one of them does not fully cover the call, inlining required that method's static parameters to be determined by the argument types. For abstract argument types this is rarely the case (e.g. `g(::PolyX{G}, ::PolyX{G}) where G` called with `(::Ctx, ::Ctx)`), so the whole call fell back to dynamic dispatch, even when every method is known and a fully-covering fallback exists. Under `--trim` that dynamic call is a verification error, while the equivalent `g(::PolyX{<:Grid}, ::PolyX{<:Grid})` spelling worked. Add a `split_unmatched_sparams` optimization parameter, enabled for trimmed compilation, that handles such matches by relaxing the match signature to per-argument types (each closed over the type variables it uses) for the usual `isa` guards. If a type variable relates several arguments, the relaxation is looser than the signature, so the case additionally checks the tuple of arguments against the original signature. The inlined body recovers its static parameters at runtime via `_compute_sparams`, as is already done for a single fully-covering match. Ordinary compilation keeps its existing behavior. Assisted-by: Claude Code (Claude Opus 5.5)
Author
Committer
Parents
Loading