endo icon indicating copy to clipboard operation
endo copied to clipboard

deeplyFulfilled erases type information

Open turadg opened this issue 3 years ago • 4 comments

https://github.com/endojs/endo/blob/master/packages/marshal/src/deeplyFulfilled.js#L36-L39

https://github.com/endojs/endo/blob/master/packages/marshal/src/types.js#L26

Because Passable is any, the type passed into deeplyFulfilled gets erased. The decision to adopt bare deeplyFulfilled in https://github.com/Agoric/agoric-sdk/pull/5891/commits/a8db35404777d1f9e385a7ce9ba1add827e4cff6 has erased type information there. Example impact: I just had a CI failure from a refactoring that the types would have alerted me to.

turadg avatar Aug 17 '22 22:08 turadg

This week I sort of got bit by this.

The type-safe alternative, deeplyFulfilledObject, didn't work out either, though:

https://github.com/Agoric/agoric-sdk/pull/6774/commits/eb26cb200f2c68d8a636380c871090fe4468f67fb3

part of:

  • https://github.com/Agoric/agoric-sdk/pull/6774

dckc avatar Jan 18 '23 19:01 dckc

Not directly relevant, but worth linking to: https://github.com/Agoric/agoric-sdk/pull/6816

erights avatar Mar 03 '23 23:03 erights

May be solved by bringing these types over from sdk, https://github.com/Agoric/agoric-sdk/blob/master/packages/internal/src/utils.js#L160-L168

turadg avatar Mar 04 '23 00:03 turadg

Would #1933 address this issue?

erights avatar Jan 20 '24 04:01 erights

Would #1933 address this issue?

No, because the return type still widens to Passable. We need the function to be generic on its parameters.

turadg avatar Jun 09 '24 15:06 turadg