summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/parser/RdrHsSyn.hs4
-rw-r--r--testsuite/tests/indexed-types/should_compile/T16632.hs5
-rw-r--r--testsuite/tests/indexed-types/should_compile/T16632.stderr6
-rw-r--r--testsuite/tests/indexed-types/should_compile/all.T1
4 files changed, 14 insertions, 2 deletions
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index 7c457f83d1..156931dc9f 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -955,8 +955,8 @@ checkTyClHdr is_cls ty
; let name = mkOccName tcClsName (starSym isUni)
; return (cL l (Unqual name), acc, fix, (ann ++ mkParensApiAnn lp)) }
- go l (HsTyVar _ _ (dL->L _ tc)) acc ann fix
- | isRdrTc tc = return (cL l tc, acc, fix, ann)
+ go _ (HsTyVar _ _ ltc@(dL->L _ tc)) acc ann fix
+ | isRdrTc tc = return (ltc, acc, fix, ann)
go _ (HsOpTy _ t1 ltc@(dL->L _ tc) t2) acc ann _fix
| isRdrTc tc = return (ltc, HsValArg t1:HsValArg t2:acc, Infix, ann)
go l (HsParTy _ ty) acc ann fix = goL ty acc (ann ++mkParensApiAnn l) fix
diff --git a/testsuite/tests/indexed-types/should_compile/T16632.hs b/testsuite/tests/indexed-types/should_compile/T16632.hs
new file mode 100644
index 0000000000..ab4f8dc7ed
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_compile/T16632.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TypeFamilies #-}
+module T16632 where
+
+type family F a b c
+type instance F Char b Int = ()
diff --git a/testsuite/tests/indexed-types/should_compile/T16632.stderr b/testsuite/tests/indexed-types/should_compile/T16632.stderr
new file mode 100644
index 0000000000..d2eab5c6b5
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_compile/T16632.stderr
@@ -0,0 +1,6 @@
+
+T16632.hs:5:22: warning: [-Wunused-type-patterns]
+ Defined but not used on the right hand side: type variable ‘b’
+ |
+5 | type instance F Char b Int = ()
+ | ^
diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T
index bc0b509e05..c268f2638d 100644
--- a/testsuite/tests/indexed-types/should_compile/all.T
+++ b/testsuite/tests/indexed-types/should_compile/all.T
@@ -286,3 +286,4 @@ test('T15711', normal, compile, ['-ddump-types'])
test('T15852', normal, compile, ['-ddump-types'])
test('T15764a', normal, compile, [''])
test('T15740a', normal, compile, [''])
+test('T16632', normal, compile, ['-Wunused-type-patterns -fdiagnostics-show-caret'])