diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-01-10 16:55:51 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-01-15 16:09:27 -0500 |
commit | 9dc56b61ae10cb26ec8b2bc132ae6c9b620707a8 (patch) | |
tree | 51690d72af413c0deb9cf17f3a4e10e44db1411c /testsuite/tests/typecheck/should_fail/T16059a.stderr | |
parent | e63518f5d6a93be111f9108c0990a1162f88d615 (diff) | |
download | haskell-9dc56b61ae10cb26ec8b2bc132ae6c9b620707a8.tar.gz |
Control validity-checking of type synonym applications more carefully
Trac #16059 shows that when validity checking applications of type
synonyms, GHC sometimes wasn't checking the expanded type enough.
We must be careful, however, since checking both the expanded type as
well as the arguments to the type synonym can lead to exponential
blowup (see https://ghc.haskell.org/trac/ghc/ticket/16059#comment:4).
Nor can we omit checking either the expanded type or the argument for
correctness reasons.
The solution here is to introduce a new `ExpandMode` data type that
is plumbed through all of the type-validity-checking functions in
`TcValidity`. `ExpandMode` dictates whether we only check the
expanded type (`Expand`), only check the arguments (`NoExpand), or
both (`Both`). Importantly, if we check `Both` in the function for
validity checking type synonym applications, then we switch to
`NoExpand` when checking the arguments so as to avoid exponential
blowup. See `Note [Correctness and performance of type synonym validity
checking]` for the full story.
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T16059a.stderr')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T16059a.stderr | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T16059a.stderr b/testsuite/tests/typecheck/should_fail/T16059a.stderr new file mode 100644 index 0000000000..2768220653 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T16059a.stderr @@ -0,0 +1,9 @@ + +T16059a.hs:8:6: error: + • Illegal constraint in a kind: Eq b => b + • In the type signature: f :: forall b (a :: Eq b => b). Int + +T16059a.hs:11:6: error: + • Illegal constraint in a kind: Eq b => b + • In the expansion of type synonym ‘Foo’ + In the type signature: g :: forall b (a :: Foo b). Int |