Ignore forall visibility in eqType (#22762)
Prior to this change, the equality relation on types took ForAllTyFlag into account, making a distinction between: 1. forall a. blah 2. forall a -> blah Not anymore. This distinction is important in surface Haskell, but it has no meaning in Core where type abstraction and type application are always explicit. At the same time, if we are not careful to track this flag, Core Lint will fail, as reported in #22762: *** Core Lint errors : in result of TcGblEnv axioms *** From-kind of Cast differs from kind of enclosed type From-kind: forall (b :: Bool) -> * Kind of enclosed type: forall {b :: Bool}. * The solution is to compare types for equality modulo visibility (ForAllTyFlag). Updated functions: nonDetCmpType (worker for eqType) eqDeBruijnType tc_eq_type (worker for tcEqType) can_eq_nc In order to retain the distinction between visible and invisible forall in user-written code, we introduce new ad-hoc checks: checkEqForallVis (in checking mode) cteForallKindVisDiff (in inference mode)
parent
7612dc71
Pipeline #62772 passed
Stage: tool-lint
Stage: quick-build
Stage: full-build
Stage: packaging
Stage: testing
Showing
- compiler/GHC/Core/Map/Type.hs 3 additions, 6 deletionscompiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/TyCo/Compare.hs 48 additions, 40 deletionscompiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Tc/Errors.hs 10 additions, 0 deletionscompiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs 14 additions, 0 deletionscompiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs 30 additions, 0 deletionscompiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs 4 additions, 2 deletionscompiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/HsType.hs 3 additions, 0 deletionscompiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Solver/Canonical.hs 3 additions, 3 deletionscompiler/GHC/Tc/Solver/Canonical.hs
- compiler/GHC/Tc/Types/Constraint.hs 5 additions, 2 deletionscompiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Utils/TcMType.hs 106 additions, 0 deletionscompiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs 8 additions, 1 deletioncompiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Types/Error/Codes.hs 2 additions, 0 deletionscompiler/GHC/Types/Error/Codes.hs
- testsuite/tests/saks/should_fail/T18863a.stderr 4 additions, 3 deletionstestsuite/tests/saks/should_fail/T18863a.stderr
- testsuite/tests/typecheck/should_compile/T22762.hs 20 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T22762.hs
- testsuite/tests/typecheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/VisFlag1.hs 18 additions, 0 deletionstestsuite/tests/typecheck/should_fail/VisFlag1.hs
- testsuite/tests/typecheck/should_fail/VisFlag1.stderr 26 additions, 0 deletionstestsuite/tests/typecheck/should_fail/VisFlag1.stderr
- testsuite/tests/typecheck/should_fail/VisFlag1_ql.hs 20 additions, 0 deletionstestsuite/tests/typecheck/should_fail/VisFlag1_ql.hs
- testsuite/tests/typecheck/should_fail/VisFlag1_ql.stderr 23 additions, 0 deletionstestsuite/tests/typecheck/should_fail/VisFlag1_ql.stderr
- testsuite/tests/typecheck/should_fail/VisFlag2.hs 14 additions, 0 deletionstestsuite/tests/typecheck/should_fail/VisFlag2.hs
Loading
Please register or sign in to comment