TmOracle: Replace negative term equalities by refutable PmAltCons
The `PmExprEq` business was a huge hack and was at the same time vastly too powerful and not powerful enough to encode negative term equalities, i.e. facts of the form "forall y. x ≁ Just y". This patch introduces the concept of 'refutable shapes': What matters for the pattern match checker is being able to encode knowledge of the kind "x can no longer be the literal 5". We encode this knowledge in a `PmRefutEnv`, mapping a set of newly introduced `PmAltCon`s (which are just `PmLit`s at the moment) to each variable denoting above inequalities. So, say we have `x ≁ 42 ∈ refuts` in the term oracle context and try to solve an equality like `x ~ 42`. The entry in the refutable environment will immediately lead to a contradiction. This machinery renders the whole `PmExprEq` and `ComplexEq` business unnecessary, getting rid of a lot of (mostly dead) code. See the Note [Refutable shapes] in TmOracle for a place to start. Metric Decrease: T11195
Showing
- compiler/basicTypes/NameEnv.hs 4 additions, 0 deletionscompiler/basicTypes/NameEnv.hs
- compiler/deSugar/Check.hs 33 additions, 117 deletionscompiler/deSugar/Check.hs
- compiler/deSugar/DsMonad.hs 2 additions, 2 deletionscompiler/deSugar/DsMonad.hs
- compiler/deSugar/PmExpr.hs 51 additions, 237 deletionscompiler/deSugar/PmExpr.hs
- compiler/deSugar/PmPpr.hs 191 additions, 0 deletionscompiler/deSugar/PmPpr.hs
- compiler/deSugar/TmOracle.hs 283 additions, 186 deletionscompiler/deSugar/TmOracle.hs
- compiler/ghc.cabal.in 1 addition, 0 deletionscompiler/ghc.cabal.in
- compiler/typecheck/TcEvidence.hs 17 additions, 1 deletioncompiler/typecheck/TcEvidence.hs
- compiler/typecheck/TcRnTypes.hs 2 additions, 2 deletionscompiler/typecheck/TcRnTypes.hs
- compiler/utils/ListSetOps.hs 8 additions, 1 deletioncompiler/utils/ListSetOps.hs
- testsuite/tests/pmcheck/should_compile/CyclicSubst.hs 15 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/CyclicSubst.hs
- testsuite/tests/pmcheck/should_compile/PmExprVars.hs 44 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/PmExprVars.hs
- testsuite/tests/pmcheck/should_compile/T12949.hs 16 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/T12949.hs
- testsuite/tests/pmcheck/should_compile/all.T 5 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/all.T
- testsuite/tests/typecheck/should_compile/T5490.stderr 0 additions, 4 deletionstestsuite/tests/typecheck/should_compile/T5490.stderr
Loading
Please register or sign in to comment