Exemple
Prove that duplicate `method_added` hooks no longer cause repeated allocation for `checked(:never)` methods
sha256:59506b796799b67a91a6633533cfe8ddb3f956dc0a280b2ec1b65d6e51c6ad11
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- Prove that duplicate `method_added` hooks no longer cause repeated allocation for `checked(:never)` methods HOW
- Paquets
- sorbet-runtime 0.6.13426
- Environnement
- ruby
- Créé
- 2026-08-16T17:14:48Z
Ce que l'on suppose souvent
A `checked(:never)` method in a class with duplicate `method_added` hooks still incurs wrapper allocations on every call.
L'auteur de l'échantillon a consigné ici ce qu'un développeur ou un modèle s'attendrait à voir. Le contrat ci-dessous est ce qui s'est réellement exécuté.
Contrat
- A method annotated with `sig { returns(Integer).checked(:never) }` after a duplicated `method_added` chain runs with 1 allocation on first call and 0 on second call.
- The second invocation must stay allocation-free after first successful call, proving the wrapper is not dropped by a second `_on_method_added` event.
Fichiers
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Télécharger l'artefact vérifié (tar.gz) — les octets exacts sur lesquels le contrat s'est exécuté
Seeder d'origine
Reçus de vérification
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9