Skip to content

Refine kind inference of newtype data instance in gadt syntax

Fix #25647

This patch fix up the kind inference for newtype gadt instance that is not accomplished in !13767 (merged)

For GADT cases, if it is newtype without user specified header kind signiture, use the tc_res_kind in kcConDecl instead of generating a new newOpenTypeKind.

In this case, header kind result can unify with the constructors's result kind, without leaving header kind overly generalized and pushing unexpected kind equalities into the data constructor and being rejected by the dataCon valid checker.

Check why it is needed in #25647 (comment 605476)

Todo:

  1. add some tests
  2. modify related notes
Edited by Patrick

Merge request reports

Loading