diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2017-01-23 20:23:28 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2017-01-26 15:20:14 +0200 |
commit | 0d1cb1574dd58d1026cac812e2098135823fa419 (patch) | |
tree | 2c7955bc45a085cf54bab5c7204f9ebd24686adf /testsuite | |
parent | ff9355e48d0cb04b3adf26e27e12e128f79618f4 (diff) | |
download | haskell-0d1cb1574dd58d1026cac812e2098135823fa419.tar.gz |
Make type import/export API Annotation friendly
Summary:
At the moment an export of the form
type C(..)
is parsed by the rule
```
| 'type' oqtycon {% amms (mkTypeImpExp (sLL $1 $> (unLoc $2)))
[mj AnnType $1,mj AnnVal $2] }
```
This means that the origiinal oqtycon loses its location which is then retained
in the AnnVal annotation.
The problem is if the oqtycon has its own annotations, these get lost.
e.g. in
type (?)(..)
the parens annotations for (?) get lost.
This patch adds a wrapper around the name in the IE type to
(a) provide a distinct location for the adornment annotation and
(b) identify the specific adornment, for use in the pretty printer rather than
occName magic.
Updates haddock submodule
Test Plan: ./validate
Reviewers: mpickering, dfeuer, bgamari, austin
Reviewed By: dfeuer
Subscribers: dfeuer, thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D3016
GHC Trac Issues: #13163
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/driver/extra_files.py | 1 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/annotations/Makefile | 4 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/annotations/T13163.stdout | 78 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/annotations/Test13163.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/annotations/all.T | 1 |
5 files changed, 100 insertions, 0 deletions
diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index 3f2cf5cc4b..a6b04dd04d 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -44,6 +44,7 @@ extra_src_files = { 'T10396': ['Test10396.hs'], 'T10399': ['Test10399.hs'], 'T12417': ['Test12417.hs'], + 'T13163': ['Test13163.hs'], 'T10420': ['rule-defining-plugin/'], 'T10458': ['A.c'], 'T10529a': ['hpc_sample_non_existing_module.tix'], diff --git a/testsuite/tests/ghc-api/annotations/Makefile b/testsuite/tests/ghc-api/annotations/Makefile index 6a6addae70..2da5fc00a9 100644 --- a/testsuite/tests/ghc-api/annotations/Makefile +++ b/testsuite/tests/ghc-api/annotations/Makefile @@ -137,3 +137,7 @@ load-main: .PHONY: T12417 T12417: $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test12417.hs + +.PHONY: T13163 +T13163: + $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test13163.hs diff --git a/testsuite/tests/ghc-api/annotations/T13163.stdout b/testsuite/tests/ghc-api/annotations/T13163.stdout new file mode 100644 index 0000000000..f216acdf98 --- /dev/null +++ b/testsuite/tests/ghc-api/annotations/T13163.stdout @@ -0,0 +1,78 @@ +---Problems (should be empty list)--- +[] +---Annotations----------------------- +-- SrcSpan the annotation is attached to, AnnKeywordId, +-- list of locations the keyword item appears in +[ +((Test13163.hs:1:1,AnnModule), [Test13163.hs:4:1-6]), +((Test13163.hs:1:1,AnnWhere), [Test13163.hs:8:5-9]), +((Test13163.hs:(5,3)-(8,3),AnnCloseP), [Test13163.hs:8:3]), +((Test13163.hs:(5,3)-(8,3),AnnOpenP), [Test13163.hs:5:3]), +((Test13163.hs:5:5-14,AnnCloseP), [Test13163.hs:5:14]), +((Test13163.hs:5:5-14,AnnComma), [Test13163.hs:6:3]), +((Test13163.hs:5:5-14,AnnDotdot), [Test13163.hs:5:12-13]), +((Test13163.hs:5:5-14,AnnOpenP), [Test13163.hs:5:11]), +((Test13163.hs:6:5-12,AnnType), [Test13163.hs:6:5-8]), +((Test13163.hs:6:5-16,AnnCloseP), [Test13163.hs:6:16]), +((Test13163.hs:6:5-16,AnnComma), [Test13163.hs:7:3]), +((Test13163.hs:6:5-16,AnnDotdot), [Test13163.hs:6:14-15]), +((Test13163.hs:6:5-16,AnnOpenP), [Test13163.hs:6:13]), +((Test13163.hs:6:10-12,AnnCloseP), [Test13163.hs:6:12]), +((Test13163.hs:6:10-12,AnnOpenP), [Test13163.hs:6:10]), +((Test13163.hs:6:10-12,AnnVal), [Test13163.hs:6:11]), +((Test13163.hs:7:5,AnnComma), [Test13163.hs:7:6]), +((Test13163.hs:7:8-15,AnnComma), [Test13163.hs:7:16]), +((Test13163.hs:7:8-15,AnnType), [Test13163.hs:7:8-11]), +((Test13163.hs:7:13-15,AnnCloseP), [Test13163.hs:7:15]), +((Test13163.hs:7:13-15,AnnOpenP), [Test13163.hs:7:13]), +((Test13163.hs:7:13-15,AnnVal), [Test13163.hs:7:14]), +((Test13163.hs:7:18-31,AnnPattern), [Test13163.hs:7:18-24]), +((Test13163.hs:10:1-78,AnnImport), [Test13163.hs:10:1-6]), +((Test13163.hs:10:1-78,AnnSemi), [Test13163.hs:11:1]), +((Test13163.hs:10:31-78,AnnCloseP), [Test13163.hs:10:78]), +((Test13163.hs:10:31-78,AnnOpenP), [Test13163.hs:10:31]), +((Test13163.hs:10:32-41,AnnComma), [Test13163.hs:10:42]), +((Test13163.hs:10:32-41,AnnType), [Test13163.hs:10:32-35]), +((Test13163.hs:10:37-41,AnnCloseP), [Test13163.hs:10:41]), +((Test13163.hs:10:37-41,AnnOpenP), [Test13163.hs:10:37]), +((Test13163.hs:10:37-41,AnnVal), [Test13163.hs:10:38-40]), +((Test13163.hs:10:44-53,AnnComma), [Test13163.hs:10:54]), +((Test13163.hs:10:44-53,AnnType), [Test13163.hs:10:44-47]), +((Test13163.hs:10:49-53,AnnCloseP), [Test13163.hs:10:53]), +((Test13163.hs:10:49-53,AnnOpenP), [Test13163.hs:10:49]), +((Test13163.hs:10:49-53,AnnVal), [Test13163.hs:10:50-52]), +((Test13163.hs:10:56-65,AnnComma), [Test13163.hs:10:66]), +((Test13163.hs:10:56-65,AnnType), [Test13163.hs:10:56-59]), +((Test13163.hs:10:61-65,AnnCloseP), [Test13163.hs:10:65]), +((Test13163.hs:10:61-65,AnnOpenP), [Test13163.hs:10:61]), +((Test13163.hs:10:61-65,AnnVal), [Test13163.hs:10:62-64]), +((Test13163.hs:10:68-77,AnnType), [Test13163.hs:10:68-71]), +((Test13163.hs:10:73-77,AnnCloseP), [Test13163.hs:10:77]), +((Test13163.hs:10:73-77,AnnOpenP), [Test13163.hs:10:73]), +((Test13163.hs:10:73-77,AnnVal), [Test13163.hs:10:74-76]), +((Test13163.hs:11:1-61,AnnImport), [Test13163.hs:11:1-6]), +((Test13163.hs:11:1-61,AnnSemi), [Test13163.hs:12:1]), +((Test13163.hs:11:24-61,AnnCloseP), [Test13163.hs:11:61]), +((Test13163.hs:11:24-61,AnnOpenP), [Test13163.hs:11:24]), +((Test13163.hs:11:25-31,AnnComma), [Test13163.hs:11:32]), +((Test13163.hs:11:34-44,AnnComma), [Test13163.hs:11:45]), +((Test13163.hs:11:47-56,AnnType), [Test13163.hs:11:47-50]), +((Test13163.hs:11:47-60,AnnCloseP), [Test13163.hs:11:60]), +((Test13163.hs:11:47-60,AnnDotdot), [Test13163.hs:11:58-59]), +((Test13163.hs:11:47-60,AnnOpenP), [Test13163.hs:11:57]), +((Test13163.hs:11:52-56,AnnCloseP), [Test13163.hs:11:56]), +((Test13163.hs:11:52-56,AnnOpenP), [Test13163.hs:11:52]), +((Test13163.hs:11:52-56,AnnVal), [Test13163.hs:11:53-55]), +((Test13163.hs:12:1-19,AnnImport), [Test13163.hs:12:1-6]), +((Test13163.hs:12:1-19,AnnSemi), [Test13163.hs:14:1]), +((Test13163.hs:14:1-22,AnnEqual), [Test13163.hs:14:18]), +((Test13163.hs:14:1-22,AnnPattern), [Test13163.hs:14:1-7]), +((Test13163.hs:14:1-22,AnnSemi), [Test13163.hs:16:1]), +((Test13163.hs:14:20-22,AnnCloseS), [Test13163.hs:14:22]), +((Test13163.hs:14:20-22,AnnOpenS), [Test13163.hs:14:20]), +((Test13163.hs:16:1-13,AnnEqual), [Test13163.hs:16:3]), +((Test13163.hs:16:1-13,AnnFunId), [Test13163.hs:16:1]), +((Test13163.hs:16:1-13,AnnSemi), [Test13163.hs:17:1]), +((<no location info>,AnnEofPos), [Test13163.hs:17:1]) +] + diff --git a/testsuite/tests/ghc-api/annotations/Test13163.hs b/testsuite/tests/ghc-api/annotations/Test13163.hs new file mode 100644 index 0000000000..439d825386 --- /dev/null +++ b/testsuite/tests/ghc-api/annotations/Test13163.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE ExplicitNamespaces #-} +module T13163 + ( Record(..) + , type (?)(..) + , f, type (+), pattern Single + ) where + +import Data.Promotion.Prelude (type (:+$), type (:*$), type (:^$), type (:-$)) +import Options.Generic (Generic, ParseRecord, type (<?>)(..)) +import GHC.TypeLits + +pattern Single x = [x] + +f = undefined diff --git a/testsuite/tests/ghc-api/annotations/all.T b/testsuite/tests/ghc-api/annotations/all.T index fbe8c3e35f..1028626575 100644 --- a/testsuite/tests/ghc-api/annotations/all.T +++ b/testsuite/tests/ghc-api/annotations/all.T @@ -27,3 +27,4 @@ test('T11332', ignore_stderr, run_command, ['$MAKE -s --no-print-directory test('T11430', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T11430']) test('load-main', ignore_stderr, run_command, ['$MAKE -s --no-print-directory load-main']) test('T12417', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T12417']) +test('T13163', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13163']) |