diff options
author | Joshua Price <2855417+ElderEphemera@users.noreply.github.com> | 2020-05-22 23:57:56 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-07-26 15:05:52 -0400 |
commit | 83bcf37d447ffcc79af14092afdd0f0add519816 (patch) | |
tree | f2943cbab9983991a639be8a30b70fd2289fdf37 | |
parent | 55fac76881ceb849d0e03d98965981ffcb9acb87 (diff) | |
download | haskell-83bcf37d447ffcc79af14092afdd0f0add519816.tar.gz |
Make `identifier` parse unparenthesized `->` (#18060)
(cherry picked from commit d6203f24cf421749616a247c047a9b44192f963a)
-rw-r--r-- | compiler/parser/Parser.y | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/T18060/T18060.script | 1 | ||||
-rw-r--r-- | testsuite/tests/ghci/T18060/T18060.stdout | 12 | ||||
-rw-r--r-- | testsuite/tests/ghci/T18060/all.T | 1 |
4 files changed, 16 insertions, 0 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 9df4ff988e..a5d873aa41 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -648,6 +648,8 @@ identifier :: { Located RdrName } | qconop { $1 } | '(' '->' ')' {% ams (sLL $1 $> $ getRdrName funTyCon) [mop $1,mu AnnRarrow $2,mcp $3] } + | '->' {% ams (sLL $1 $> $ getRdrName funTyCon) + [mu AnnRarrow $1] } | '(' '~' ')' {% ams (sLL $1 $> $ eqTyCon_RDR) [mop $1,mj AnnTilde $2,mcp $3] } diff --git a/testsuite/tests/ghci/T18060/T18060.script b/testsuite/tests/ghci/T18060/T18060.script new file mode 100644 index 0000000000..22ad5994c5 --- /dev/null +++ b/testsuite/tests/ghci/T18060/T18060.script @@ -0,0 +1 @@ +:i -> diff --git a/testsuite/tests/ghci/T18060/T18060.stdout b/testsuite/tests/ghci/T18060/T18060.stdout new file mode 100644 index 0000000000..9d6ab23dba --- /dev/null +++ b/testsuite/tests/ghci/T18060/T18060.stdout @@ -0,0 +1,12 @@ +type (->) :: * -> * -> * +data (->) a b + -- Defined in ‘GHC.Prim’ +infixr -1 -> +instance Applicative ((->) r) -- Defined in ‘GHC.Base’ +instance Functor ((->) r) -- Defined in ‘GHC.Base’ +instance Monad ((->) r) -- Defined in ‘GHC.Base’ +instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’ +instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’ +type (~) :: forall k. k -> k -> Constraint +class (a ~ b) => (~) a b + -- Defined in ‘GHC.Types’ diff --git a/testsuite/tests/ghci/T18060/all.T b/testsuite/tests/ghci/T18060/all.T new file mode 100644 index 0000000000..5d6cf4299f --- /dev/null +++ b/testsuite/tests/ghci/T18060/all.T @@ -0,0 +1 @@ +test('T18060', normal, ghci_script, ['T18060.script']) |