[commit: ghc] master: New handling of overlapping inst in Safe Haskell (4fffbc3)
git at git.haskell.org
git at git.haskell.org
Tue May 12 01:20:40 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/4fffbc34c024231c3c9fac7a2134896cc09c7fb7/ghc
>---------------------------------------------------------------
commit 4fffbc34c024231c3c9fac7a2134896cc09c7fb7
Author: David Terei <code at davidterei.com>
Date: Mon May 11 16:05:37 2015 -0700
New handling of overlapping inst in Safe Haskell
We do much better now due to the newish per-instance flags. Rather than
mark any module that uses `-XOverlappingInstances`,
`-XIncoherentInstances` or the new `OVERLAP*` pragmas as unsafe, we
regard them all as safe and defer the check until an overlap occurs.
An type-class method call that involves overlapping instances is
considered _unsafe_ when:
1) The most specific instance, Ix, is from a module marked `-XSafe`
2) Ix is an orphan instance or a MPTC
3) At least one instance that Ix overlaps, Iy, is:
a) from a different module than Ix
AND
b) Iy is not marked `OVERLAPPABLE`
This check is only enforced in modules compiled with `-XSafe` or
`-XTrustworthy`.
This fixes Safe Haskell to work with the latest overlapping instance
pragmas, and also brings consistent behavior. Previously, Safe Inferred
modules behaved differently than `-XSafe` modules.
>---------------------------------------------------------------
4fffbc34c024231c3c9fac7a2134896cc09c7fb7
compiler/main/DynFlags.hs | 13 +-
compiler/main/HscMain.hs | 14 +-
compiler/typecheck/Inst.hs | 2 +-
compiler/typecheck/TcErrors.hs | 61 ++++---
compiler/typecheck/TcForeign.hs | 2 +-
compiler/typecheck/TcInstDcls.hs | 10 +-
compiler/typecheck/TcInteract.hs | 75 +++++---
compiler/typecheck/TcRnMonad.hs | 11 +-
compiler/typecheck/TcRnTypes.hs | 34 ++--
compiler/typecheck/TcSMonad.hs | 57 +++++-
compiler/typecheck/TcSimplify.hs | 198 +++++++++++++++++----
compiler/typecheck/TcSplice.hs | 2 +-
compiler/types/InstEnv.hs | 56 +++---
testsuite/tests/safeHaskell/ghci/P13_A.hs | 2 +-
testsuite/tests/safeHaskell/ghci/p13.stderr | 7 +-
.../overlapping}/Makefile | 0
.../tests/safeHaskell/overlapping/SH_Overlap1.hs | 16 ++
.../safeHaskell/overlapping/SH_Overlap1.stderr | 15 ++
.../tests/safeHaskell/overlapping/SH_Overlap10.hs | 17 ++
.../safeHaskell/overlapping/SH_Overlap10.stderr | 3 +
.../safeHaskell/overlapping/SH_Overlap10_A.hs | 13 ++
.../safeHaskell/overlapping/SH_Overlap10_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap11.hs | 18 ++
.../safeHaskell/overlapping/SH_Overlap11.stderr | 18 ++
.../safeHaskell/overlapping/SH_Overlap11_A.hs | 13 ++
.../safeHaskell/overlapping/SH_Overlap11_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap1_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap1_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap2.hs | 19 ++
.../safeHaskell/overlapping/SH_Overlap2.stderr | 15 ++
.../tests/safeHaskell/overlapping/SH_Overlap2_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap2_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap3.hs | 16 ++
.../safeHaskell/overlapping/SH_Overlap3.stderr | 3 +
.../tests/safeHaskell/overlapping/SH_Overlap3_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap3_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap4.hs | 23 +++
.../safeHaskell/overlapping/SH_Overlap4.stderr | 3 +
.../tests/safeHaskell/overlapping/SH_Overlap4_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap4_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap5.hs | 16 ++
.../safeHaskell/overlapping/SH_Overlap5.stderr | 15 ++
.../tests/safeHaskell/overlapping/SH_Overlap5_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap5_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap6.hs | 15 ++
.../safeHaskell/overlapping/SH_Overlap6.stderr | 15 ++
.../tests/safeHaskell/overlapping/SH_Overlap6_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap6_B.hs | 8 +
.../tests/safeHaskell/overlapping/SH_Overlap7.hs | 15 ++
.../safeHaskell/overlapping/SH_Overlap7.stderr | 21 +++
.../tests/safeHaskell/overlapping/SH_Overlap7_A.hs | 14 ++
.../tests/safeHaskell/overlapping/SH_Overlap7_B.hs | 9 +
.../tests/safeHaskell/overlapping/SH_Overlap8.hs | 18 ++
.../safeHaskell/overlapping/SH_Overlap8.stderr | 2 +
.../tests/safeHaskell/overlapping/SH_Overlap8_A.hs | 14 ++
.../tests/safeHaskell/overlapping/SH_Overlap9.hs | 16 ++
.../safeHaskell/overlapping/SH_Overlap9.stderr | 3 +
.../tests/safeHaskell/overlapping/SH_Overlap9_A.hs | 13 ++
.../tests/safeHaskell/overlapping/SH_Overlap9_B.hs | 8 +
testsuite/tests/safeHaskell/overlapping/all.T | 62 +++++++
.../tests/safeHaskell/safeInfered/SafeInfered05.hs | 20 +--
.../safeHaskell/safeInfered/SafeInfered05.stderr | 15 +-
.../safeHaskell/safeInfered/UnsafeInfered08.stderr | 4 -
.../safeHaskell/safeInfered/UnsafeInfered08_A.hs | 4 +-
.../safeHaskell/safeInfered/UnsafeInfered13.stderr | 9 -
.../safeHaskell/safeInfered/UnsafeInfered14.stderr | 9 -
.../safeHaskell/safeInfered/UnsafeInfered15.stderr | 9 -
.../safeHaskell/safeInfered/UnsafeInfered16.stderr | 13 --
.../safeHaskell/safeInfered/UnsafeInfered17.stderr | 9 -
.../safeHaskell/safeInfered/UnsafeInfered18.stderr | 10 +-
.../safeHaskell/safeInfered/UnsafeInfered19.stderr | 11 --
testsuite/tests/safeHaskell/safeInfered/all.T | 24 +--
72 files changed, 992 insertions(+), 279 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4fffbc34c024231c3c9fac7a2134896cc09c7fb7
More information about the ghc-commits
mailing list