julia
1b9f640c - namedtuple: Use correct return type in merge/diff (#48290)

Commit
2 years ago
namedtuple: Use correct return type in merge/diff (#48290) In a lapse of memory, I had assumed that NamedTuple was covariant like Tuple, but since this is not the case, we do actually need to pass the types into the constructor. However, the main constructor for NamedTuple has an extra `convert` call to the declared tuple type. This call is problematic for effects, because the type is unknown. For the merge/diff case, we are guaranteed that the convert is a no-op, but the compiler's analysis is not strong enough to prove this. Work around that by introducing an `_NamedTuple` constructor that bypasses the unnecessary convert to make sure that the compiler can prove sufficiently strong effects.
Author
Parents
Loading