Permalink
Please sign in to comment.
Browse files
Turn -XTypeHoles into a (on by default) warning
After some discussion on ghc-devs@ and elsewhere, it seemed favorable to make this change as type holes don't let any invalid programs though, they merely change what the compiler reports in case of certain errors (namely unbound occurrences, or _ appearing on a LHS.) Now, the warning mechanism is controlled by -f[no-]warn-type-errors, just like any other regular warning. Again, on by default. The documentation and tests have been updated accordingly. Signed-off-by: Austin Seipp <austin@well-typed.com>
- Loading branch information...
Showing
with
77 additions
and 58 deletions.
- +3 −2 compiler/main/DynFlags.hs
- +2 −2 compiler/rename/RnExpr.lhs
- +8 −7 docs/users_guide/7.8.1-notes.xml
- +7 −6 docs/users_guide/flags.xml
- +6 −5 docs/users_guide/glasgow_exts.xml
- +20 −0 docs/users_guide/using.xml
- +0 −1 testsuite/tests/driver/T4437.hs
- +1 −0 testsuite/tests/module/mod71.hs
- +1 −1 testsuite/tests/module/mod71.stderr
- +1 −0 testsuite/tests/rename/should_fail/rnfail016.hs
- +3 −3 testsuite/tests/rename/should_fail/rnfail016.stderr
- +0 −2 testsuite/tests/typecheck/should_compile/holes.hs
- +11 −11 testsuite/tests/typecheck/should_compile/holes.stderr
- +0 −2 testsuite/tests/typecheck/should_compile/holes2.hs
- +3 −3 testsuite/tests/typecheck/should_compile/holes2.stderr
- +0 −2 testsuite/tests/typecheck/should_compile/holes3.hs
- +11 −11 testsuite/tests/typecheck/should_compile/holes3.stderr
| @@ -1,3 +1,4 @@ | ||
| {-# OPTIONS_GHC -fno-warn-type-holes #-} | ||
| -- !!! Illegal _ in expression | ||
| module M where | ||
| f x = x _ 1 |
| @@ -1,2 +1,2 @@ | ||
| mod71.hs:3:9: Pattern syntax in expression context: _ | ||
| mod71.hs:4:9: Pattern syntax in expression context: _ |
| @@ -1,6 +1,6 @@ | ||
| rnfail016.hs:5:7: Pattern syntax in expression context: x@x | ||
| rnfail016.hs:6:7: Pattern syntax in expression context: x@x | ||
| rnfail016.hs:6:7: Pattern syntax in expression context: ~x | ||
| rnfail016.hs:7:7: Pattern syntax in expression context: ~x | ||
| rnfail016.hs:7:7: Pattern syntax in expression context: _ | ||
| rnfail016.hs:8:7: Pattern syntax in expression context: _ |
| @@ -1,33 +1,33 @@ | ||
| holes.hs:5:5: Warning: | ||
| holes.hs:3:5: Warning: | ||
| Found hole ‛_’ with type: t | ||
| Where: ‛t’ is a rigid type variable bound by | ||
| the inferred type of f :: t at holes.hs:5:1 | ||
| Relevant bindings include f :: t (bound at holes.hs:5:1) | ||
| the inferred type of f :: t at holes.hs:3:1 | ||
| Relevant bindings include f :: t (bound at holes.hs:3:1) | ||
| In the expression: _ | ||
| In an equation for ‛f’: f = _ | ||
| holes.hs:8:7: Warning: | ||
| holes.hs:6:7: Warning: | ||
| Found hole ‛_’ with type: Char | ||
| Relevant bindings include | ||
| x :: Int (bound at holes.hs:8:3) | ||
| g :: Int -> Char (bound at holes.hs:8:1) | ||
| x :: Int (bound at holes.hs:6:3) | ||
| g :: Int -> Char (bound at holes.hs:6:1) | ||
| In the expression: _ | ||
| In an equation for ‛g’: g x = _ | ||
| holes.hs:10:5: Warning: | ||
| holes.hs:8:5: Warning: | ||
| Found hole ‛_’ with type: [Char] | ||
| Relevant bindings include h :: [Char] (bound at holes.hs:10:1) | ||
| Relevant bindings include h :: [Char] (bound at holes.hs:8:1) | ||
| In the first argument of ‛(++)’, namely ‛_’ | ||
| In the expression: _ ++ "a" | ||
| In an equation for ‛h’: h = _ ++ "a" | ||
| holes.hs:13:15: Warning: | ||
| holes.hs:11:15: Warning: | ||
| Found hole ‛_’ with type: b0 | ||
| Where: ‛b0’ is an ambiguous type variable | ||
| Relevant bindings include | ||
| y :: [a] (bound at holes.hs:13:3) | ||
| z :: [a] -> [a] (bound at holes.hs:13:1) | ||
| y :: [a] (bound at holes.hs:11:3) | ||
| z :: [a] -> [a] (bound at holes.hs:11:1) | ||
| In the second argument of ‛const’, namely ‛_’ | ||
| In the expression: const y _ | ||
| In an equation for ‛z’: z y = const y _ |
| @@ -1,5 +1,3 @@ | ||
| {-# LANGUAGE TypeHoles #-} | ||
| module Holes2 where | ||
| f = show _ |
| @@ -1,33 +1,33 @@ | ||
| holes3.hs:5:5: | ||
| holes3.hs:3:5: | ||
| Found hole ‛_’ with type: t | ||
| Where: ‛t’ is a rigid type variable bound by | ||
| the inferred type of f :: t at holes3.hs:5:1 | ||
| Relevant bindings include f :: t (bound at holes3.hs:5:1) | ||
| the inferred type of f :: t at holes3.hs:3:1 | ||
| Relevant bindings include f :: t (bound at holes3.hs:3:1) | ||
| In the expression: _ | ||
| In an equation for ‛f’: f = _ | ||
| holes3.hs:8:7: | ||
| holes3.hs:6:7: | ||
| Found hole ‛_gr’ with type: Char | ||
| Relevant bindings include | ||
| x :: Int (bound at holes3.hs:8:3) | ||
| g :: Int -> Char (bound at holes3.hs:8:1) | ||
| x :: Int (bound at holes3.hs:6:3) | ||
| g :: Int -> Char (bound at holes3.hs:6:1) | ||
| In the expression: _gr | ||
| In an equation for ‛g’: g x = _gr | ||
| holes3.hs:10:5: | ||
| holes3.hs:8:5: | ||
| Found hole ‛_aa’ with type: [Char] | ||
| Relevant bindings include h :: [Char] (bound at holes3.hs:10:1) | ||
| Relevant bindings include h :: [Char] (bound at holes3.hs:8:1) | ||
| In the first argument of ‛(++)’, namely ‛_aa’ | ||
| In the expression: _aa ++ "a" | ||
| In an equation for ‛h’: h = _aa ++ "a" | ||
| holes3.hs:13:15: | ||
| holes3.hs:11:15: | ||
| Found hole ‛_x’ with type: b0 | ||
| Where: ‛b0’ is an ambiguous type variable | ||
| Relevant bindings include | ||
| y :: [a] (bound at holes3.hs:13:3) | ||
| z :: [a] -> [a] (bound at holes3.hs:13:1) | ||
| y :: [a] (bound at holes3.hs:11:3) | ||
| z :: [a] -> [a] (bound at holes3.hs:11:1) | ||
| In the second argument of ‛const’, namely ‛_x’ | ||
| In the expression: const y _x | ||
| In an equation for ‛z’: z y = const y _x |
0 comments on commit
235fd88