Check for duplicate variables in associated default equations
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 6 May 2019 18:49:44 +0000 (14:49 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Tue, 7 May 2019 21:03:04 +0000 (17:03 -0400)
commit78a5c4ce6bae233b655097ada3901028104f0f27
treed215ec3ed9004b6e967a4ee0a4c917341919c6ac
parent961979617a3b6717f5d175c08884a9b970602d6e
Check for duplicate variables in associated default equations

A follow-up to !696's, which attempted to clean up the error messages
for ill formed associated type family default equations. The previous
attempt, !696, forgot to account for the possibility of duplicate
kind variable arguments, as in the following example:

```hs
class C (a :: j) where
  type T (a :: j) (b :: k)
  type T (a :: k) (b :: k) = k
```

This patch addresses this shortcoming by adding an additional check
for this. Fixes #13971 (hopefully for good this time).
compiler/typecheck/TcTyClsDecls.hs
testsuite/tests/indexed-types/should_compile/T11361a.stderr
testsuite/tests/indexed-types/should_fail/T13971.stderr
testsuite/tests/indexed-types/should_fail/T13971b.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T13971b.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T