Skip to content

Fix two ASSERT buglets in reifyDataCon

Ryan Scott requested to merge wip/T17305 into master

Two ASSERTs in reifyDataCon were always using arg_tys, but arg_tys is not meaningful for GADT constructors. In fact, it's worse than non-meaningful, since using arg_tys when reifying a GADT constructor can lead to failed ASSERTions, as #17305 demonstrates.

This patch applies the simplest possible fix to the immediate problem. The ASSERTs now use r_arg_tys instead of arg_tys, as the former makes sure to give something meaningful for GADT constructors. This makes the panic go away at the very least. There is still an underlying issue with the way the internals of reifyDataCon work, as described in #17305 (comment 227023), but we leave that as future work, since fixing the underlying issue is much trickier (see #17305 (comment 227087)).

Edited by Ryan Scott

Merge request reports