Commit 2836e11
fix(ruby): emit statics only on their defining class
Static stubs were re-emitted on every subclass (allMethods/allProperties
include inherited members) with the *derived* class fqn interpolated into
call_static/get_static — baking the wrong type into the kernel call for
inherited statics.
Ruby singleton methods inherit, which matches the ES6 static-inheritance
semantics the kernel implements (its lookups walk the base chain), so the
fix is to not re-emit at all: a static is generated only where
definingType matches the emitted class. Children that override a static
still get their own stub (allMethods yields the most-derived
declaration), as pinned by the StaticHelloParent/Child fixture.
Generated-code effect on jsii-calc: JSII417Derived no longer re-emits
make_instance (now resolved via inheritance from JSII417PublicBaseOfBase,
through two erased private bases); StaticHelloChild keeps its overriding
stubs with the child fqn.
Tests: both paths covered in classes_spec (pure inheritance via
JSII417Derived, override via StaticHelloChild). Full suite: 235
examples, 0 failures; compliance report unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 720b6b3 commit 2836e11
2 files changed
Lines changed: 38 additions & 1 deletion
File tree
- packages
- @jsii/ruby-runtime-test/spec/compliance
- jsii-pacmak/lib/targets
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
222 | 247 | | |
223 | 248 | | |
224 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
639 | 649 | | |
640 | 650 | | |
641 | 651 | | |
| |||
663 | 673 | | |
664 | 674 | | |
665 | 675 | | |
666 | | - | |
| 676 | + | |
667 | 677 | | |
668 | 678 | | |
669 | 679 | | |
| |||
701 | 711 | | |
702 | 712 | | |
703 | 713 | | |
| 714 | + | |
| 715 | + | |
704 | 716 | | |
705 | 717 | | |
706 | 718 | | |
| |||
0 commit comments