mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
Since #784, an array whose elements are proven present passes each element itself to its callback instead of the optional element value. A callback whose parameter is a structural supertype of the element (`refs.find((r: { pos: number }) => ...)` over a wider record) has no adapter from the plain element record, so lowering rejected it with SC2011. Before #784 the optional element ABI converted it through a union retag. The optional-read prepass now treats a site as present only when the callback's element parameter accepts the stored element through a mechanical conversion. Otherwise the site keeps the optional element visit, as before #784. Unannotated and generic parameters are unaffected, so every site #784 made precise stays precise.