Bug in anyRewritableTyVar
The current implementation of TcType.anyRewritableTyVar has one wrong case:
go_tc ReprEq bvs tc tys = foldr ((&&) . go_arg bvs) False $
(tyConRolesRepresentational tc `zip` tys)
Here foldr uses && in the function and a False as the initial value, which causes this case to always return False no matter what the inputs are.
This bug is introduced in [changeset:"3acd6164/ghc" 3acd6164/ghc], which is for fixing #14363 (closed).
The correct implementation (I think) should use || instead of &&:
go_tc ReprEq bvs tc tys = foldr ((||) . go_arg bvs) False $
(tyConRolesRepresentational tc `zip` tys)
-- or just
go_tc ReprEq bvs tc tys = any (go_arg bvs) (tyConRolesRepresentational tc `zip` tys)
We presume that there might be some program which loops because of this bug.
Patch incoming.
Trac metadata
| Trac field | Value |
|---|---|
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire |
| Operating system | |
| Architecture |