summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/typecheck/TcTyDecls.hs2
-rw-r--r--testsuite/tests/patsyn/should_run/records-run.hs7
-rw-r--r--testsuite/tests/patsyn/should_run/records-run.stdout1
3 files changed, 9 insertions, 1 deletions
diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs
index df33bb0f16..68e15fbd48 100644
--- a/compiler/typecheck/TcTyDecls.hs
+++ b/compiler/typecheck/TcTyDecls.hs
@@ -846,7 +846,7 @@ mkOneRecordSelector all_cons idDetails fl
-- Selector type; Note [Polymorphic selectors]
field_ty = conLikeFieldType con1 lbl
- data_tvs = tyCoVarsOfTypeWellScoped data_ty
+ data_tvs = tyCoVarsOfTypesWellScoped inst_tys
data_tv_set= mkVarSet data_tvs
is_naughty = not (tyCoVarsOfType field_ty `subVarSet` data_tv_set)
(field_tvs, field_theta, field_tau) = tcSplitSigmaTy field_ty
diff --git a/testsuite/tests/patsyn/should_run/records-run.hs b/testsuite/tests/patsyn/should_run/records-run.hs
index 19a6bb2793..1719045ffd 100644
--- a/testsuite/tests/patsyn/should_run/records-run.hs
+++ b/testsuite/tests/patsyn/should_run/records-run.hs
@@ -1,4 +1,6 @@
{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE ViewPatterns #-}
module Main where
@@ -6,9 +8,14 @@ pattern Bi{a, b} = (a, b)
foo = ("a","b")
+pattern ReadP :: Read a => a -> String
+pattern ReadP {readp} <- (read -> readp)
+
main = do
print foo
print (a foo)
print (b foo)
print (foo {a = "c"})
print (foo {a = "fst", b = "snd"})
+
+ print (readp @Int "5")
diff --git a/testsuite/tests/patsyn/should_run/records-run.stdout b/testsuite/tests/patsyn/should_run/records-run.stdout
index a0878c75b3..e76be9cff7 100644
--- a/testsuite/tests/patsyn/should_run/records-run.stdout
+++ b/testsuite/tests/patsyn/should_run/records-run.stdout
@@ -3,3 +3,4 @@
"b"
("c","b")
("fst","snd")
+5