summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShayne Fletcher <shayne@shaynefletcher.org>2021-07-29 22:02:47 -0400
committerShayne Fletcher <shayne@shaynefletcher.org>2021-07-30 08:29:23 -0400
commit2df7c9d45747fa9bf48a4530a7c1caaa428fccdc (patch)
tree3d9e199112810ac1c591155e50b1e51446a2b7d1
parent54d6b20192fe6fc244248c7766533a768c591bae (diff)
downloadhaskell-wip/T20186.tar.gz
Supply missing case for '.' inwip/T20186
-rw-r--r--compiler/GHC/Parser/Lexer.x1
-rw-r--r--testsuite/tests/parser/should_compile/T20186.hs6
-rw-r--r--testsuite/tests/parser/should_compile/all.T2
-rw-r--r--testsuite/tests/printer/all.T4
4 files changed, 10 insertions, 3 deletions
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index 95fc574cb2..b63ce55669 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -1664,6 +1664,7 @@ varsym_prefix = sym $ \span exts s ->
varsym_suffix :: Action
varsym_suffix = sym $ \span _ s ->
if | s == fsLit "@" -> failMsgP (\srcLoc -> mkPlainErrorMsgEnvelope srcLoc $ PsErrSuffixAT)
+ | s == fsLit "." -> return ITdot
| otherwise ->
do { addPsMessage
(mkSrcSpanPs span)
diff --git a/testsuite/tests/parser/should_compile/T20186.hs b/testsuite/tests/parser/should_compile/T20186.hs
new file mode 100644
index 0000000000..0085a5d1aa
--- /dev/null
+++ b/testsuite/tests/parser/should_compile/T20186.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE OverloadedRecordDot, ExplicitForAll #-}
+
+identity :: forall a. a -> a
+identity a = a
+
+main = undefined
diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T
index 5431f7c4f4..e2d4303b7e 100644
--- a/testsuite/tests/parser/should_compile/all.T
+++ b/testsuite/tests/parser/should_compile/all.T
@@ -176,3 +176,5 @@ test('T18834b', normal, compile, [''])
test('T12862', normal, compile, [''])
test('T19082', normal, compile, [''])
test('T19521', normal, compile, [''])
+
+test('T20186', normal, compile, [''])
diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T
index 1740dd497a..2a477cf83b 100644
--- a/testsuite/tests/printer/all.T
+++ b/testsuite/tests/printer/all.T
@@ -115,9 +115,7 @@ test('AnnotationTuple', ignore_stderr, makefile_test, ['AnnotationTuple'])
test('ListComprehensions', ignore_stderr, makefile_test, ['ListComprehensions'])
test('load-main', ignore_stderr, makefile_test, ['load-main'])
-# PPR of explicit foralls needs the "." to have an extra space. See note in pprHsForAll
-test('PprRecordDotSyntax1', [ignore_stderr, expect_fail], makefile_test, ['PprRecordDotSyntax1'])
-
+test('PprRecordDotSyntax1', ignore_stderr, makefile_test, ['PprRecordDotSyntax1'])
test('PprRecordDotSyntax2', ignore_stderr, makefile_test, ['PprRecordDotSyntax2'])
test('PprRecordDotSyntax3', ignore_stderr, makefile_test, ['PprRecordDotSyntax3'])
test('PprRecordDotSyntax4', ignore_stderr, makefile_test, ['PprRecordDotSyntax4'])