WIP: Redesign the type of magicDict
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 asTypeable @k a
. This means thatwithTypeable
can now be implemented in terms ofmagicDict
. - 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 ofTick
s. 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.