Test TcCoercibleFail hangs with substitution sanity checks enabled
When working on https://phabricator.haskell.org/D1862 I've run into an issue where
TcCoercibleFail test would hang and eventually timeout.
To move forward I've disabled the check for
Type, by changing
make TEST=TcCoercibleFail, the test will hang
What I've established so far:
The calls to
substTy become slower and slower with stack traces like this:
CallStack (from ImplicitParams): pprSTrace, called at compiler/types/TyCoRep.hs:1903:35 in ghc:TyCoRep checkValidSubst, called at compiler/types/TyCoRep.hs:1943:17 in ghc:TyCoRep substTy, called at compiler/types/TyCoRep.hs:1796:23 in ghc:TyCoRep substTyWith, called at compiler/types/Type.hs:1429:15 in ghc:Type applyTysX, called at compiler/types/Coercion.hs:1261:11 in ghc:Coercion instNewTyCon_maybe, called at compiler/types/Coercion.hs:1308:23 in ghc:Coercion unwrapNewTypeStepper, called at compiler/typecheck/FamInst.hs:278:9 in ghc:FamInst unwrap_newtype, called at compiler/typecheck/FamInst.hs:265:15 in ghc:FamInst ()
substTy is called with exponentially growing substitution types of the form
(((),()),((),()))... : https://phabricator.haskell.org/P88 (warning: big file).
If you look at the test file it's easy to see how such types could arise.
|Component||Compiler (Type checker)|