diff options
author | David Kraeutmann <kane@kane.cx> | 2015-10-07 20:28:46 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-10-07 20:30:20 -0500 |
commit | 7b443bb1df8f7f0a6b3124537590aa655a9300cd (patch) | |
tree | 9a15aeb8de755743b236f83129ad63fa4ec93304 /testsuite/tests/overloadedlists | |
parent | ea4df12f7f3fc4d1d2af335804b8ec893f45550c (diff) | |
download | haskell-7b443bb1df8f7f0a6b3124537590aa655a9300cd.tar.gz |
Improve error messages for ambiguous type variables
Improved error messages are only printed when the old message would be
"No instance for...", since they're not as helpful for "Could not deduce..."
No special test case as error messages are tested by other tests already.
Signed-off-by: David Kraeutmann <kane@kane.cx>
Reviewed By: austin, goldfire
Differential Revision: https://phabricator.haskell.org/D1182
GHC Trac Issues: #10733
Diffstat (limited to 'testsuite/tests/overloadedlists')
-rw-r--r-- | testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr index 75abc3b0e6..7faa9207a4 100644 --- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr +++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr @@ -1,8 +1,9 @@ overloadedlistsfail01.hs:5:8: error: - No instance for (Show a0) arising from a use of ‘print’ - The type variable ‘a0’ is ambiguous - Potential instances: + Ambiguous type variable ‘a0’ arising from a use of ‘print’ + prevents the constraint ‘(Show a0)’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: instance [safe] Show Version -- Defined in ‘Data.Version’ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show Integer -- Defined in ‘GHC.Show’ @@ -12,9 +13,10 @@ overloadedlistsfail01.hs:5:8: error: In an equation for ‘main’: main = print [1] overloadedlistsfail01.hs:5:14: error: - No instance for (IsList a0) arising from an overloaded list - The type variable ‘a0’ is ambiguous - Potential instances: + Ambiguous type variable ‘a0’ arising from an overloaded list + prevents the constraint ‘(IsList a0)’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: instance IsList Version -- Defined in ‘GHC.Exts’ instance IsList [a] -- Defined in ‘GHC.Exts’ In the first argument of ‘print’, namely ‘[1]’ @@ -22,9 +24,10 @@ overloadedlistsfail01.hs:5:14: error: In an equation for ‘main’: main = print [1] overloadedlistsfail01.hs:5:15: error: - No instance for (Num (Item a0)) arising from the literal ‘1’ - The type variable ‘a0’ is ambiguous - Potential instances: + Ambiguous type variable ‘a0’ arising from the literal ‘1’ + prevents the constraint ‘(Num (Item a0))’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: instance Num Integer -- Defined in ‘GHC.Num’ instance Num Double -- Defined in ‘GHC.Float’ instance Num Float -- Defined in ‘GHC.Float’ |