Skip to content

WIP: Detect unbounded recursion in normaliseType

Richard Eisenberg requested to merge rae/ghc:t17306 into master

Commit message:

Detect unbounded recursion in normaliseType

normaliseType is a function that tries to normalise all
type families in a type. It previously had no check for
unbounded recursion and would loop. This caused trouble in
:kind! (and likely, in other places). Fixed now, using RecTcChecker.

Fixes #17306

Test case: ghci/scripts/T17306

Note that this uses RecTcChecker, not -freduction-depth. The error will trigger whenever the same tycon is expanded 100 times or more. This is not configurable.

It uses RecTcChecker for impedance matching with topNormaliseType. That function has unconfigurably stopped at 100 unwrappings for some time, and no one has complained.

Edited by Ben Gamari

Merge request reports