summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShayne Fletcher <shayne@shaynefletcher.org>2021-07-29 22:02:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-02 04:18:35 -0400
commite15381842d41a79a40a64d34ae0798aff8e6a989 (patch)
treec8d32535cf43a6ff3ee506e708c751664ea71d90
parent13af2feeca20e10d7dda675ad0634689a1931f17 (diff)
downloadhaskell-e15381842d41a79a40a64d34ae0798aff8e6a989.tar.gz
Supply missing case for '.' in
-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'])