[GHC] #3440: Improve error message for GADT failures
GHC
cvs-ghc at haskell.org
Mon Nov 1 13:12:51 EDT 2010
#3440: Improve error message for GADT failures
----------------------------------------+-----------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: merge
Priority: low | Milestone: 7.0.1
Component: Compiler (Type checker) | Version: 6.10.4
Keywords: | Testcase: indexed-types/should_fail/T3440
Blockedby: | Difficulty: Unknown
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
----------------------------------------+-----------------------------------
Changes (by simonpj):
* status: new => merge
* testcase: => indexed-types/should_fail/T3440
Comment:
On reflection, the error message could be better thus
{{{
T3440.hs:11:22:
Could not deduce (a1 ~ a) from the context (Fam a ~ Fam a1)
`a1' is a rigid type variable bound by
a pattern with constructor
GADT :: forall a. a -> Fam a -> GADT (Fam a)
at T3440.hs:11:9
`a' is a rigid type variable bound by
the type signature for `unwrap' at T3440.hs:10:21
}}}
Patch
{{{
Mon Nov 1 16:46:30 GMT 2010 simonpj at microsoft.com
* Improve error messages
In particular, instead of
Cannot match 'a' with 'b'
we get
Could not deduce (a~b) from context (F a ~ b)
or whatever
M ./compiler/typecheck/TcErrors.lhs -19 +27
}}}
And testsuite
{{{
Mon Nov 1 16:51:07 GMT 2010 simonpj at microsoft.com
* Follow change in typechecker error messages
M ./tests/ghc-regress/indexed-types/should_fail/T4093a.stderr -7 +7
M ./tests/ghc-regress/indexed-types/should_fail/T4093b.stderr -1 +3
M ./tests/ghc-regress/indexed-types/should_fail/T4254.stderr -7 +7
M ./tests/ghc-regress/typecheck/should_compile/FD1.stderr -1 +2
M ./tests/ghc-regress/typecheck/should_compile/FD2.stderr -1 +2
M ./tests/ghc-regress/typecheck/should_compile/T2494.stderr -1 +1
M ./tests/ghc-regress/typecheck/should_fail/T2688.stderr -1 +1
M ./tests/ghc-regress/typecheck/should_fail/tcfail068.stderr -29 +29
M ./tests/ghc-regress/typecheck/should_fail/tcfail131.stderr -1 +1
}}}
I'm easy about whether this merges into the branch or not.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3440#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list