mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-11 02:03:59 +08:00
A method whose name an untyped write can replace is called through the instance's property lookup: a ternary between the dynamic call of an installed replacement and the native call, both boxed into a dynamic value and converted back to the method's result type. A result with no dynamic form, such as an Iterable<T> (its generator arm does not box), stayed unboxed in the dynamic ternary, which failed IR validation with "ternary else-branch: expected dyn, got union". Methods of generic class instantiations always take this path once any write can replace their name, because their prototype data is not modeled, so importing zod (whose JavaScript has unknown-key writes) broke every such call. Such a result now keeps its native type: the native call's value is used as it is, and only a replacement's dynamic result takes the checked conversion into the result type. Results that box are lowered as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>