Skip to content

Fix merge of disjoint interfaces.#22

Merged
peterhuene merged 2 commits intomainfrom
fix-merge
Nov 30, 2023
Merged

Fix merge of disjoint interfaces.#22
peterhuene merged 2 commits intomainfrom
fix-merge

Conversation

@peterhuene
Copy link
Copy Markdown
Member

Currently, a bug exists in merging of interfaces such that if one interface exports a function that references an exported (i.e. "named") type and another interface exports a different function that references the same exported type, the merged interface would have references to function types with types that are not present in the "encoded type index" map.

This results in the encoder re-encoding the same type and using that newly encoded type index instead of the correct type index to the named type.

Ultimately this resulted in a validation error of the encoded output where the interface wasn't valid for import because of the function not using what should be a named value type.

The fix is for the merged interface to maintain a mapping between the new type and the old types so that the "encoded type index" map is updated accordingly.

Currently, a bug exists in merging of interfaces such that if one interface
exports a function that references an exported (i.e. "named") type and another
interface exports a different function that references the same exported type,
the merged interface would have references to function types with types that
are not present in the "encoded type index" map.

This results in the encoder re-encoding the same type and using that newly
encoded type index instead of the correct type index to the named type.

Ultimately this resulted in a validation error of the encoded output where the
interface wasn't valid for import because of the function not using what should
be a named value type.

The fix is for the merged interface to maintain a mapping between the new type
and the old types so that the "encoded type index" map is updated accordingly.
JSON only supports string keys in maps and the remapped types isn't needed in
the `resolve` command output.
@peterhuene peterhuene merged commit e02dc7f into main Nov 30, 2023
@peterhuene peterhuene deleted the fix-merge branch November 30, 2023 01:59
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.

2 participants