You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix cross-module interface indexer printer gap and add coverage
cross-module-class-indexer-shared-gap-fix.md flagged interfaces as
likely sharing the same latent DeclarationPrinter gap as classes did
for index signatures, untested because no cross-module
interface-indexer test existed. It did:
DeclarationPrinter::print(InterfaceInfo::TypePtr) never re-emitted an
interface's index signature ([x: T]: U;) for -shared reimport, so a
reimporting module's InterfaceInfo::indexes stayed empty and casting
to the interface then indexing it failed with "indexer is not
declared" / "Interface member '.index' can't be found".
Printing it uncovered a second, narrower bug: an interface's index
signature FunctionType carries a leading opaque `this` input (added
via getInterfaceMethodNameAndType's funcGenContext.thisType, unlike a
class's plain (arg)->result index signature), so naively reusing
input(0) as the index-argument type printed the wrong type and
crashed an unrelated assert in getIndexSignatureArgumentAndResultTypes
on reimport. Fixed by picking input(1) when the signature has more
than one input, matching that helper's own "first parameter is
Opaque" branch.
Unlike the class case (PR #283), no isDynamicImport fallback was
needed here - interface method dispatch (including the indexer's
synthesized get/set) already goes through vtable slots rather than
statically-linked symbols, so AOT -shared linking was never an issue
once the printer emitted the signature.
New export_interface_indexer.ts/import_interface_indexer.ts
cross-module test pair (compile, -shared compile, -jit -shared
tiers). 799/799 green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments