Skip to content

Fix cross-module -shared get/set accessor resolution gap#281

Merged
ASDAlexander77 merged 1 commit into
mainfrom
fix/accessor-shared-resolution-gap
Jul 22, 2026
Merged

Fix cross-module -shared get/set accessor resolution gap#281
ASDAlexander77 merged 1 commit into
mainfrom
fix/accessor-shared-resolution-gap

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

  • Class declaration printing never emitted real get/set accessor syntax across a module boundary - only the underlying mangled get_x/set_x funcOps as ordinary methods - so property-style access (obj.x, super.x) on a dynamically-imported class never populated the reconstructed class's accessor list ("Class member 'x' can't be found").
  • Fixing that alone resolved the JIT-shared tier but exposed a second, independent bug: ClassAccessorAccess always emitted a compile-time constant symbol reference for the get/set call, which needs real static/dllimport linkage - but a plain -shared importer never links against the exporter's .lib (cross-module symbols resolve entirely at runtime). ClassMethodAccess already had a 3-tier runtime-resolution fallback for this; ClassAccessorAccess never got the equivalent, so it failed at link time (lld: undefined symbol: __declspec(dllimport) ...).
  • Both -shared/-jit-shared accessor tests (previously disabled) are re-enabled and pass.

Test plan

  • ctest -C Debug -R class-accessor - 9/9 pass (including both re-enabled -shared tiers)
  • Full suite ctest -C Debug -j8 - 791/791 pass, no regressions

@ASDAlexander77
ASDAlexander77 merged commit 1293e93 into main Jul 22, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix/accessor-shared-resolution-gap branch July 22, 2026 20:58
ASDAlexander77 added a commit that referenced this pull request Jul 22, 2026
super-index-access-gap-fix.md predicted that adding cross-module
coverage for class indexers would reproduce the exact 2-bug shape
PR #281 fixed for accessors. It did:

1. DeclarationPrinter never re-emitted a class's index signature
   ([x: T]: U;) when reprinting a -shared @dllimport declaration,
   so a reimporting module's ClassInfo::indexes stayed empty and
   `obj[i]`/`super[i]` failed with "Class member '.index' can't be
   found".

2. ClassIndexAccess had no isDynamicImport fallback (unlike
   ClassMethodAccess/ClassAccessorAccess), so AOT -shared linking
   tried to statically resolve the indexer's get/set symbols
   against an import library that -shared mode never links,
   failing with "undefined symbol ... dllimport". Routed through
   the already-existing (but previously unused)
   ThisIndirectIndexAccessorOp instead, mirroring
   ClassAccessorAccess's resolveAccessorFunc pattern.

New export_class_indexer.ts/import_class_indexer.ts cross-module
test pair (compile, -shared compile, -jit -shared tiers). 796/796
green.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant