Skip to content

WIP: Redesign the type of magicDict

Ryan Scott requested to merge wip/T16646-take-two into master

This gives a more precise type signature to magicDict as proposed in #16646 (closed). In addition to making it more type safe:

  • This allows the magicDict constant-folding rule to apply to classes with multiple type arguments, such as Typeable @k a. This means that withTypeable can now be implemented in terms of magicDict.
  • Moreover, since the constant-folding rule no longer needs to case on the structure of the expression passed as an argument to magicDict, it no longer cares about the presence or absence of Ticks. In effect, this obsoletes the fix for #19667 (closed).

The new T16646 test case demonstrates the new version of magicDict in action, both in terms of base functions defined in terms of magicDict as well as in terms of functions from the reflection and singletons libraries.

This fixes #16646 (closed). By adding more tests for magicDict, this also fixes #19673 (closed) as a side effect.

Merge request reports